BezierShape Class Reference

#include <shape.h>

Class Description

Defines a basic bezier shape object.

The BezierShape is effectively a collection of Bezier Splines. For example the 3ds Max Donut object has two splines in a hierarchy to make a shape. The BezierShape contains these splines.

See also
Class ShapeObject, Class Spline3D, Class PatchCapInfo, Class ShapeVSel, Class ShapeSSel, Class ShapePSel, Class Material, Shapes and Splines.
+ Inheritance diagram for BezierShape:

Public Member Functions

CoreExport BezierShape ()
 
CoreExport BezierShape (BezierShape &fromShape)
 
CoreExport void Init ()
 
CoreExport ~BezierShape ()
 
CoreExport void RenderGizmo (GraphicsWindow *gw)
 
CoreExport void InvalidateGeomCache ()
 
CoreExport void InvalidateCapCache ()
 
CoreExport BitArray VertexFlagSel (int poly, DWORD flag)
 Constructs a vertex selection list of the specified poly. More...
 
CoreExport void GetDeformBBox (TimeValue t, Box3 &box, Matrix3 *tm, BOOL useSel)
 
CoreExport void GetClosures (BitArray &array)
 
CoreExport void SetClosures (BitArray &array)
 
CoreExport void Reverse (int poly, BOOL keepZero=FALSE)
 
CoreExport void Reverse (BitArray &reverse, BOOL keepZero=FALSE)
 
CoreExport ShapeHierarchyOrganizeCurves (TimeValue t, ShapeHierarchy *hier=NULL)
 
CoreExport void MakePolyShape (PolyShape &pshp, int nSteps=-1, BOOL doOptimize=FALSE)
 
CoreExport void MakeFirst (int poly, int vertex)
 
CoreExport void Transform (Matrix3 &tm)
 
CoreExport void ReadyCachedPolyShape ()
 
CoreExport void CopyShapeDataFrom (BezierShape &fromShape)
 
CoreExport void PrepVertBaseIndex ()
 
CoreExport int GetVertIndex (int poly, int vert)
 
CoreExport void GetPolyAndVert (int index, int &polyOut, int &vertOut)
 
CoreExport int GetTotalVerts ()
 
CoreExport Point3 GetVert (int index)
 
CoreExport void SetVert (int index, const Point3 &xyz)
 
CoreExport BOOL DeleteSelVerts (int poly)
 
CoreExport BOOL DeleteSelSegs (int poly)
 
CoreExport BOOL DeleteSelectedVerts ()
 
CoreExport BOOL DeleteSelectedSegs ()
 
CoreExport BOOL DeleteSelectedPolys ()
 
CoreExport BOOL CloneSelectedParts (BOOL reverse=FALSE)
 
CoreExport BOOL RecordTopologyTags (int channel=0)
 
CoreExport Point3 InterpCurve3D (int poly, float param, int ptype=PARAM_SIMPLE)
 
CoreExport Point3 TangentCurve3D (int poly, float param, int ptype=PARAM_SIMPLE)
 
CoreExport Point3 InterpPiece3D (int poly, int piece, float param, int ptype=PARAM_SIMPLE)
 
CoreExport Point3 TangentPiece3D (int poly, int piece, float param, int ptype=PARAM_SIMPLE)
 
CoreExport MtlID GetMatID (int poly, int piece)
 
CoreExport float LengthOfCurve (int poly)
 
CoreExport void GetTopology (BezierShapeTopology &topo)
 
CoreExport BOOL PerformTrimOrExtend (IObjParam *ip, ViewExp *vpt, ShapeHitData *hit, IPoint2 &m, ShapeContextCallback &cb, int trimType, int trimInfinite)
 
CoreExport BOOL SelVertsSameType ()
 
CoreExport BOOL SelSegsSameType ()
 
CoreExport BOOL SelSplinesSameType ()
 
CoreExport BOOL HideSelectedSegs ()
 
CoreExport BOOL HideSelectedVerts ()
 
CoreExport BOOL HideSelectedSplines ()
 
CoreExport BOOL UnhideSegs ()
 
CoreExport int UnselectHiddenVerts ()
 
CoreExport int UnselectHiddenSegs ()
 
CoreExport int UnselectHiddenSplines ()
 
CoreExport void SetVertexWeightCount (int i)
 
CoreExport void SetVertexWeight (int i, float w)
 
CoreExport float VertexWeight (int i)
 
CoreExport bool VertexWeightSupport ()
 
CoreExport float * GetVSelectionWeights ()
 
CoreExport void SupportVSelectionWeights ()
 
CoreExport int UseEdgeDists ()
 
CoreExport void SetUseEdgeDists (int edgeDist)
 
CoreExport int EdgeDist ()
 
CoreExport void SetEdgeDist (int edgeDist)
 
CoreExport int UseSoftSelections ()
 
CoreExport void SetUseSoftSelections (int useSoftSelections)
 
CoreExport int AffectBackface ()
 
CoreExport void SetAffectBackface (int affectBackface)
 
CoreExport float Falloff ()
 
CoreExport void SetFalloff (float falloff)
 
CoreExport float Pinch ()
 
CoreExport void SetPinch (float pinch)
 
CoreExport float Bubble ()
 
CoreExport void SetBubble (float bubble)
 
CoreExport void InvalidateVertexWeights ()
 
CoreExport void UpdateVertexDists ()
 
CoreExport void UpdateEdgeDists ()
 
CoreExport void UpdateVertexWeights ()
 
CoreExport bool DeleteSplines (const unsigned int *indices, unsigned int n)
 Delete multiple splines at once. More...
 
Operators
CoreExport BezierShapeoperator= (BezierShape &fromShape)
 
CoreExport BezierShapeoperator= (PolyShape &fromShape)
 
CoreExport BezierShapeoperator+= (BezierShape &from)
 
Get Vertex / Set Vertex
CoreExport Point3 GetVert (int poly, int i)
 
CoreExport void SetVert (int poly, int i, const Point3 &xyz)
 
Render / Select / Snap / HitTest
CoreExport void Render (GraphicsWindow *gw, Material *ma, RECT *rp, int compFlags, int numMat)
 
CoreExport BOOL Select (GraphicsWindow *gw, Material *ma, HitRegion *hr, int abortOnHit=FALSE)
 
CoreExport void Snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm)
 
CoreExport void Snap (GraphicsWindow *gw, SnapInfo *snap, IPoint2 *p, Matrix3 &tm, DWORD flags)
 
CoreExport BOOL SubObjectHitTest (GraphicsWindow *gw, Material *ma, HitRegion *hr, DWORD flags, SubShapeHitList &hitList)
 
CoreExport float FindSegmentPoint (int poly, int segment, GraphicsWindow *gw, Material *ma, HitRegion *hr, int ptype=PARAM_SIMPLE)
 
Bounding Box
CoreExport void BuildBoundingBox (void)
 
CoreExport Box3 GetBoundingBox (Matrix3 *tm=NULL)
 
Data Flow Evaluation
CoreExport void ShallowCopy (BezierShape *ashape, ChannelMask channels)
 
CoreExport void DeepCopy (BezierShape *ashape, ChannelMask channels)
 
CoreExport void NewAndCopyChannels (ChannelMask channels)
 
CoreExport void FreeChannels (ChannelMask channels, int zeroOthers=1)
 
Display Flag Access
CoreExport void SetDispFlag (DWORD f)
 
CoreExport DWORD GetDispFlag (DWORD f)
 
CoreExport void ClearDispFlag (DWORD f)
 
Selection / Update Selection
CoreExport BitArray VertexTempSel (int poly, int level=-1)
 
CoreExport BitArray VertexTempSelAll (int poly=-1, BOOL includeVecs=FALSE, int level=0, BOOL forceSel=FALSE)
 
CoreExport void UpdateSels (BOOL save=FALSE)
 
Load / Save
CoreExport IOResult Save (ISave *isave)
 
CoreExport IOResult Load (ILoad *iload)
 
Spline and Shape
int SplineCount ()
 
CoreExport Spline3DGetSpline (int index)
 
CoreExport Spline3DNewSpline (int itype=KTYPE_CORNER, int dtype=KTYPE_BEZIER, int ptype=PARM_UNIFORM)
 
CoreExport Spline3DAddSpline (Spline3D *spline)
 
CoreExport int DeleteSpline (int index)
 
CoreExport int InsertSpline (Spline3D *spline, int index)
 
CoreExport void NewShape ()
 
CoreExport void AddAndWeld (BezierShape &from, float weldThreshold)
 
Get Vertices and Segments
CoreExport int GetNumVerts ()
 
CoreExport int GetNumSegs ()
 
Capping Methods
CoreExport int MakeCap (TimeValue t, MeshCapInfo &capInfo, int capType)
 
CoreExport int MakeCap (TimeValue t, PatchCapInfo &capInfo)
 
CoreExport int ReadyPatchCap ()
 
Knot Information Methods
CoreExport void PrepKnotBaseIndex ()
 
CoreExport int GetKnotIndex (int poly, int knot)
 
CoreExport void GetPolyAndKnot (int index, int &polyOut, int &knotOut)
 
CoreExport int GetTotalKnots ()
 
Knot Binding Methods
 
CoreExport void BindKnot (BOOL isEnd, int segIndex, int splineSegID, int splinePointID)
 
CoreExport BOOL UnbindKnot (int splineID, BOOL isEnd)
 
CoreExport void UpdateBindList (BOOL useGeometricTracking=FALSE)
 
- Public Member Functions inherited from BaseInterfaceServer
virtual UtilExport BaseInterfaceGetInterface (Interface_ID id)
 
virtual UtilExport int NumInterfaces () const
 
virtual UtilExport BaseInterfaceGetInterfaceAt (int i) const
 
virtual UtilExport ~BaseInterfaceServer ()
 
- Public Member Functions inherited from InterfaceServer
virtual UtilExport ~InterfaceServer ()
 Destructor. More...
 

Public Attributes

MaxSDK::Array< bindShapebindList
 List of bind points. More...
 
PatchCapInfo patchCap
 Patch capping cache (mesh capping and hierarchy caches stored in PolyShape cache). More...
 
BOOL patchCapCacheValid
 Indicates if the patch cap is valid or not. More...
 
Spline3D ** splines
 A pointer to the list of splines. More...
 
int splineCount
 The number of splines in this shape. More...
 
int steps
 Number of steps (a value of -1 will use adaptive). More...
 
BOOL optimize
 Setting this to TRUE optimizes linear segments. More...
 
ShapeVSel vertSel
 The selected vertices. More...
 
ShapeSSel segSel
 The selected segments. More...
 
ShapePSel polySel
 The selected polygons. More...
 
int bezVecPoly
 If hit bezier vector, this is its info. More...
 
int bezVecVert
 This is used internally in hit testing. More...
 
DWORD selLevel
 The Selection level. More...
 
DWORD dispFlags
 Display attribute flags. More...
 
float * mpVertexWeights
 
int numVertexWeights
 
intmpVertexEdgeDists
 
float * mpVertexDists
 
float mFalloff
 
float mPinch
 
float mBubble
 
int mEdgeDist
 
int mUseEdgeDist
 
int mAffectBackface
 
int mUseSoftSelections
 

Friends

class BezierShapeLeakDetector
 
INT_PTR CALLBACK SplineSelectDlgProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Additional Inherited Members

- Static Public Member Functions inherited from MaxHeapOperators
static UtilExport voidoperator new (size_t size)
 Standard new operator used to allocate objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e)
 Standard new operator used to allocate objects if there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate objects that takes the type of memory, filename and line number where the new was called If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate objects that takes the filename and line number where the new was called If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new (size_t size, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate objects that takes extra flags to specify special operations If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, int block_type, const char *filename, int line)
 New operator used to allocate arrays of objects. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, const char *filename, int line)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport voidoperator new[] (size_t size, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, an exception will be thrown. More...
 
static UtilExport voidoperator new[] (size_t size, const std::nothrow_t &e, unsigned long flags)
 New operator used to allocate arrays of objects If there is insufficient memory, NULL will be returned. More...
 
static UtilExport void operator delete (void *ptr)
 Standard delete operator used to deallocate an object If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an object If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an object that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an object that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete (void *ptr, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an object that takes extra flags to specify special operations If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e)
 Standard delete operator used to deallocate an array of objects If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, int block_type, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the type of memory, filename and line number where the delete was called If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, const char *filename, int line)
 Delete operator used to deallocate an array of objects that takes the filename and line number where the delete was called If the pointer is invalid, nothing will happen. More...
 
static UtilExport void operator delete[] (void *ptr, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport void operator delete[] (void *ptr, const std::nothrow_t &e, unsigned long flags)
 Delete operator used to deallocate an array of objects that takes extra flags to specify special operations If the pointer is invalid, an exception will be thrown. More...
 
static UtilExport voidoperator new (size_t size, void *placement_ptr)
 Placement new operator. More...
 
static UtilExport void operator delete (void *ptr, void *placement_ptr)
 Placement delete operator. More...
 
static UtilExport voidaligned_malloc (size_t size, size_t alignment)
 Allocates memory on a specified alignment boundary. More...
 
static UtilExport voidaligned_realloc (void *ptr, size_t size, size_t alignment)
 Reallocates memory on a specified alignment boundary. More...
 
static UtilExport void aligned_free (void *ptr)
 Frees a block of memory that was allocated with aligned_malloc/aligned_realloc. More...
 
- Protected Attributes inherited from BaseInterfaceServer
Tab< BaseInterface * > interfaces
 

Constructor & Destructor Documentation

Remarks
The data members are initialized as follows:

Remarks
Constructor. The shape is initialized based on the fromShape.
Remarks
Destructor. All the splines in this shape are cleared.

Member Function Documentation

CoreExport void Init ( )
Remarks
Initializes the BezierShape. The data members are initialized as follows:
CoreExport BezierShape& operator= ( BezierShape fromShape)
Remarks
Assignment operator.
CoreExport BezierShape& operator= ( PolyShape fromShape)
Remarks
Assignment operator.
CoreExport Point3 GetVert ( int  poly,
int  i 
)
Remarks
Returns a copy of the 'i-th' vertex of the specified spline.
Parameters:
int poly

The index into the splines list where poly >= 0 and poly < splineCount.

int i

The index of the control point in the spline.
CoreExport void SetVert ( int  poly,
int  i,
const Point3 xyz 
)
Remarks
Sets the 'i-th' vertex of the specified spline.
Parameters:
int poly

The index into the splines list where poly >= 0 and poly < splineCount.

int i

The index of the vertex in the spline.

const Point3 &xyz

The point to set.
CoreExport void Render ( GraphicsWindow gw,
Material ma,
RECT *  rp,
int  compFlags,
int  numMat 
)
Remarks
This is used internally to render the shape.
CoreExport void RenderGizmo ( GraphicsWindow gw)
CoreExport BOOL Select ( GraphicsWindow gw,
Material ma,
HitRegion hr,
int  abortOnHit = FALSE 
)
CoreExport void Snap ( GraphicsWindow gw,
SnapInfo snap,
IPoint2 p,
Matrix3 tm 
)
Remarks
This is used internally to snap to the shape.
CoreExport void Snap ( GraphicsWindow gw,
SnapInfo snap,
IPoint2 p,
Matrix3 tm,
DWORD  flags 
)
Remarks
This is used internally to snap to the shape.
CoreExport BOOL SubObjectHitTest ( GraphicsWindow gw,
Material ma,
HitRegion hr,
DWORD  flags,
SubShapeHitList hitList 
)
Remarks
This method is used internally to perform sub-object hit testing of the shape.
CoreExport void BuildBoundingBox ( void  )
Remarks
Computes the bounding box of the splines making up this bezier shape object. The result is stored in the bdgBox data member.
CoreExport Box3 GetBoundingBox ( Matrix3 tm = NULL)
Remarks
Returns the bounding box of the splines making up this bezier shape object. The optional TM allows the box to be calculated in any space.
Parameters:
Matrix3 *tm=NULL

The matrix to transform the points before computing the bounding box.
CoreExport void InvalidateGeomCache ( )
Remarks
This method should be called when a shape changes. It invalidates the caches of the shape. This resets the bounding box, and removes the hierarchy, cap and shape caches.
CoreExport void InvalidateCapCache ( )
Remarks
This method is used internally.
CoreExport void ShallowCopy ( BezierShape ashape,
ChannelMask  channels 
)
Remarks
This method is used internally in data flow evaluation
CoreExport void DeepCopy ( BezierShape ashape,
ChannelMask  channels 
)
Remarks
This method is used internally in data flow evaluation
CoreExport void NewAndCopyChannels ( ChannelMask  channels)
Remarks
This method is used internally in data flow evaluation
CoreExport void FreeChannels ( ChannelMask  channels,
int  zeroOthers = 1 
)
Remarks
This method is used internally in data flow evaluation
CoreExport void SetDispFlag ( DWORD  f)
Remarks
Sets the state of the specified display flags.
Parameters:
DWORD f

The flags to set. See Display Flags.
CoreExport DWORD GetDispFlag ( DWORD  f)
Remarks
Returns the state of the specified display flags.
Parameters:
DWORD f

The flags to get. See Display Flags.
CoreExport void ClearDispFlag ( DWORD  f)
Remarks
Clears the specified display flags.
Parameters:
DWORD f

The flags to clear. See Display Flags.
CoreExport BitArray VertexTempSel ( int  poly,
int  level = -1 
)
Remarks
Constructs a vertex selection list based on the current selection level for the specified spline. For example if the selection level is at object level all the bits are set. If the selection level is at vertex level only the selected vertex bits are set. See Class BitArray.
Parameters:
int poly

The index into the splines data member.

int level = -1

This allows a selction level to be optionally specified. For example if the selection level is at object level all the bits are set. If the selection level is at vertex level only the selected vertex bits are set. One of the following values:

SHAPE_OBJECT

SHAPE_SPLINE

SHAPE_SEGMENT

SHAPE_VERTEX
CoreExport BitArray VertexTempSelAll ( int  poly = -1,
BOOL  includeVecs = FALSE,
int  level = 0,
BOOL  forceSel = FALSE 
)
Remarks
This method looks at the selection state for the selection level and sets the appropriate bits based on the selection set unless forceSel is TRUE. If forceSel is TRUE, it acts as if every item in the selection set for the specified spline was set. It's an easy way to select entire splines.

See Class BitArray.
Parameters:
int poly = -1

The index into the splines data member (-1 means use all).

BOOL includeVecs = FALSE

If set, this method will set the bits for vectors associated with selected knots.

int level = 0

This allows a selction level to be optionally specified. For example if the selection level is at object level all the bits are set. If the selection level is at vertex level only the selected vertex bits are set. One of the following values:

SHAPE_OBJECT

SHAPE_SPLINE

SHAPE_SEGMENT

SHAPE_VERTEX

BOOL forceSel = FALSE

If TRUE, it acts as if every item in the selection set for the specified spline was set. It's an easy way to select entire splines. For example, selecting spline 2 regardless of the spline-level selection state:

VertexTempSelAll(2, FALSE, SHAPE_SPLINE, TRUE);

This just builds the selection set as if spline 2 was completely selected. Otherwise, the spline bits would have only been selected if BezierShape::polySel.sel[2] was set.

Incidentally, the following calls will do exactly the same thing:

VertexTempSelAll(2, FALSE, SHAPE_VERTEX, TRUE);

VertexTempSelAll(2, FALSE, SHAPE_SEGMENT, TRUE);

For what it's worth, the SHAPE_SPLINE version is the most efficient.
CoreExport BitArray VertexFlagSel ( int  poly,
DWORD  flag 
)

Constructs a vertex selection list of the specified poly.

Remarks
Constructs a vertex selection list of the specified poly based on the setting of the specified flag on the vertex. The implementation calls GetFlag() on each SplineKnotAssy checking the specified flag value.
Parameters
poly- Specifies the polygon to construct the list from.
flag- The flag value each vertex will be tested for.
CoreExport IOResult Save ( ISave isave)
Remarks
Saves the shape data to the .MAX file.
CoreExport IOResult Load ( ILoad iload)
Remarks
Loads the shape data from the .MAX file.
int SplineCount ( )
inline
Remarks
Returns the number of splines in this shape.
564 { return splineCount; }
int splineCount
The number of splines in this shape.
Definition: shape.h:306
CoreExport Spline3D* GetSpline ( int  index)
Remarks
Returns a pointer to the spline specified by the index passed.
Parameters:
int index

Specifies which spline to return. This is an index into the splines data member.
CoreExport Spline3D* NewSpline ( int  itype = KTYPE_CORNER,
int  dtype = KTYPE_BEZIER,
int  ptype = PARM_UNIFORM 
)
Remarks
Creates and adds an empty spline to the shape.
Parameters:
int itype = KTYPE_CORNER

The initial knot type you get when you click and release the mouse during spline creation. See Knot types. int dtype = KTYPE_BEZIER

The drag knot type used when you click and drag to create a vertex during spline creation. See Knot types. int ptype = PARM_UNIFORM

This parameter is not used. Let it default to PARM_UNIFORM.
Returns
A pointer to the newly created spline.
CoreExport Spline3D* AddSpline ( Spline3D spline)
Remarks
Add an existing spline to this shape as the last one in the list. Note that this copies only the pointer, it does not copy the entire spline, so do not delete the spline anywhere else. This will do it when it's done with it.
Parameters:
Spline3D* spline

The spline to add.
Returns
A pointer to the spline passed or NULL if the call failed.
CoreExport int DeleteSpline ( int  index)
Remarks
Deletes the specified spline.
Parameters:
int index

The index into the splines data member.
Returns
Nonzero on success; otherwise zero.
CoreExport int InsertSpline ( Spline3D spline,
int  index 
)
Remarks
Inserts the specified spline into the spline list at the location passed.
Parameters:
Spline3D* spline

The spline to add.

int index

The index in to the splines data member indicating where to insert the spline.
Returns
Nonzero on success; otherwise zero.
CoreExport void NewShape ( )
Remarks
This method deletes every spline in the shape.
CoreExport int GetNumVerts ( )
Remarks
Returns the total number of vertices in the entire shape.
CoreExport int GetNumSegs ( )
Remarks
Returns the total number of segments in the entire shape.
CoreExport void GetDeformBBox ( TimeValue  t,
Box3 box,
Matrix3 tm,
BOOL  useSel 
)
Remarks
Computes the bounding box of this shape.
Parameters:
TimeValue t

This parameter is not used.

Box3& box

The result is stored here.

Matrix3 *tm

The points of each spline in this shape are deformed using this matrix.

BOOL useSel

If TRUE the box is computed about the selected vertices only; otherwise all points.
CoreExport void UpdateSels ( BOOL  save = FALSE)
Remarks
This is a very important call to make. When you are done adding polygons to the shape you should call this method. This method updates a set of embedded selection set data within the shape. This selection set data tells what polygons are selected, what segments are selected, and what control points are selected. This resets the sizes of the selection bit arrays for this shape.
Parameters:
BOOL save = FALSE

This parameter is available in release 4.0 and later only.

This optional parameter preserves the selection set information when set to TRUE, and erases it when set to FALSE. The default, FALSE, is present for backward compatibility, where there was no argument.
CoreExport void GetClosures ( BitArray array)
Remarks
For each spline in this shape, this method sets the corresponding bit if the shape is closed and clears the bit is the shape is open.
Parameters:
BitArray& array

The BitArray to update.
CoreExport void SetClosures ( BitArray array)
Remarks
Sets the closed state of each spline in this shape based on the BitArray passed.
Parameters:
BitArray& array

Indicates which shapes should be closed: 1 = closed; 0 = open.
CoreExport float FindSegmentPoint ( int  poly,
int  segment,
GraphicsWindow gw,
Material ma,
HitRegion hr,
int  ptype = PARAM_SIMPLE 
)
Remarks
This is used for hit testing. This method returns a value from 0.0 to 1.0 that tells you where a hit was found on a particular segment. Sample code that uses this is the edit spline modifier in /MAXSDK/SAMPLES/MODIFIERS/EDITSPL.H. This allows a refinement of the hit testing.
Parameters:
int poly

The index of the spline.

int segment

The index of the segment.

GraphicsWindow *gw

The graphics window where the hit test was done.

Material *ma

The list of materials.

HitRegion *hr

The hit region. See Class HitRegion.

int ptype = PARAM_SIMPLE

This parameter is available in release 4.0 and later only.

This allows the caller to get the location on the segment in either parameter space or normalized distance space. Both return values of 0-1. For proper backward compatibility, the default parameter type is PARAM_SIMPLE. The other option is PARAM_NORMALIZED.
CoreExport void Reverse ( int  poly,
BOOL  keepZero = FALSE 
)
Remarks
Reverses the spline whose index is passed.
Parameters:
int poly

The spline to reverse.

BOOL keepZero = FALSE

This optional parameter is available in release 2.0 and later only.

This parameter defaults to FALSE in order to retain backwards compatibility. Setting it to TRUE insures that a closed spline will have the same vertex as its first point when it is reversed. The parameter is ignored on open splines.
CoreExport void Reverse ( BitArray reverse,
BOOL  keepZero = FALSE 
)
Remarks
Reverses the splines of this shape if the corresponding bit in reverse is set.
Parameters:
BitArray &reverse

If the bit is set the spline is reversed; otherwise it is left alone.

BOOL keepZero = FALSE

This optional parameter is available in release 2.0 and later only.

This parameter defaults to FALSE in order to retain backwards compatibility. Setting it to TRUE insures that a closed spline will have the same vertex as its first point when it is reversed. The parameter is ignored on open splines.
CoreExport ShapeHierarchy& OrganizeCurves ( TimeValue  t,
ShapeHierarchy hier = NULL 
)
Remarks
This methods looks at the shape organization, and puts together a shape hierarchy. This provides information on how the shapes are nested. For example on a donut object with two circles, this method determines which circle is inside the other one.
Parameters:
TimeValue t

This parameter is not used.

ShapeHierarchy *hier = NULL

If non-NULL the result is store here (in addition to being returned). See Class ShapeHierarchy.
Returns
The result is returned here.
CoreExport void MakePolyShape ( PolyShape pshp,
int  nSteps = -1,
BOOL  doOptimize = FALSE 
)
Remarks
Makes a PolyShape from this shape.
Parameters:
PolyShape &pshp

The results are stored here.

int nSteps = -1

The number of steps between knots in the spline.

BOOL doOptimize = FALSE

If TRUE, linear segments between control points in the spline will not generate steps in between. It will just be one line segment.
CoreExport void MakeFirst ( int  poly,
int  vertex 
)
Remarks
Sets the specified vertex of the specified poly as the first vertex. On an open polygon this has to be one of the end control points. On a closed shape it doesn't matter.
Parameters:
int poly

The poly to update.

int vertex

The vertex to make first.
CoreExport void Transform ( Matrix3 tm)
Remarks
Transforms the points of each poly in the shape by the matrix passed.
Parameters:
Matrix3 &tm

The transformation matrix.
CoreExport BezierShape& operator+= ( BezierShape from)
Remarks
This lets you add another shape to this one.
CoreExport void AddAndWeld ( BezierShape from,
float  weldThreshold 
)
Remarks
This method is used for adding the splines from one BezierShape to another, with a weld threshold that will weld endpoints of the new splines onto endpoints of existing splines. Calling this method will cause the splines of the "from" shape to be added to those of the shape. If any endpoints in the "from" shape are within the specified weld threshold, they will be automatically welded.
Parameters:
BezierShape &from

The shape whose splines are added.

float weldThreshold

The endpoint weld threshold.
CoreExport void ReadyCachedPolyShape ( )
Remarks
This method is used internally.
CoreExport int MakeCap ( TimeValue  t,
MeshCapInfo capInfo,
int  capType 
)
Remarks
This method is passed a capping information structure and it will compute the information it needs to make a mesh cap for this shape.
Parameters:
TimeValue t

This parameter is not used.

MeshCapInfo &capInfo

The capping information. See Class MeshCapInfo.

int capType

See Shape Capping Types.
Returns
Nonzero if the method succeeded; otherwise zero.
CoreExport int MakeCap ( TimeValue  t,
PatchCapInfo capInfo 
)
Remarks
This method is passed a capping information structure and it will compute the information it needs to make a patch cap for this shape.
Parameters:
TimeValue t

This parameter is not used.

PatchCapInfo &capInfo

The capping information. See Class PatchCapInfo.
Returns
Nonzero if the method succeeded; otherwise zero.
CoreExport int ReadyPatchCap ( )
Remarks
This method is used internally by the BezierShape code. When you call BezierShape::MakeCap(TimeValue t, PatchCapInfo &capInfo), if the patch cap data isn't cached, this method is called to build it. Calling it is not normally necessary, or a good idea – it builds the PatchCapInfo data structure regardless of whether it's cached or not. Just call the MakeCap() method to get the cap information and the caching is done automatically.
CoreExport void CopyShapeDataFrom ( BezierShape fromShape)
Remarks
This method copies the shapes, selection sets and any caches from the source object. It does not copy selection level, or display information.
Parameters:
BezierShape &fromShape

The shape to copy from.
CoreExport void PrepVertBaseIndex ( )
Remarks
This method is used internally.
CoreExport int GetVertIndex ( int  poly,
int  vert 
)
Remarks
This method provides an easy way to derive a simple index for any vertex in any spline in the shape.
Parameters:
int poly

The zero based index of the spline.

int vert

The zero based index of the vertex.
Returns
A zero based index for vertex.
CoreExport void GetPolyAndVert ( int  index,
int polyOut,
int vertOut 
)
Remarks
This method takes a vertex index and turns it back into a poly / vertex pair (see GetVertIndex() above).
Parameters:
int index

The input index.

int &polyOut

The output poly.

int &vertOut

The output vertex.
CoreExport int GetTotalVerts ( )
Remarks
Returns the total number of vertices in the shape.
CoreExport Point3 GetVert ( int  index)
CoreExport void SetVert ( int  index,
const Point3 xyz 
)
CoreExport void PrepKnotBaseIndex ( )
Remarks
This method is used internally, automatically.
CoreExport int GetKnotIndex ( int  poly,
int  knot 
)
Remarks
This method returns an index for any knot in any spline in the shape.
Parameters:
int poly

The input poly number.

int knot

The input know number.
Returns
The zero based index of the knot.
CoreExport void GetPolyAndKnot ( int  index,
int polyOut,
int knotOut 
)
Remarks
This method computes a poly / knot pair from an index (see GetKnotIndex() above).
Parameters:
int index

The input knot index.

int &polyOut

The output index of the poly it is a part of.

int &knotOut

The output knot number.
CoreExport int GetTotalKnots ( )
Remarks
Returns the total number of knots in the shape.
CoreExport BOOL DeleteSelVerts ( int  poly)
Remarks
Deletes the selected vertices for the specified poly in the shape.
Parameters:
int poly

The zero based index of the polygon.
Returns
TRUE if any were deleted; FALSE if none were deleted.
CoreExport BOOL DeleteSelSegs ( int  poly)
Remarks
Deletes the selected polygons for the specified poly in the shape.
Parameters:
int poly

The zero based index of the polygon.
Returns
TRUE if any were deleted; FALSE if none were deleted.
CoreExport BOOL DeleteSelectedVerts ( )
Remarks
Deletes the selected vertices for all polys in the shape.
Returns
TRUE if any were deleted; FALSE if none were deleted.
CoreExport BOOL DeleteSelectedSegs ( )
Remarks
Deletes the selected segments for all polys in the shape.
Returns
TRUE if any were deleted; FALSE if none were deleted.
CoreExport BOOL DeleteSelectedPolys ( )
Remarks
Deletes the selected polygons for all polys in the shape.
Returns
TRUE if any were deleted; FALSE if none were deleted.
CoreExport BOOL CloneSelectedParts ( BOOL  reverse = FALSE)
Remarks
Copies the selected geometry (segments or polys), reversing if needed.
Parameters:
BOOL reverse=FALSE

TRUE to reverse; FALSE to leave alone.
Returns
Returns TRUE if anything was copied.
CoreExport BOOL RecordTopologyTags ( int  channel = 0)
Remarks
Tags the points in the spline components to record the topology of the shape. (This stores identifying values in the Spline3D's Knot::aux fields for each control point). This info can be used after topology-changing operations to remap information tied to control points.
Parameters:
int channel=0

This parameter is available in release 3.0 and later only.

Specifies which auxiliary channel. One of the following values:

0=aux2

1=aux3
Returns
Returns FALSE if > 32767 knots or polys (it can't record that many).
CoreExport Point3 InterpCurve3D ( int  poly,
float  param,
int  ptype = PARAM_SIMPLE 
)
Remarks
This method returns a point interpolated on the specified spline on the entire curve. This method returns the point but you don't know which segment the point falls on. See method InterpPiece3D().
Parameters:
int poly

The zero based index of the spline.

float param

The position along the curve to return where 0 is the start and 1 is the end.

int ptype=PARAM_SIMPLE

The parameter type for spline interpolation. See Parameter types for shape interpolation.
Returns
The interpolated point on the curve.
CoreExport Point3 TangentCurve3D ( int  poly,
float  param,
int  ptype = PARAM_SIMPLE 
)
Remarks
This method returns a tangent vector interpolated on the entire curve of the specified spline. Also see method TangentPiece3D().
Parameters:
int poly

The zero based index of the spline.

float param

The position along the curve to return where 0 is the start and 1 is the end.

int ptype=PARAM_SIMPLE

The parameter type for spline interpolation. See Parameter types for shape interpolation.
Returns
The tangent vector
CoreExport Point3 InterpPiece3D ( int  poly,
int  piece,
float  param,
int  ptype = PARAM_SIMPLE 
)
Remarks
This method returns the interpolated point along the specified sub-curve (segment) for the specified spline. For example consider a shape that is a single circle with four knots. If you called this method with curve=0 and piece=0 and param=0.0 you'd get back the point at knot 0. If you passed the same parameters except param=1.0 you'd get back the point at knot 1.
Parameters:
int poly

The zero based index of the spline.

int piece

The sub-curve (segment) to evaluate.

float param

The position along the curve to return where 0 is the start and 1 is the end.

int ptype=PARAM_SIMPLE

The parameter type for spline interpolation. See Parameter types for shape interpolation.
Returns
The point in world space.
CoreExport Point3 TangentPiece3D ( int  poly,
int  piece,
float  param,
int  ptype = PARAM_SIMPLE 
)
Remarks
Returns the tangent vector of the specified spline on a sub-curve at the specified 'distance' along the curve.
Parameters:
int poly

The zero based index of the spline.

int piece

The sub-curve (segment) to evaluate.

float param

The position along the curve to return where 0 is the start and 1 is the end.

int ptype=PARAM_SIMPLE

The parameter type for spline interpolation. See Parameter types for shape interpolation.
CoreExport MtlID GetMatID ( int  poly,
int  piece 
)
Remarks
This method is available in release 3.0 and later only.

Returns the material ID for the specified spline and segment of this shape.
Parameters:
int poly

The zero based index of the spline.

int piece

The zero based index of the segment of the spline.
CoreExport float LengthOfCurve ( int  poly)
Remarks
Returns the length of the specified spline.
Parameters:
int poly

The index of the spline to check.
CoreExport void GetTopology ( BezierShapeTopology topo)
Remarks
This method is available in release 3.0 and later only.

Retrieves information on the shape topology.
Parameters:
BezierShapeTopology &topo

The object which is updated with the shape data. See Class BezierShapeTopology.
CoreExport BOOL PerformTrimOrExtend ( IObjParam ip,
ViewExp vpt,
ShapeHitData hit,
IPoint2 m,
ShapeContextCallback cb,
int  trimType,
int  trimInfinite 
)
Remarks
This method is available in release 3.0 and later only.

This method provides a way for a BezierShape to trim and extend splines. This method is meant to perform as part of a mouse-centered operation – Click on the part of the spline and pass the hitrecord, viewport and mouse point to the trim function.
Parameters:
IObjParam *ip

The interface pointer. See Class Interface.

ViewExp *vpt

The viewport the user clicked in. See Class ViewExp.

ShapeHitData *hit

The hit record for the selection. See Class ShapeHitData.

IPoint2 &m

The point the user clicked on in the viewport. See Class IPoint2.

ShapeContextCallback &cb

The callback object. See Class ShapeContextCallback.

int trimType

Specifies if the operation is a Trim or an Extend. One of the following values:

SHAPE_TRIM

SHAPE_EXTEND

int trimInfinite

This is set to TRUE for infinite projections.
Returns
This returns TRUE if the trim or extend was performed.
CoreExport BOOL SelVertsSameType ( )
CoreExport BOOL SelSegsSameType ( )
CoreExport BOOL SelSplinesSameType ( )
CoreExport void BindKnot ( BOOL  isEnd,
int  segIndex,
int  splineSegID,
int  splinePointID 
)
Remarks
This method is available in release 3.0 and later only.

This method binds a knot to a segment. A bind acts as a constraint, it constrains the first point or the end point of a spline to the mid point of a segment.
Parameters:
BOOL isEnd

Specifies whether the first or last point is bound. TRUE for the end; FALSE for the start.

int segIndex

The index of the segment to be bound to.

int splineSegID

The index of the spline that contains the segment.

int splinePointID

The index of spline that is being bound.
CoreExport BOOL UnbindKnot ( int  splineID,
BOOL  isEnd 
)
Remarks
This method unbinds the specified spline.
Parameters:
int splineID

The index of spline that is being bound.

BOOL isEnd

Specifies whether the first or last point is unbound. TRUE for the end; FALSE for the start.
CoreExport void UpdateBindList ( BOOL  useGeometricTracking = FALSE)
Remarks
This method is available in release 3.0 and later only.

This method needs to be called when the topology changes to update the bind list.
Parameters:
BOOL useGeomTracking=FALSE

This parameter is available in release 4.0 and later only.

This allows the update to be dependant on previous recorded topology or geometry. If this flag is set to TRUE it uses the old method of using the geometry to rebuild the binds, else it uses the new method which uses the aux flags of the splines which store the old topology indices. Normally this will be FALSE since most of the times the topology tracking is more accurate, it should be set to TRUE when there is no initial topology to work from for instance when attaching or detaching geometry.
CoreExport BOOL HideSelectedSegs ( )
Remarks
Hides the selected segments.
Returns
TRUE if any were hidden. FALSE if none were hidden.
CoreExport BOOL HideSelectedVerts ( )
Remarks
Hides the segments attached to the selected vertices.
Returns
TRUE if any were hidden. FALSE if none were hidden.
CoreExport BOOL HideSelectedSplines ( )
Remarks
Hides the segments attached to the selected splines.
Returns
TRUE if any were hidden. FALSE if none were hidden.
CoreExport BOOL UnhideSegs ( )
Remarks
Unhides all the segments in the shape.
Returns
TRUE if any were unhidden. FALSE if none were unhidden.
CoreExport int UnselectHiddenVerts ( )
CoreExport int UnselectHiddenSegs ( )
CoreExport int UnselectHiddenSplines ( )
CoreExport void SetVertexWeightCount ( int  i)
CoreExport void SetVertexWeight ( int  i,
float  w 
)
inline
1132 { assert( mpVertexWeights ); if ( i >= numVertexWeights ) return; mpVertexWeights[i] = w; }
int numVertexWeights
Definition: shape.h:1126
float * mpVertexWeights
Definition: shape.h:1125
#define assert(expr)
Definition: assert1.h:71
CoreExport float VertexWeight ( int  i)
inline
1133 { if ( !mpVertexWeights ) return 0.0f; if ( i >= numVertexWeights ) return 0.0f; return mpVertexWeights[i]; }
int numVertexWeights
Definition: shape.h:1126
float * mpVertexWeights
Definition: shape.h:1125
CoreExport bool VertexWeightSupport ( )
inline
1134 { if ( mpVertexWeights ) return true; return false; }
float * mpVertexWeights
Definition: shape.h:1125
CoreExport float* GetVSelectionWeights ( )
inline
1135 { return mpVertexWeights; }
float * mpVertexWeights
Definition: shape.h:1125
CoreExport void SupportVSelectionWeights ( )
CoreExport int UseEdgeDists ( )
CoreExport void SetUseEdgeDists ( int  edgeDist)
CoreExport int EdgeDist ( )
CoreExport void SetEdgeDist ( int  edgeDist)
CoreExport int UseSoftSelections ( )
CoreExport void SetUseSoftSelections ( int  useSoftSelections)
CoreExport int AffectBackface ( )
CoreExport void SetAffectBackface ( int  affectBackface)
CoreExport float Falloff ( )
CoreExport void SetFalloff ( float  falloff)
CoreExport float Pinch ( )
CoreExport void SetPinch ( float  pinch)
CoreExport float Bubble ( )
CoreExport void SetBubble ( float  bubble)
CoreExport void InvalidateVertexWeights ( )
CoreExport void UpdateVertexDists ( )
CoreExport void UpdateEdgeDists ( )
CoreExport void UpdateVertexWeights ( )
CoreExport bool DeleteSplines ( const unsigned int indices,
unsigned int  n 
)

Delete multiple splines at once.

Deleting multiple splines at once is faster than deleting one by one by calling DeleteSpline(), because the internal bookkeeping only needs to be done once.

Parameters
[in]indicesPoint to an array of indices to delete. Indices should be unique, and sorted in ascending order.
[in]nNumber of entries in the indices array.
Returns
false if any of the vertex indices are invalid.

Friends And Related Function Documentation

friend class BezierShapeLeakDetector
friend
INT_PTR CALLBACK SplineSelectDlgProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)
friend

Member Data Documentation

List of bind points.

PatchCapInfo patchCap

Patch capping cache (mesh capping and hierarchy caches stored in PolyShape cache).

BOOL patchCapCacheValid

Indicates if the patch cap is valid or not.

Spline3D** splines

A pointer to the list of splines.

int splineCount

The number of splines in this shape.

int steps

Number of steps (a value of -1 will use adaptive).

BOOL optimize

Setting this to TRUE optimizes linear segments.

ShapeVSel vertSel

The selected vertices.

ShapeSSel segSel

The selected segments.

ShapePSel polySel

The selected polygons.

int bezVecPoly

If hit bezier vector, this is its info.

This is used internally in hit testing.

int bezVecVert

This is used internally in hit testing.

DWORD selLevel

The Selection level.

DWORD dispFlags

Display attribute flags.

They can be one of the following:

  • SHAPE_OBJECT - Object level selection.
  • SHAPE_SPLINE - Spline level selection (a single polygon within the shape).
  • SHAPE_SEGMENT - Segment level selection.
  • SHAPE_VERTEX - Vertex level selection.
    See also
    Display Flags
float* mpVertexWeights
int numVertexWeights
int* mpVertexEdgeDists
float* mpVertexDists
float mFalloff
float mPinch
float mBubble
int mEdgeDist
int mUseEdgeDist
int mAffectBackface
int mUseSoftSelections