This reference page is linked to from the following overview topics: Object Plug-ins, Porting Object Plug-ins to Nitrous, General Best Practices, Plug-in Base Classes, Calling CopyBaseData(), Creating Primitive NURBS Objects, Mental Ray Classes, Translation of Object Plug-ins.
ShapeObjects are open or closed hierarchical shapes made up of one or more pieces.
This base class defines a set of methods that plug-in shapes must implement. Note: Many plug-in shapes may be derived from Class SimpleSpline rather than this class and have fewer methods to implement. See that class for more details. Any classes subclassing off of ShapeObject should be sure to call the ShapeObject constructor in their constructor, in order to properly initialize the fields contained in the ShapeObject. This is the thickness field, which specifies the thickness of the mesh generated from the shape at rendering time. For example:
LinearShape::LinearShape() : ShapeObject() { ... }
Also, the ShapeObject contains Load and Save methods, which handle the storage of the data contained within the ShapeObject. In order to properly store this information, classes which subclass off of ShapeObject need to call the ShapeObject Load and Save methods before storing their information. For example:
IOResult LinearShape::Save(ISave *isave) { IOResult res = ShapeObject::Save(isave); if(res != IO_OK) return res; ... } IOResult LinearShape::Load(ILoad *iload) { IOResult res = ShapeObject::Load(iload); if(res != IO_OK) return res; ... }
The number of ShapeObject references/subanims are defined as SHAPE_OBJ_NUM_REFS and SHAPE_OBJ_NUM_SUBS in /include/object.h and are set to the number of references and subanims in the ShapeObject class, you can use them to make your code more bullet-proof should the number of references change in the future. See maxsdk/include/splshape.h for an example of how they can be used.
#include <object.h>
Public Member Functions |
|
CoreExport | ShapeObject () |
CoreExport | ~ShapeObject () |
virtual CoreExport BaseInterface * | GetInterface (Interface_ID iid) |
Inherited from Animatable. |
|
virtual CoreExport void * | GetInterface (ULONG id) |
Inherited from Animatable. |
|
virtual CoreExport bool | RequiresSupportForLegacyDisplayMode () const |
virtual CoreExport bool | UpdateDisplay (unsigned long renderItemCategories, const MaxSDK::Graphics::MaterialRequiredStreams &materialRequiredStreams, TimeValue t) |
virtual BOOL | IsShapeObject () |
virtual int | IntersectRay (TimeValue t, Ray &ray, float &at, Point3 &norm) |
Computes the intersection point of the ray
passed and the shape. |
|
virtual void | InitNodeName (MSTR &s) |
This is the default name of the node when it
is created. |
|
SClass_ID | SuperClassID () |
Retrieves a constant representing the type
of the plugin. |
|
virtual CoreExport int | IsRenderable () |
Indicates whether the object may be
rendered. |
|
virtual CoreExport void | CopyBaseData (ShapeObject &from) |
In order to simplify things for subclasses
of
ShapeObject, this method is now available. |
|
CoreExport float | GetThickness (TimeValue t, Interval &ivalid) |
Implemented by the System. |
|
CoreExport int | GetSides (TimeValue t, Interval &ivalid) |
This method returns the number of sides for
the cross-section of the rendering mesh version of the shape for
the specified time. |
|
CoreExport float | GetAngle (TimeValue t, Interval &ivalid) |
This method returns the angle that the
cross-section of the rendering mesh will be rotated to, for the
specified time. |
|
CoreExport float | GetViewportThickness () |
This method returns the thickness of the
viewport version of the rendering mesh. |
|
CoreExport int | GetViewportSides () |
This method returns the number of sides for
the cross-section for the viewport version of the rendering mesh.
|
|
CoreExport float | GetViewportAngle () |
This method returns the angle that the
cross-section of the viewport version of the rendering mesh will be
rotated to. |
|
CoreExport BOOL | GetRenderable () |
Implemented by the System. |
|
CoreExport BOOL | GetGenUVs () |
Implemented by the System. |
|
CoreExport BOOL | GetDispRenderMesh () |
This method returns TRUE if the "Display
Render Mesh" switch is on. |
|
CoreExport BOOL | GetUseViewport () |
This method returns TRUE if the "Use
Viewport Settings" switch is on. |
|
CoreExport BOOL | GetViewportOrRenderer () |
This method returns the value of the
Viewport/Render switch and either returns GENMESH_VIEWPORT or
GENMESH_RENDER. |
|
CoreExport void | SetThickness (TimeValue t, float thick) |
Implemented by the System. |
|
CoreExport void | SetSides (TimeValue t, int s) |
This method allows you to set the number of
sides for the rendering mesh version of the shape for the specified
time. |
|
CoreExport void | SetAngle (TimeValue t, float a) |
This method allows you to set the
cross-section rotation angle for the rendering mesh version of the
shape, in degrees, for the specified time. |
|
CoreExport void | SetViewportThickness (float thick) |
CoreExport void | SetViewportSides (int s) |
This method allows you to set the number of
sides for the viewport version of the rendering mesh. |
|
CoreExport void | SetViewportAngle (float a) |
This method allows you to set the angle that
the cross-section of the viewport version of the rendering mesh
will be rotated to, in degrees. |
|
CoreExport void | SetRenderable (BOOL sw) |
Implemented by the System. |
|
CoreExport void | SetGenUVs (BOOL sw) |
Implemented by the System. |
|
CoreExport void | SetDispRenderMesh (BOOL sw) |
This method allows you to turn the "Display
Render Mesh" switch on or off. |
|
CoreExport void | SetUseViewport (BOOL sw) |
This method allows you to turn the "Use
Viewport Settings" switch on or off. |
|
CoreExport void | SetViewportOrRenderer (BOOL sw) |
This method allows you to set the value of
the Viewport/Render switch. |
|
virtual CoreExport Mesh * | GetRenderMesh (TimeValue t, INode *inode, View &view, BOOL &needDelete) |
This method should be implemented by all
renderable GeomObjects. |
|
virtual CoreExport void | GetRenderMeshInfo (TimeValue t, INode *inode, View &view, int &nverts, int &nfaces) |
Returns information on the rendering mesh.
|
|
virtual CoreExport void | GenerateMesh (TimeValue t, int option, Mesh *mesh) |
This method will generate a mesh based on
either the viewport or rendering parameters for the specified time.
|
|
virtual int | NumberOfVertices (TimeValue t, int curve=-1) |
This method is used by the Summary Info and
Object
Properties dialogs to inform the user how many vertices or CVs are
in the object. |
|
virtual int | NumberOfCurves ()=0 |
Returns the number of polygons in the shape.
|
|
virtual BOOL | CurveClosed (TimeValue t, int curve)=0 |
This method is called to determine if the
specified curve of the shape is closed at the time passed. |
|
virtual Point3 | InterpCurve3D (TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE)=0 |
This method returns a point interpolated on
the entire curve. |
|
virtual Point3 | TangentCurve3D (TimeValue t, int curve, float param, int ptype=PARAM_SIMPLE)=0 |
This method returns a tangent vector
interpolated on the entire curve. |
|
virtual float | LengthOfCurve (TimeValue t, int curve)=0 |
Returns the length of the specified curve.
|
|
virtual int | NumberOfPieces (TimeValue t, int curve)=0 |
Returns the number of sub-curves in a curve.
|
|
virtual Point3 | InterpPiece3D (TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE)=0 |
This method returns the interpolated point
along the specified sub-curve (segment). |
|
virtual Point3 | TangentPiece3D (TimeValue t, int curve, int piece, float param, int ptype=PARAM_SIMPLE)=0 |
Returns the tangent vector on a sub-curve at
the specified 'distance' along the curve. |
|
virtual MtlID | GetMatID (TimeValue t, int curve, int piece) |
This method provides access to the material
IDs of the shape. |
|
virtual BOOL | CanMakeBezier () |
This method is called to determine if the
shape can be converted to a bezier representation. |
|
virtual void | MakeBezier (TimeValue t, BezierShape &shape) |
Creates the bezier representation of the
shape. |
|
virtual ShapeHierarchy & | OrganizeCurves (TimeValue t, ShapeHierarchy *hier=NULL)=0 |
This method is called to prepare the shape
for lofting, extrusion, etc. |
|
virtual void | MakePolyShape (TimeValue t, PolyShape &shape, int steps=PSHAPE_BUILTIN_STEPS, BOOL optimize=FALSE)=0 |
Create a PolyShape representation with
optional fixed steps. |
|
virtual int | MakeCap (TimeValue t, MeshCapInfo &capInfo, int capType)=0 |
This method generates a mesh capping info
for the shape. |
|
virtual int | MakeCap (TimeValue t, PatchCapInfo &capInfo) |
This method creates a patch cap info out of
the shape. |
|
virtual BOOL | AttachShape (TimeValue t, INode *thisNode, INode *attachNode, BOOL weldEnds=FALSE, float weldThreshold=0.0f) |
This method is called to attach the shape of
attachNode to thisNode at the specified time. |
|
virtual BOOL | HasUVW () |
It is called to find out if the object is
has UVW coordinates. |
|
virtual BOOL | HasUVW (int mapChannel) |
It is called to find out if the object is
has UVW coordinates for the specified mapping channel. |
|
virtual void | SetGenUVW (BOOL sw) |
This method is called to change the state of
its Generate UVW boolean. |
|
virtual void | SetGenUVW (int mapChannel, BOOL sw) |
This method is called to change the state of
its Generate UVW boolean for the specified mapping channel.
|
|
virtual CoreExport IOResult | Save (ISave *isave) |
Implemented by the System. |
|
virtual CoreExport IOResult | Load (ILoad *iload) |
Implemented by the System. |
|
virtual CoreExport Class_ID | PreferredCollapseType () |
Implemented by the System. |
|
virtual CoreExport BOOL | GetExtendedProperties (TimeValue t, MSTR &prop1Label, MSTR &prop1Data, MSTR &prop2Label, MSTR &prop2Data) |
Implemented by the System. |
|
virtual CoreExport void | RescaleWorldUnits (float f) |
Implemented by the System. |
|
virtual CoreExport RefResult | NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message) |
This method will notify the Shape Object of
changes in values in its parameter block. |
|
virtual CoreExport RefTargetHandle | GetReference (int i) |
This method allows the
ShapeObject to return a pointer to its parameter block.
|
|
virtual CoreExport Animatable * | SubAnim (int i) |
This method returns the ShapeObject's
animatable pointer. |
|
virtual CoreExport MSTR | SubAnimName (int i) |
This method returns the name of the
animatable's name. |
|
CoreExport ParamDimension * | GetParameterDim (int pbIndex) |
This method returns the parameter dimension
of the parameter whose index is passed. |
|
CoreExport MSTR | GetParameterName (int pbIndex) |
This method returns the name of the
parameter whose index is passed. |
|
virtual CoreExport int | RemapRefOnLoad (int iref) |
This method remaps references at load time
so that files saved from previous versions of 3ds Max get their
references adjusted properly to allow for the new
ShapeObject reference. |
|
virtual int | NumRefs () |
The
ShapeObject makes 1 reference; this is where it tells the
system. |
|
virtual int | NumSubs () |
CoreExport void | BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev) |
This method allows the
ShapeObject to create its new "Rendering" rollup. |
|
CoreExport void | EndEditParams (IObjParam *ip, ULONG flags, Animatable *next) |
Similarly to BeginEditParams, this method
allows the
ShapeObject to remove its "Rendering" rollup. |
|
CoreExport Interval | GetShapeObjValidity (TimeValue t) |
This method gets the validity interval for
the ShapeObject's internal parameters only. |
|
CoreExport int | Display (TimeValue t, INode *inode, ViewExp *vpt, int flags) |
This method displays the shape's generated
mesh if necessary. |
|
virtual CoreExport Box3 | GetBoundingBox (TimeValue t, Matrix3 *tm=NULL) |
This method returns a bounding box for the
shape, if it's active, if the "Display Render Mesh" switch is on.
|
|
virtual CoreExport void | InvalidateGeomCache () |
This method is very important - It causes
the
ShapeObject to flush its cached rendering mesh. |
|
int | SetProperty (ULONG id, void *data) |
Associates data passed in to given id.
|
|
void * | GetProperty (ULONG id) |
Retrieves data associated with id. |
|
CoreExport BOOL | GetUsePhysicalScaleUVs () |
Queries whether if real world texture size
is used or not. |
|
CoreExport void | SetUsePhysicalScaleUVs (BOOL flag) |
Sets whether real world texture size is used
or not. |
|
Protected Member Functions |
|
virtual CoreExport void | SetReference (int i, RefTargetHandle rtarg) |
This method sets the ShapeObject's parameter
block pointer. |
|
Friends |
|
class | SObjRenderingDlgProc |
class | ShapePostLoadCallback |
class | IShapeRectRenderParams |
CoreExport ShapeObject | ( | ) |
CoreExport ~ShapeObject | ( | ) |
virtual CoreExport BaseInterface* GetInterface | ( | Interface_ID | id | ) | [virtual] |
Inherited from Animatable.
Returns a pointer to the Base Interface for the interface ID passed.
id | - The unique ID of the interface to get |
Reimplemented from Object.
Reimplemented in MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
virtual CoreExport void* GetInterface | ( | ULONG | id | ) | [virtual] |
Inherited from Animatable.
Returns a pointer to the interface.
id | - The id of the interface. |
Reimplemented from Object.
Reimplemented in SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
virtual CoreExport bool RequiresSupportForLegacyDisplayMode | ( | ) | const [virtual] |
Reimplemented from BaseObject.
virtual CoreExport bool UpdateDisplay | ( | unsigned long | renderItemCategories, |
const MaxSDK::Graphics::MaterialRequiredStreams & | materialRequiredStreams, | ||
TimeValue | t | ||
) | [virtual] |
Reimplemented from BaseObject.
virtual BOOL IsShapeObject | ( | ) | [inline, virtual] |
Computes the intersection point of the ray passed and the shape.
t | The time to compute the intersection. |
ray | Ray to intersect. |
at | The point of intersection. |
norm | The surface normal at the point of intersection. |
Reimplemented from Object.
Reimplemented in MSPluginShape, MSShapeXtnd, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{return FALSE;}
virtual void InitNodeName | ( | MSTR & | s | ) | [inline, virtual] |
This is the default name of the node when it is created.
s | The default name of the node is stored here. |
Reimplemented from GeomObject.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginShape, MSShapeXtnd, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{ s = _M("Shape"); }
SClass_ID SuperClassID | ( | ) | [inline, virtual] |
Retrieves a constant representing the type of the plugin.
Reimplemented from GeomObject.
Reimplemented in MSPluginShape, and MSShapeXtnd.
{ return SHAPE_CLASS_ID; }
virtual CoreExport int IsRenderable | ( | ) | [virtual] |
Indicates whether the object may be rendered.
Some objects such as construction grids and helpers should not be rendered and can return zero.
Reimplemented from GeomObject.
Reimplemented in MSPluginShape, and MSShapeXtnd.
virtual CoreExport void CopyBaseData | ( | ShapeObject & | from | ) | [virtual] |
In order to simplify things for subclasses of ShapeObject, this method is now available.
It should be called whenever the ShapeObject-based object is copied. It takes care of copying all the data to the ShapeObject from another ShapeObject-based object Implemented by the System.
from | The ShapeObject to copy from. |
CoreExport float GetThickness | ( | TimeValue | t, |
Interval & | ivalid | ||
) |
Implemented by the System.
Returns the shape's thickness setting.
t | The time to obtain the thickness. |
ivalid | The validity interval. |
CoreExport int GetSides | ( | TimeValue | t, |
Interval & | ivalid | ||
) |
This method returns the number of sides for the cross-section of the rendering mesh version of the shape for the specified time.
t | The time to obtain the thickness. |
ivalid | The validity interval. |
CoreExport float GetAngle | ( | TimeValue | t, |
Interval & | ivalid | ||
) |
This method returns the angle that the cross-section of the rendering mesh will be rotated to, for the specified time.
t | The time to obtain the thickness. |
ivalid | The validity interval. |
CoreExport float GetViewportThickness | ( | ) |
This method returns the thickness of the viewport version of the rendering mesh.
This is not an animated parameter.
CoreExport int GetViewportSides | ( | ) |
This method returns the number of sides for the cross-section for the viewport version of the rendering mesh.
This is not an animated parameter.
CoreExport float GetViewportAngle | ( | ) |
This method returns the angle that the cross-section of the viewport version of the rendering mesh will be rotated to.
This is not an animated parameter.
CoreExport BOOL GetRenderable | ( | ) |
Implemented by the System.
The ShapeObject class now has a "renderable" flag contained within it. Access to this is via this method and SetRenderable(). If this is set to TRUE and the node is set to renderable, the spline will be rendered. This defaults to FALSE.
CoreExport BOOL GetGenUVs | ( | ) |
Implemented by the System.
Returns TRUE if the generate UVs switch is on; FALSE if off.
CoreExport BOOL GetDispRenderMesh | ( | ) |
This method returns TRUE if the "Display Render Mesh" switch is on.
FALSE when the switch is off.
CoreExport BOOL GetUseViewport | ( | ) |
This method returns TRUE if the "Use Viewport Settings" switch is on.
FALSE when the switch is off.
CoreExport BOOL GetViewportOrRenderer | ( | ) |
This method returns the value of the Viewport/Render switch and either returns GENMESH_VIEWPORT or GENMESH_RENDER.
CoreExport void SetThickness | ( | TimeValue | t, |
float | thick | ||
) |
Implemented by the System.
Sets the thickness setting of the shape to the specified value.
t | The time at which to set the thickness. |
thick | The new thickness setting for the shape. |
CoreExport void SetSides | ( | TimeValue | t, |
int | s | ||
) |
This method allows you to set the number of sides for the rendering mesh version of the shape for the specified time.
The allowable ranges for this parameter are 3-100.
t | The time at which to set the number of sides. |
s | The number of sides you wish to set. |
CoreExport void SetAngle | ( | TimeValue | t, |
float | a | ||
) |
This method allows you to set the cross-section rotation angle for the rendering mesh version of the shape, in degrees, for the specified time.
t | The time at which to set the angle. |
a | The angle you wish to set, in degrees. |
CoreExport void SetViewportThickness | ( | float | thick | ) |
CoreExport void SetViewportSides | ( | int | s | ) |
This method allows you to set the number of sides for the viewport version of the rendering mesh.
This is not an animated parameter.
s | The number of viewport sides you wish to set. |
CoreExport void SetViewportAngle | ( | float | a | ) |
This method allows you to set the angle that the cross-section of the viewport version of the rendering mesh will be rotated to, in degrees.
This is not an animated parameter.
a | The viewport angle you wish to set, in degrees. |
CoreExport void SetRenderable | ( | BOOL | sw | ) |
Implemented by the System.
Sets the rendering flag to the specified value.
sw | TRUE for on; FALSE for off. |
Reimplemented in SimpleShape.
CoreExport void SetGenUVs | ( | BOOL | sw | ) |
Implemented by the System.
Pass TRUE to set the generate UVs switch to on; FALSE to set it off.
sw | TRUE for on; FALSE for off. |
Reimplemented in SimpleShape.
CoreExport void SetDispRenderMesh | ( | BOOL | sw | ) |
This method allows you to turn the "Display Render Mesh" switch on or off.
sw | TRUE or FALSE to set or unset the "Display Render Mesh" switch. |
CoreExport void SetUseViewport | ( | BOOL | sw | ) |
This method allows you to turn the "Use Viewport Settings" switch on or off.
sw | TRUE or FALSE to set or unset the "Use Viewport Settings" switch. |
CoreExport void SetViewportOrRenderer | ( | BOOL | sw | ) |
This method allows you to set the value of the Viewport/Render switch.
sw | Set this parameter to GENMESH_VIEWPORT or GENMESH_RENDER. |
virtual CoreExport Mesh* GetRenderMesh | ( | TimeValue | t, |
INode * | inode, | ||
View & | view, | ||
BOOL & | needDelete | ||
) | [virtual] |
This method should be implemented by all renderable GeomObjects.
It provides a mesh representation of the object for use by the renderer. Primitives that already have a mesh cached can just return a pointer to it (and set needDelete to FALSE). Implementations of this method which take a long time should periodically call View::CheckForRenderAbort() to see if the user has canceled the render. If canceled, the function can either return NULL, or return a non null pointer with the appropriate value for needDelete. (If needDelete is TRUE a non-null mesh will be deleted.)
t | The time to get the mesh. |
inode | The node in the scene. |
view | If the renderer calls this method it will pass the view information here. See Class View. |
needDelete | Set to TRUE if the renderer should delete the mesh, FALSE otherwise. |
Reimplemented from GeomObject.
Reimplemented in MSPluginShape, and MSShapeXtnd.
virtual CoreExport void GetRenderMeshInfo | ( | TimeValue | t, |
INode * | inode, | ||
View & | view, | ||
int & | nverts, | ||
int & | nfaces | ||
) | [virtual] |
Returns information on the rendering mesh.
Implemented by the System.
t | The time to get the information. |
inode | The node associated with the mesh. |
view | Describes properties of the view associated with the render. See Class View. |
nverts | The number of vertices in the render mesh. |
nfaces | The number of faces in the render mesh. |
virtual CoreExport void GenerateMesh | ( | TimeValue | t, |
int | option, | ||
Mesh * | mesh | ||
) | [virtual] |
This method will generate a mesh based on either the viewport or rendering parameters for the specified time.
t | The time at which to generate the mesh. |
option | The option can be either GENMESH_VIEWPORT, GENMESH_RENDER, or GENMESH_DEFAULT. When using the default definition the mesh generator will use whatever is in the Viewport/Render switch in the parameter block. |
mesh | A pointer to a Mesh object. If this is set to NULL, the mesh will be generated and cached, but not returned. |
virtual int NumberOfVertices | ( | TimeValue | t, |
int | curve = -1 |
||
) | [inline, virtual] |
This method is used by the Summary Info and Object Properties dialogs to inform the user how many vertices or CVs are in the object.
The method is passed a TimeValue and a curve index; if the curve index is <0, the function should return the number of vertices/CVs in the entire shape. Otherwise, it should return the number of vertices/CVs in the specified curve.
t | The time at which the number of vertices is to be computed. |
curve | The curve index. See note above. |
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
{ return 0; } // Informational only, curve = -1: total in all curves
virtual int NumberOfCurves | ( | ) | [pure virtual] |
Returns the number of polygons in the shape.
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual BOOL CurveClosed | ( | TimeValue | t, |
int | curve | ||
) | [pure virtual] |
This method is called to determine if the specified curve of the shape is closed at the time passed.
t | The time to check. |
curve | The index of the curve to check. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual Point3 InterpCurve3D | ( | TimeValue | t, |
int | curve, | ||
float | param, | ||
int | ptype =
PARAM_SIMPLE |
||
) | [pure virtual] |
This method returns a point interpolated on the entire curve.
This method returns the point but you don't know which segment the point falls on. See method InterpPiece3D().
t | The time to evaluate. |
curve | The index of the curve to evaluate. |
param | The 'distance' along the curve where 0 is the start and 1 is the end. |
ptype | The parameter type for spline interpolation. See List of Parameter Types for Shape Interpolation. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual Point3 TangentCurve3D | ( | TimeValue | t, |
int | curve, | ||
float | param, | ||
int | ptype =
PARAM_SIMPLE |
||
) | [pure virtual] |
This method returns a tangent vector interpolated on the entire curve.
Also see method TangentPiece3D().
t | The time at which to evaluate the curve. |
curve | The index of the curve to evaluate. |
param | The 'distance' along the curve where 0.0 is the start and 1.0
is the end. int ptype=PARAM_SIMPLE The parameter type for spline interpolation. See List of Parameter Types for Shape Interpolation. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual float LengthOfCurve | ( | TimeValue | t, |
int | curve | ||
) | [pure virtual] |
Returns the length of the specified curve.
Note: This method makes no allowance for non-uniform scaling in the object transform. To do that, see the following code fragment (os is the ObjectState with the shape object and xfm is the NodeTM of the shape object node).
if (os.obj->SuperClassID() == SHAPE_CLASS_ID) { ShapeObject *sobj; sobj = (ShapeObject *) os.obj; int cct = sobj->NumberOfCurves(); PolyShape workShape; sobj->MakePolyShape(ip->GetTime(), workShape); workShape.Transform(xfm); float len = 0.0f; for (int i=0; i<cct; i++) len += workShape.lines[i].CurveLength(); }
t | The time at which to compute the length. |
curve | The index of the curve. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual int NumberOfPieces | ( | TimeValue | t, |
int | curve | ||
) | [pure virtual] |
Returns the number of sub-curves in a curve.
t | The time at which to check. |
curve | The index of the curve. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual Point3 InterpPiece3D | ( | TimeValue | t, |
int | curve, | ||
int | piece, | ||
float | param, | ||
int | ptype =
PARAM_SIMPLE |
||
) | [pure virtual] |
This method returns the interpolated point along the specified sub-curve (segment).
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.
t | The time to evaluate the sub-curve. |
curve | The curve to evaluate. |
piece | The segment to evaluate. |
param | The position along the curve to return where 0.0 is the start and 1.0 is the end. |
ptype | The parameter type for spline interpolation. See List of Parameter Types for Shape Interpolation. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual Point3 TangentPiece3D | ( | TimeValue | t, |
int | curve, | ||
int | piece, | ||
float | param, | ||
int | ptype =
PARAM_SIMPLE |
||
) | [pure virtual] |
Returns the tangent vector on a sub-curve at the specified 'distance' along the curve.
t | The time to evaluate the sub-curve. |
curve | The curve to evaluate. |
piece | The sub-curve (segment) to evaluate. |
param | The position along the curve to return where 0 is the start and 1 is the end. |
ptype | The parameter type for spline interpolation. See List of Parameter Types for Shape Interpolation. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual MtlID GetMatID | ( | TimeValue | t, |
int | curve, | ||
int | piece | ||
) | [inline, virtual] |
This method provides access to the material IDs of the shape.
It returns the material ID of the specified segment of the specified curve of this shape at the time passed. There is a default implementation so there is no need to implement this method if the shape does not support material IDs. Note: typedef unsigned short MtlID;
t | The time to evaluate the sub-curve. |
curve | The zero based index of the curve to evaluate. |
piece | The sub-curve (segment) to evaluate. |
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
{ return 0; }
virtual BOOL CanMakeBezier | ( | ) | [inline, virtual] |
This method is called to determine if the shape can be converted to a bezier representation.
Reimplemented in LinearShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
{ return FALSE; } // Return TRUE if can turn into a bezier representation
virtual void MakeBezier | ( | TimeValue | t, |
BezierShape & | shape | ||
) | [inline, virtual] |
Creates the bezier representation of the shape.
t | The time to convert. |
shape | The bezier representation is stored here. |
Reimplemented in LinearShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
{} // Create the bezier representation
virtual ShapeHierarchy& OrganizeCurves | ( | TimeValue | t, |
ShapeHierarchy * | hier = NULL |
||
) | [pure virtual] |
This method is called to prepare the shape for lofting, extrusion, etc.
This methods looks at the shape organization, and puts together a shape hierarchy. This provides information on how the shapes are nested.
t | The time to organize the curves. |
hier | This class provides information about the hierarchy. See Class ShapeHierarchy. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual void MakePolyShape | ( | TimeValue | t, |
PolyShape & | shape, | ||
int | steps =
PSHAPE_BUILTIN_STEPS , |
||
BOOL | optimize =
FALSE |
||
) | [pure virtual] |
Create a PolyShape representation with optional fixed steps.
t | The time to make the PolyShape. |
shape | The PolyShape representation is stored here. |
steps | The number of steps between knots. Values >=0 indicates the
use of fixed steps: PSHAPE_BUILTIN_STEPS Use the shape's built-in steps/adaptive settings (default). PSHAPE_ADAPTIVE_STEPS Force adaptive steps. |
optimize | If TRUE intermediate steps are removed from linear segments. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual int MakeCap | ( | TimeValue | t, |
MeshCapInfo & | capInfo, | ||
int | capType | ||
) | [pure virtual] |
This method generates a mesh capping info for the shape.
t | The time to create the cap info. |
capInfo | The cap info to update. |
capType | See Shape Capping Types. |
Implemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual int MakeCap | ( | TimeValue | t, |
PatchCapInfo & | capInfo | ||
) | [inline, virtual] |
This method creates a patch cap info out of the shape.
Only implement this method if CanMakeBezier() returns TRUE.
t | The time to create the cap info. |
capInfo | The cap info to update. |
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, and MSShapeXtnd.
{ return 0; } // Only implement if CanMakeBezier=TRUE -- Gen patch cap info
virtual BOOL AttachShape | ( | TimeValue | t, |
INode * | thisNode, | ||
INode * | attachNode, | ||
BOOL | weldEnds = FALSE , |
||
float | weldThreshold =
0.0f |
||
) | [inline, virtual] |
This method is called to attach the shape of attachNode to thisNode at the specified time.
If any endpoints of the curves in the shape being attached are within the threshold distance to endpoints of an existing curve, and the weld flag is TRUE, they should be welded.
t | The time to attach. |
thisNode | This is the node associated with this shape object. |
attachNode | The node of the shape to attach. |
weldEnds | If TRUE the endpoints of the shape should be welded together (based on the threshold below). If FALSE no welding is necessary. |
weldThreshold | If any endpoints of the curves in the shape being attached are within this threshold distance to endpoints of an existing curve, and the weld flag is TRUE, they should be welded |
{ return FALSE; } // Return TRUE if attached
virtual BOOL HasUVW | ( | ) | [inline, virtual] |
It is called to find out if the object is has UVW coordinates.
This method returns TRUE if the object has UVW coordinates; otherwise FALSE. In 3ds Max 2.0 and later there is code in the renderer that will automatically turn on the UVW coordinates of the base object if UV's are missing (and needed). The base object has to implement two simple methods to make this work: HasUVW() and SetGenUVW(). Developers are encouraged to put these methods in their objects: it makes using the program easier for the user. If they are not implemented, it doesn't cause any real harm: it will just operate as before and put up the missing UVW's message. Here is how the procedural sphere implements these methods:
BOOL SphereObject::GetGenUVW() { BOOL genUVs; Interval v; pblock->GetValue(PB_GENUVS, 0, genUVs, v); return genUVs; } void SphereObject::SetGenUVW(BOOL sw) { if (sw==GetGenUVW()) return; pblock->SetValue(PB_GENUVS,0, sw); }
Important Note: The pblock->SetValue() will cause a call to NotifyDependents(FOREVER, PART_TEXMAP, REFMSG_CHANGE), which will invalidate the UVW cache. It is essential that this call be made, so if the 'generate UVW' boolean is not handled by a parameter block, then NotifyDependents() needs to be called explicitly. Also Note: For "modifiable objects" that pass up the pipeline getting modified, such as TriObject, EditTriObject, etc., which cannot generate their own UVWs, but can carry them in their data structures, only this HasUVW() method needs to be implemented. For example, here is the implementation for TriObject: BOOL TriObject::HasUVW() { return mesh.tvFace?1:0; }
Reimplemented from Object.
Reimplemented in MSPluginShape, MSShapeXtnd, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{ return GetGenUVs(); }
virtual BOOL HasUVW | ( | int | mapChannel | ) | [inline, virtual] |
It is called to find out if the object is has UVW coordinates for the specified mapping channel.
This method returns TRUE if the object has UVW coordinates; otherwise FALSE. See the method HasUVW() above for more details.
mapChannel | See List of Mapping Channels Values. |
Reimplemented from Object.
{ return (mapChannel==1) ? HasUVW() : FALSE; }
virtual void SetGenUVW | ( | BOOL | sw | ) | [inline, virtual] |
This method is called to change the state of its Generate UVW boolean.
If the state changes, the object must send a REFMSG_CHANGE up the pipeline by calling NotifyDependents(). This applies to map channel 1.
sw | The new state for the generate UVW flag. |
Reimplemented from BaseObject.
Reimplemented in MSPluginShape, MSShapeXtnd, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{ SetGenUVs(sw); }
virtual void SetGenUVW | ( | int | mapChannel, |
BOOL | sw | ||
) | [inline, virtual] |
This method is called to change the state of its Generate UVW boolean for the specified mapping channel.
If the state changes, the object must send a REFMSG_CHANGE up the pipeline by calling NotifyDependents().
mapChannel | The mapping channel index. See List of Mapping Channel Index Values. |
sw | The new state for the generate UVW flag. |
Reimplemented from BaseObject.
{ if (mapChannel==1) SetGenUVW (sw); }
Implemented by the System.
This method handles the storage of the data contained within the ShapeObject. In order to properly store this information, classes which subclass off of ShapeObject need to call this methods before storing their information.
isave | An interface for saving data. See Class ISave. |
Reimplemented from ReferenceMaker.
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, MSShapeXtnd, and MSPluginObject< ShapeObject >.
Implemented by the System.
This method handles the loading of the data contained within the ShapeObject. In order to properly load this information, classes which subclass off of ShapeObject need to call this methods before loading their information.
iload | An interface for loading data. See Class ILoad. |
Reimplemented from ReferenceMaker.
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginShape, MSShapeXtnd, and MSPluginObject< ShapeObject >.
virtual CoreExport Class_ID PreferredCollapseType | ( | ) | [virtual] |
Implemented by the System.
This is an implementation of the Object method. It simply returns splineShapeClassID.
Reimplemented from GeomObject.
Reimplemented in MSPluginShape, and MSShapeXtnd.
virtual CoreExport BOOL GetExtendedProperties | ( | TimeValue | t, |
MSTR & | prop1Label, | ||
MSTR & | prop1Data, | ||
MSTR & | prop2Label, | ||
MSTR & | prop2Data | ||
) | [virtual] |
Implemented by the System.
This is an implementation of the Object method. It fills in the property fields with the number of vertices and curves in the shape.
Reimplemented from Object.
Reimplemented in MSPluginShape, and MSShapeXtnd.
virtual CoreExport void RescaleWorldUnits | ( | float | f | ) | [virtual] |
Implemented by the System.
Objects derived from this class which have RescaleWorldUnits methods implemented need to call this method. The following example is the SplineShape implementation of this method from core.
void SplineShape::RescaleWorldUnits(float f) { if (TestAFlag(A_WORK1)) return; // Call the base class's rescale (this sets the A_WORK1 flag) ShapeObject::RescaleWorldUnits(f); // Now rescale stuff inside our data structures Matrix3 stm = ScaleMatrix(Point3(f, f, f)); shape.Transform(stm); }
Note that the A_WORK1 flags is tested first to be sure it isn't processing the rescale twice. The code then calls ShapeObject::RescaleWorldUnits, which sets the A_WORK1 flag and performs the necessary rescale methods for all references for the object, and scales the renderable thickness value.
f | The parameter to scale. |
Reimplemented from ReferenceMaker.
Reimplemented in LinearShape, SplineShape, MSPluginShape, and MSShapeXtnd.
virtual CoreExport RefResult NotifyRefChanged | ( | Interval | changeInt, |
RefTargetHandle | hTarget, | ||
PartID & | partID, | ||
RefMessage | message | ||
) | [virtual] |
This method will notify the Shape Object of changes in values in its parameter block.
The ShapeObject's parameter block is reference number zero. If
subclasses implement this method, they should pass any messages
referring to the ShapeObject's parameter block to it. For
example:
If this isn't one of our references, pass it on to the
ShapeObject...
if(hTarget == GetReference(0))
return
ShapeObject::NotifyRefChanged(
changeInt, hTarget, partID, message);
This is a vital part of the mechanism; When a parameter in the
parameter block changes, the
ShapeObject must be able to flush its cached mesh which will no
longer be valid.
changeInt | This is the interval of time over which the message is active. |
hTarget | This is the handle of the reference target the message was sent by. The reference maker uses this handle to know specifically which reference target sent the message. |
partID | This contains information specific to the message passed in. Some messages don't use the partID at all. See the section Reference Messages for more information about the meaning of the partID for some common messages. |
message | The msg parameter passed into this method is the specific message which needs to be handled. See Reference Messages. |
Implements ReferenceMaker.
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, and MSPluginObject< ShapeObject >.
virtual CoreExport RefTargetHandle GetReference | ( | int | i | ) | [virtual] |
This method allows the ShapeObject to return a pointer to its parameter block.
Any subclasses implementing this method must pass on the call if it indicates the ShapeObject's reference. For example:
>RefTargetHandle SomeShape::GetReference(int i) { If(i == 0) return ShapeObject::GetReference(i); }
i | The reference handle to retrieve. |
Reimplemented from ReferenceMaker.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
virtual CoreExport void SetReference | ( | int | i, |
RefTargetHandle | rtarg | ||
) | [protected, virtual] |
This method sets the ShapeObject's parameter block pointer.
Any subclasses implementing this method must pass on the call to
the
ShapeObject if it refers to index 0. For example: void
SomeShape::SetReference(int i, RefTargetHandle rtarg) {
if(i == 0) ShapeObject::SetReference(i, rtarg);
}
i | The virtual array index of the reference to store. |
rtarg | The reference handle to store. |
Reimplemented from ReferenceMaker.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
virtual CoreExport Animatable* SubAnim | ( | int | i | ) | [virtual] |
This method returns the ShapeObject's animatable pointer.
Derived classes implementing this method must pass on references
to index 0 to the
ShapeObject. For example:: Animatable* SomeShape::SubAnim(int
i) {
if(i == 0) return ShapeObject::SubAnim(i);
}
i | This is the index of the sub-anim to return. |
Reimplemented from Animatable.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
virtual CoreExport MSTR SubAnimName | ( | int | i | ) | [virtual] |
This method returns the name of the animatable's name.
Derived classes implementing this method must pass on references
to index 0 to the
ShapeObject. For example: MSTR SomeShape::SubAnimName(int i)
{
if(i == 0) return ShapeObject::SubAnimName(i);
}
i | This is the index of the sub-anim's name to return. |
Reimplemented from Animatable.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
CoreExport ParamDimension* GetParameterDim | ( | int | pbIndex | ) |
This method returns the parameter dimension of the parameter whose index is passed.
pbIndex | The index of the parameter to return the dimension of. |
Reimplemented in SimpleShape, and SimpleSpline.
CoreExport MSTR GetParameterName | ( | int | pbIndex | ) |
This method returns the name of the parameter whose index is passed.
pbIndex | The index of the parameter to return the dimension of. |
Reimplemented in SimpleShape, and SimpleSpline.
virtual CoreExport int RemapRefOnLoad | ( | int | iref | ) | [virtual] |
This method remaps references at load time so that files saved from previous versions of 3ds Max get their references adjusted properly to allow for the new ShapeObject reference.
If derived classes implement this method, they must properly
pass on the call to the ShapeObject's code. An example from the
SplineShape code:
int
SplineShape::RemapRefOnLoad(int iref) {
Have the
ShapeObject do its thing first...
iref = ShapeObject::RemapRefOnLoad(iref);
if(loadRefVersion == ES_REF_VER_0)
return iref+1;
return iref;
}
Note that the SplineShape first calls ShapeObject's
remapper, then applies its remapping operation to the index
returned by the
ShapeObject code. IMPORTANT NOTE: For this remapping to operate
properly, the derived class MUST call ShapeObject::Save as the first
thing in its ::Save method, and must call ShapeObject::Load as the first
thing in its ::Load method. This allows the
ShapeObject to determine file versions and the need for
remapping references.
iref | The input index of the reference. |
Reimplemented from ReferenceMaker.
Reimplemented in SplineShape.
virtual int NumRefs | ( | ) | [inline, virtual] |
The ShapeObject makes 1 reference; this is where it tells the system.
Any derived classes implementing this method must take this into
account when returning the number of references they make. A good
idea is to implement NumRefs in derived classes as: Int
SomeShape::NumRefs() {
return myNumRefs +
ShapeObject::NumRefs();
}
Reimplemented from ReferenceMaker.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{return 1;}
virtual int NumSubs | ( | ) | [inline, virtual] |
Reimplemented from Animatable.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
{return 1;}
CoreExport void BeginEditParams | ( | IObjParam * | ip, |
ULONG | flags, | ||
Animatable * | prev | ||
) | [virtual] |
This method allows the ShapeObject to create its new "Rendering" rollup.
To use it, the derived class simply calls it first thing in its
own BeginEditParams method. An example from the SplineShape code:
void
SplineShape::BeginEditParams(IObjParam *ip, ULONG flags,Animatable prev )
{
ShapeObject::BeginEditParams(ip, flags, prev);
...
}
ip | The interface pointer passed to the plug-in. |
flags | The flags passed along to the plug-in in Animatable::BeginEditParams(). |
prev | The pointer passed to the plug-in in Animatable::BeginEditParams(). |
Reimplemented from Animatable.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
CoreExport void EndEditParams | ( | IObjParam * | ip, |
ULONG | flags, | ||
Animatable * | next | ||
) | [virtual] |
Similarly to BeginEditParams, this method allows the ShapeObject to remove its "Rendering" rollup.
A derived class simply calls this first thing in its own
EndEditParams. An example from the SplineShape code: void
SplineShape::EndEditParams( IObjParam *ip, ULONG flags,Animatable next )
{
ShapeObject::EndEditParams(ip, flags, next);
...
}
ip | The interface pointer passed to the plug-in. |
flags | The flags passed along to the plug-in in Animatable::BeginEditParams(). |
prev | The pointer passed to the plug-in in Animatable::BeginEditParams(). |
Reimplemented from Animatable.
Reimplemented in SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
CoreExport Interval GetShapeObjValidity | ( | TimeValue | t | ) |
This method gets the validity interval for the ShapeObject's internal parameters only.
It DOES NOT include those of the derived classes. So, if you called this method on a ShapeObject that was a circle with an animated radius, you wouldn't see the effect of the animated radius on the interval
t | The time about which the interval is computed. |
This method displays the shape's generated mesh if necessary.
Objects derived from
ShapeObject will want to have the
ShapeObject code display the rendering mesh in the viewport;
this method will do that for them. Simply set the viewport
transform and call this method. An example from the SplineShape code: int SplineShape::Display(TimeValue
t, INode *inode,
ViewExp* vpt, int flags)
{
Eval(t);
GraphicsWindow
*gw = vpt->getGW();
gw->setTransform(inode->GetObjectTM(t));
ShapeObject::Display(t, inode, vpt, flags);
...
}
If the ShapeObject's "Display Render Mesh" switch is off, it will
do nothing. Otherwise, it will display the proper mesh as specified
by its parameter block.
t | The time to display the object. |
inode | The node to display. |
vpt | An interface pointer that may be used to call methods associated with the viewports. |
flags | See Display Flags. |
Reimplemented from BaseObject.
Reimplemented in LinearShape, SimpleShape, SimpleSpline, SplineShape, MSPluginObject< ShapeObject >, and MSObjectXtnd< ShapeObject, MSPluginShape >.
This method returns a bounding box for the shape, if it's active, if the "Display Render Mesh" switch is on.
It is necessary to include this box when computing the bounding box for a shape, otherwise the viewport display will not work properly.
t | The time to get the bounding box. |
tm | The points of ShapeObject are transformed by this matrix prior to the bounding box computations. |
virtual CoreExport void InvalidateGeomCache | ( | ) | [virtual] |
This method is very important - It causes the ShapeObject to flush its cached rendering mesh.
Most objects have their own "InvalidateGeomCache" methods; simply call this when a shape derived from ShapeObject changes and it will ensure that the rendering mesh is regenerated the next time it is evaluated. Failure to call this method will result in improper rendering mesh updates.
Reimplemented in LinearShape, and SplineShape.
int SetProperty | ( | ULONG | id, |
void * | data | ||
) | [inline, virtual] |
Associates data passed in to given id.
Retains and associates passed in AnimProperty data to the id passed in by client.
id | An id used to identify the property. |
data | A pointer (needs to be castable to AnimProperty *) that contains the data to be kept. |
Reimplemented from Animatable.
{ AnimProperty *prop = (AnimProperty *)GetProperty(id); if (prop) prop = (AnimProperty*)data; else { prop = (AnimProperty *)data; aprops.Append(1, &prop); } return 1; }
void* GetProperty | ( | ULONG | id | ) | [inline, virtual] |
Retrieves data associated with id.
Retrieves the AnimProperty data associated with the passed in id.
id | Id that is associated with desired data. |
Reimplemented from Animatable.
CoreExport BOOL GetUsePhysicalScaleUVs | ( | ) |
Queries whether if real world texture size is used or not.
CoreExport void SetUsePhysicalScaleUVs | ( | BOOL | flag | ) |
Sets whether real world texture size is used or not.
friend class SObjRenderingDlgProc
[friend] |
friend class ShapePostLoadCallback
[friend] |
friend class IShapeRectRenderParams
[friend] |