Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions

SimpleObject Class Reference

This reference page is linked to from the following overview topics: Lesson 5: Geometric Objects, Handling Requests for Interfaces, How Objects are Drawn in the Viewport, Animatables and Sub-Animatables, Hit Testing, Creating the Mesh, Converting Objects to Compatible Types, Displaying the Object in the Viewport.


Search for all occurrences

Detailed Description

See also:
Class GeomObject, Class IParamBlock, Class Mesh.

Description:
This is a base class for creating procedural objects. This class implements many of the methods required to create a procedural object. The only limitation for a procedural object using SimpleObject as a base class is that it must represent itself with a mesh.
Data Members:
Note: Methods of the base class refer to these data members. For example the base class implementations of the bounding box methods use the mesh data member. Therefore the plug-in derived from SimpleObject must use these same data members.

IParamBlock *pblock;

The parameter block for managing the object's parameters.

Mesh mesh;

The mesh object that is built by BuildMesh().

Interval ivalid;

The validity interval for the mesh. This interval is used to determine how BuildMesh() is called. If this interval is not set BuildMesh() will be called over and over as the system won't know when the mesh is valid or not. Make sure you set this interval to accurately reflect the validity interval for the mesh.

BOOL suspendSnap;

If TRUE, this causes no snapping to occur. This is commonly used to prevent an object from snapping to itself when it is creating. For example, in the mouse proc used to create an object, the following code is often used when snapping mouse points:

ob->suspendSnap = TRUE;

p0 = vpt->SnapPoint(m,m,NULL,SNAP_IN_PLANE);

This disables snapping temporarily to keep the object from snapping to itself.

Procedural Object plug-ins which subclass off SimpleObject must implement these methods. The default implementations are noted.

#include <simpobj.h>

Inheritance diagram for SimpleObject:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  SimpleObject ()
CoreExport  ~SimpleObject ()
CoreExport void  UpdateMesh (TimeValue t)
CoreExport void  GetBBox (TimeValue t, Matrix3 &tm, Box3 &box)
void  MeshInvalid ()
virtual CoreExport bool  RequiresSupportForLegacyDisplayMode () const
virtual CoreExport bool  UpdateDisplay (unsigned long renderItemCategories, const MaxSDK::Graphics::MaterialRequiredStreams &materialRequiredStreams, TimeValue t)
CoreExport void  BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev)
CoreExport void  EndEditParams (IObjParam *ip, ULONG flags, Animatable *next)
CoreExport int  HitTest (TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
  This method is called to determine if the specified screen point intersects the item.
CoreExport void  Snap (TimeValue t, INode *inode, SnapInfo *snap, IPoint2 *p, ViewExp *vpt)
  Checks the point passed for a snap and updates the SnapInfo structure.
CoreExport int  Display (TimeValue t, INode *inode, ViewExp *vpt, int flags)
  This is called by the system to have the item display itself (perform a quick render in viewport, using the current TM).
CoreExport IParamArray GetParamBlock ()
  An object or modifier should implement this method if it wishes to make its parameter block available for other plug-ins to access it.
CoreExport int  GetParamBlockIndex (int id)
  If a plug-in makes its parameter block available (using GetParamBlock()) then it will need to provide #defines for indices into the parameter block.
CoreExport ObjectState  Eval (TimeValue time)
  This method is called to evaluate the object and return the result as an ObjectState.
void  InitNodeName (MSTR &s)
  This is the default name of the node when it is created.
CoreExport Interval  ObjectValidity (TimeValue t)
  This method returns the validity interval of the object as a whole at the specified time.
CoreExport int  CanConvertToType (Class_ID obtype)
  Indicates whether the object can be converted to the specified type.
CoreExport Object ConvertToType (TimeValue t, Class_ID obtype)
  This method converts this object to the type specified and returns a pointer it.
CoreExport BOOL  PolygonCount (TimeValue t, int &numFaces, int &numVerts)
  Retreives the number of faces and vertices of the polyginal mesh representation of this object.
CoreExport int  IntersectRay (TimeValue t, Ray &ray, float &at, Point3 &norm)
  This method is called to compute the intersection point and surface normal at this intersection point of the ray passed and the object.
CoreExport void  GetWorldBoundBox (TimeValue t, INode *inode, ViewExp *vpt, Box3 &box)
  This method returns the world space bounding box for Objects (see below for the Sub-object gizmo or Modifiers gizmo version).
CoreExport void  GetLocalBoundBox (TimeValue t, INode *inode, ViewExp *vpt, Box3 &box)
  This is the object space bounding box, the box in the object's local coordinates.
CoreExport void  GetDeformBBox (TimeValue t, Box3 &box, Matrix3 *tm, BOOL useSel)
  This method computes the bounding box in the objects local coordinates or the optional space defined by tm.
CoreExport Mesh GetRenderMesh (TimeValue t, INode *inode, View &view, BOOL &needDelete)
  This method should be implemented by all renderable GeomObjects.
CoreExport void  FreeCaches ()
void  GetClassName (MSTR &s)
  Retrieves the name of the plugin class.
int  NumSubs ()
Animatable SubAnim (int i)
CoreExport MSTR  SubAnimName (int i)
virtual CoreExport BaseInterface GetInterface (Interface_ID iid)
  Inherited from Animatable.
CoreExport void *  GetInterface (ULONG id)
  Inherited from Animatable.
int  NumRefs ()
  Returns the total number of references this ReferenceMaker can hold.
RefTargetHandle  GetReference (int i)
  Returns the 'i-th' reference.
CoreExport RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  Receives and responds to messages.
virtual void  BuildMesh (TimeValue t)=0
virtual BOOL  OKtoDisplay (TimeValue t)
virtual void  InvalidateUI ()
virtual ParamDimension GetParameterDim (int pbIndex)
virtual MSTR  GetParameterName (int pbIndex)

Public Attributes

IParamBlock pblock
Mesh  mesh
Interval  ivalid
BOOL  suspendSnap

Static Public Attributes

static SimpleObject editOb

Protected Member Functions

virtual void  SetReference (int i, RefTargetHandle rtarg)
  Stores a ReferenceTarget as its 'i-th' reference`.

Constructor & Destructor Documentation

CoreExport SimpleObject ( )
CoreExport ~SimpleObject ( )

Member Function Documentation

CoreExport void UpdateMesh ( TimeValue  t )
CoreExport void GetBBox ( TimeValue  t,
Matrix3 tm,
Box3 box 
)
void MeshInvalid ( ) [inline]
virtual CoreExport bool RequiresSupportForLegacyDisplayMode ( ) const [virtual]
virtual CoreExport bool UpdateDisplay ( unsigned long  renderItemCategories,
const MaxSDK::Graphics::MaterialRequiredStreams materialRequiredStreams,
TimeValue  t 
) [virtual]
CoreExport void BeginEditParams ( IObjParam ip,
ULONG  flags,
Animatable prev 
) [virtual]
Remarks:
This method is called by the system when the user may edit the item's (object, modifier, controller, etc.) parameters.
Parameters:
ip Interface pointer. The developer can use it to call methods such as AddRollupPage(). Note that this pointer is only valid between BeginEditParams() and EndEditParams(). It should not be used outside this interval.
flags Describe which branch of the command panel or dialog the item is being edited in. The following are possible values:

BEGIN_EDIT_CREATE
Indicates an item is being edited in the create branch.

BEGIN_EDIT_MOTION
Indicates a controller is being edited in the motion branch.

BEGIN_EDIT_HIERARCHY
Indicates a controller is being edited in the Pivot subtask of the hierarchy branch.

BEGIN_EDIT_IK
Indicates a controller is being edited in the IK subtask of the hierarchy branch.

BEGIN_EDIT_LINKINFO
Indicates a controller is being edited in the Link Info subtask of the hierarchy branch.

prev Pointer to an Animatable object. This parameter may be used in the motion and hierarchy branches of the command panel. This pointer allows a plug-in to look at the ClassID of the previous item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel, but simply update the values displayed in the UI fields. This prevents the UI from 'flickering' when the current item begins its edit. For example, if you are in the motion branch and are looking at an item's PRS controller values, and then select another item that is displayed with a PRS controller, the UI will not change - only the values displayed in the fields will change. If however you selected a target camera that has a lookat controller (not a PRS controller) the UI will change because a different set of parameters need to be displayed. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from Animatable.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

CoreExport void EndEditParams ( IObjParam ip,
ULONG  flags,
Animatable next 
) [virtual]
Remarks:
This method is called when the user is finished editing an objects parameters. The system passes a flag into the EndEditParams() method to indicate if the rollup page should be removed. If this flag is TRUE, the plug-in must un-register the rollup page, and delete it from the panel.
Parameters:
ip An interface pointer. The developer may use the interface pointer to call methods such as DeleteRollupPage().

flags The following flag may be set:

END_EDIT_REMOVEUI
If TRUE, the item's user interface should be removed.

next Animatable pointer. Can be used in the motion and hierarchy branches of the command panel. It allows a plug-in to look at the ClassID of the next item that was being edited, and if it is the same as this item, to not replace the entire UI in the command panel. Note that for items that are edited in the modifier branch this field can be ignored.

Reimplemented from Animatable.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

CoreExport int HitTest ( TimeValue  t,
INode inode,
int  type,
int  crossing,
int  flags,
IPoint2 p,
ViewExp vpt 
) [virtual]

This method is called to determine if the specified screen point intersects the item.

The method returns nonzero if the item was hit; otherwise 0.

Parameters:
t The time to perform the hit test.
inode A pointer to the node to test.
type The type of hit testing to perform. See Scene and Node Hit Test Types. for details.
crossing The state of the crossing setting. If TRUE crossing selection is on.
flags The hit test flags. See Scene and Node Hit Testing Flags for details.
p The screen point to test.
vpt An interface pointer that may be used to call methods associated with the viewports.
Returns:
Nonzero if the item was hit; otherwise 0.

Reimplemented from BaseObject.

Reimplemented in MSSimpleObjectXtnd.

CoreExport void Snap ( TimeValue  t,
INode inode,
SnapInfo snap,
IPoint2 p,
ViewExp vpt 
) [virtual]

Checks the point passed for a snap and updates the SnapInfo structure.

Note:
Developers wanting to find snap points on an Editable Mesh object should see the method XmeshSnap::Snap() in /MAXSDK/SAMPLES/SNAPS/XMESH/XMESH.CPP.
Parameters:
t The time to check.
inode The node to check.
snap The snap info structure to update.
p The screen point to check.
vpt An interface pointer that may be used to call methods associated with the viewports.

Reimplemented from BaseObject.

Reimplemented in MSSimpleObjectXtnd.

CoreExport int Display ( TimeValue  t,
INode inode,
ViewExp vpt,
int  flags 
) [virtual]

This is called by the system to have the item display itself (perform a quick render in viewport, using the current TM).

Note: For this method to be called the object's validity interval must be invalid at the specified time t. If the interval is valid, the system may not call this method since it thinks the display is already valid.

Parameters:
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.
Returns:
The return value is not currently used.

Reimplemented from BaseObject.

Reimplemented in MSSimpleObjectXtnd.

CoreExport IParamArray* GetParamBlock ( ) [virtual]

An object or modifier should implement this method if it wishes to make its parameter block available for other plug-ins to access it.

The system itself doesn't actually call this method. This method is optional.

Returns:
A pointer to the item's parameter block. See Class IParamArray.

Reimplemented from BaseObject.

CoreExport int GetParamBlockIndex ( int  id ) [virtual]

If a plug-in makes its parameter block available (using GetParamBlock()) then it will need to provide #defines for indices into the parameter block.

These defines should not be directly used with the parameter block but instead converted by this function that the plug-in implements. This way if a parameter moves around in a future version of the plug-in the #define can be remapped. A return value of -1 indicates an invalid parameter id.

Parameters:
id The parameter block id. See Parameter Block IDs.
Returns:
The parameter block index or -1 if it is invalid.

Reimplemented from BaseObject.

CoreExport ObjectState Eval ( TimeValue  t ) [virtual]

This method is called to evaluate the object and return the result as an ObjectState.

When the system has a pointer to an object it doesn't know if it's a procedural object or a derived object. So it calls Eval() on it and gets back an ObjectState. A derived object managed by the system may have to call Eval() on its input for example. A plug-in (like a procedural object) typically just returns itself. A plug-in that does not just return itself is the Morph Object (/MAXSDK/SAMPLES/OBJECTS/MORPHOBJ.CPP). This object uses a morph controller to compute a new object and fill in an ObjectState which it returns.

Parameters:
t Specifies the time to evaluate the object.
Returns:
The result of evaluating the object as an ObjectState.
Sample Code:
Typically this method is implemented as follows:
    { return ObjectState(this); }

Implements Object.

Reimplemented in MSSimpleObjectXtnd.

void InitNodeName ( MSTR s ) [inline, virtual]

This is the default name of the node when it is created.

Parameters:
s The default name of the node is stored here.

Reimplemented from GeomObject.

Reimplemented in MSSimpleObjectXtnd.

{s = GetObjectName();}
CoreExport Interval ObjectValidity ( TimeValue  t ) [virtual]

This method returns the validity interval of the object as a whole at the specified time.

Parameters:
t The time to compute the validity interval.
Default Implementation:
{ return FOREVER; }
Returns:
The validity interval of the object.

Reimplemented from Object.

Reimplemented in MSSimpleObjectXtnd.

CoreExport int CanConvertToType ( Class_ID  obtype ) [virtual]

Indicates whether the object can be converted to the specified type.

If the object returns nonzero to indicate it can be converted to the specified type, it must handle converting to and returning an object of that type from ConvertToType().

See also:
Class ObjectConverter for additional details on converting objects between types.
Parameters:
obtype The Class_ID of the type of object to convert to. See Class Class_ID, List of Class_IDs.
Returns:
Nonzero if the object can be converted to the specified type; otherwise 0.
Default Implementation:
{ return 0; }

Reimplemented from Object.

Reimplemented in MSSimpleObjectXtnd.

CoreExport Object* ConvertToType ( TimeValue  t,
Class_ID  obtype 
) [virtual]

This method converts this object to the type specified and returns a pointer it.

Note that if ConvertToType() returns a new object it should be a completely different object with no ties (pointers or references) to the original.

See also:
class ObjectConverter for additional details on converting objects between types.
The following is an issue that developers of world space modifiers need to
be aware of if the world space modifier specifies anything but generic deformable objects as its input type. In other words, if a world space modifier, in its implementation of Modifier::InputType(), doesn't specifically return defObjectClassID then the following issue regarding the 3ds Max pipeline needs to be considered. Developers of other plug-ins that don't meet this condition don't need to be concerned with this issue.
World space modifiers that work on anything other than generic deformable
objects are responsible for transforming the points of the object they modify into world space using the ObjectState TM. To understand why this is necessary, consider how 3ds Max applies the node transformation to the object flowing down the pipeline.
In the geometry pipeline architecture, the node in the scene has its
transformation applied to the object in the pipeline at the transition between the last object space modifier and the first world space modifier. The node transformation is what places the object in the scene -- thus this is what puts the object in world space. The system does this by transforming the points of the object in the pipeline by the node transformation. This is only possible however for deformable objects. Deformable objects are those that support the Object::IsDeformable(), NumPoints(), GetPoint() and SetPoint() methods. These deformable objects can be deformed by the system using these methods, and thus the system can modify the points to put them in world space itself.
If a world space modifier does not specify that it works on deformable
objects, the system is unable to transform the points of the object into world space. What it does instead is apply the transformation to the ObjectState TM. In this case, a world space modifier is responsible for transforming the points of the object into world space itself, and then setting the ObjectState TM to the identity. There is an example of this in the sample code for the Bomb space warp. The Bomb operates on TriObjects and implements InputType() as { return Class_ID(TRIOBJ_CLASS_ID,0); }. Since it doesn't specifically return defObjectClassID, it is thus responsible for transforming the points of the object into world space itself. It does this in its implementation of ModifyObject() as follows:
    if (os->GetTM())
    {
        Matrix3 tm = *(os->GetTM());
        for (int i=0; i<triOb->mesh.getNumVerts(); i++) {
            triOb->mesh.verts[i] = triOb->mesh.verts[i] *tm;
        }
        os->obj->UpdateValidity(GEOM_CHAN_NUM,os->tmValid());
        os->SetTM(NULL,FOREVER);
    }
As the code above shows, the Bomb checks if the ObjectState TM is non-NULL. If it is, the points of the object are still not in world space and thus must be transformed. It does this by looping through the points of the TriObject and multiplying each point by the ObjectState TM. When it is done, it sets the ObjectState TM to NULL to indicate the points are now in world space. This ensure that any later WSMs will not transform the points with this matrix again.
For the Bomb world space modifier this is not a problem since it specifies
in its implementation of ChannelsChanged() that it will operate on the geometry channel (PART_GEOM). Certain world space modifiers may not normally specify PART_GEOM in their implementation of ChannelsChanged(). Consider the camera mapping world space modifier. Its function is to apply mapping coordinates to the object it is applied to. Thus it would normally only specify PART_TEXMAP for ChannelsChanged(). However, since it operates directly on TriObjects, just like the Bomb, the system cannot transform the points into world space, and therefore the camera mapping modifier must do so in its implementation of ModifyObject(). But since it is actually altering the points of the object by putting them into world space it is altering the geometry channel. Therefore, it should really specify PART_GEOM | PART_TEXMAP in its implementation of ChannelsChanged(). If it didn't do this, but went ahead and modified the points of the object anyway, it would be transforming not copies of the points, but the original points stored back in an earlier cache or even the base object.
This is the issue developers need to be aware of. To state this in simple
terms then: Any world space modifier that needs to put the points of the object into world space (since it doesn't implement InputType() as defObjectClassID) needs to specify PART_GEOM in its implementation of ChannelsChanged().
Parameters:
t The time at which to convert.
obtype The Class_ID of the type of object to convert to. See Class Class_ID, List of Class_IDs.
Returns:
A pointer to an object of type obtype.
Default Implementation:
{ return NULL; }
Sample Code:
The following code shows how a TriObject can be retrieved from a node. Note on the code that if you call ConvertToType() on an object and it returns a pointer other than itself, you are responsible for deleting that object.
    // Retrieve the TriObject from the node
    int deleteIt;
    TriObject *triObject = GetTriObjectFromNode(ip->GetSelNode(0),deleteIt);
    // Use the TriObject if available
    if (!triObject) return;
    // ...
    // Delete it when done...
    if (deleteIt) triObject->DeleteMe();
    
    // Return a pointer to a TriObject given an INode or return NULL
    // if the node cannot be converted to a TriObject
    TriObject *Utility::GetTriObjectFromNode(INode *node, int &deleteIt)
    {
        deleteIt = FALSE;
        Object *obj = node->EvalWorldState(0).obj;
        if (obj->CanConvertToType(Class_ID(TRIOBJ_CLASS_ID, 0))) {
            TriObject *tri = (TriObject *) obj->ConvertToType(0,Class_ID(TRIOBJ_CLASS_ID, 0));
    // Note that the TriObject should only be deleted
    // if the pointer to it is not equal to the object
    // pointer that called ConvertToType()
            if (obj != tri) 
                deleteIt = TRUE;
            return tri;
        }
        else {
            return NULL;
        }
    }

Reimplemented from Object.

Reimplemented in MSSimpleObjectXtnd.

CoreExport BOOL PolygonCount ( TimeValue  t,
int &  numFaces,
int &  numVerts 
) [virtual]

Retreives the number of faces and vertices of the polyginal mesh representation of this object.

If this method returns FALSE then this functionality is not supported. Note: Plug-In developers should use the global function GetPolygonCount(Object*, int&, int&) to retrieve the number f vertices and faces in an arbitrary object.

Parameters:
t The time at which to compute the number of faces and vertices.
numFaces The number of faces is returned here.
numVerts The number of vertices is returned here.
Returns:
TRUE if the method is fully implemented; otherwise FALSE.

Reimplemented from Object.

CoreExport int IntersectRay ( TimeValue  t,
Ray r,
float &  at,
Point3 norm 
) [virtual]

This method is called to compute the intersection point and surface normal at this intersection point of the ray passed and the object.

Parameters:
t The time to compute the intersection.
r Ray to intersect. See Class Ray.
at The point of intersection.
norm Surface normal at the point of intersection.
Returns:
Nonzero if a point of intersection was found; otherwise 0.
See also:
The Mesh class implementation of this method.

Reimplemented from Object.

Reimplemented in MSSimpleObjectXtnd.

CoreExport void GetWorldBoundBox ( TimeValue  t,
INode inode,
ViewExp vp,
Box3 box 
) [virtual]

This method returns the world space bounding box for Objects (see below for the Sub-object gizmo or Modifiers gizmo version).

The bounding box returned by this method does not need to be precise. It should however be calculated rapidly. The object can handle this by transforming the 8 points of its local bounding box into world space and take the minimums and maximums of the result. Although this isn't necessarily the tightest bounding box of the objects points in world space, it is close enough.

Parameters:
t The time to compute the bounding box.
inode The node to calculate the bounding box for.
vp An interface pointer that can be used to call methods associated with the viewports.
box Contains the returned bounding box.

Reimplemented from BaseObject.

Reimplemented in MSSimpleObjectXtnd.

CoreExport void GetLocalBoundBox ( TimeValue  t,
INode inode,
ViewExp vp,
Box3 box 
) [virtual]

This is the object space bounding box, the box in the object's local coordinates.

The system expects that requesting the object space bounding box will be fast.

Parameters:
t The time to retrieve the bounding box.
inode The node to calculate the bounding box for.
vp An interface pointer that may be used to call methods associated with the viewports.
box Contains the returned bounding box.

Reimplemented from BaseObject.

Reimplemented in MSSimpleObjectXtnd.

CoreExport void GetDeformBBox ( TimeValue  t,
Box3 box,
Matrix3 tm,
BOOL  useSel 
) [virtual]

This method computes the bounding box in the objects local coordinates or the optional space defined by tm.

Note: If you are looking for a precise bounding box, use this method and pass in the node's object TM (INode::GetObjectTM()) as the matrix.

Parameters:
t The time to compute the box.
box A reference to a box the result is stored in.
tm This is an alternate coordinate system used to compute the box. If the tm is not NULL this matrix should be used in the computation of the result.
useSel If TRUE, the bounding box of selected sub-elements should be computed; otherwise the entire object should be used.

Reimplemented from Object.

Reimplemented in MSSimpleObjectXtnd.

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.)

Parameters:
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.
Returns:
A pointer to the mesh object.

Reimplemented from GeomObject.

CoreExport void FreeCaches ( ) [virtual]
Remarks:
This is called to delete any item that can be rebuilt. For example, the procedural sphere object has a mesh that it caches. It could call Mesh::FreeAll() on the mesh from this method. This will free the vertex/face/uv arrays. If the sphere is ever evaluated again it can just rebuild the mesh. If an object (like a sphere) has modifiers applied to it, and those modifiers are not animated, then the result of the pipeline is cached in the node. So there is no reason for the sphere to also have a cache of its representation. Therefore when this method is called, the sphere can free the data of the mesh.
Default Implementation:
{}

Reimplemented from Animatable.

Reimplemented in MSSimpleObjectXtnd.

void GetClassName ( MSTR s ) [inline, virtual]

Retrieves the name of the plugin class.

This name is usually used internally for debugging purposes. For Material plug-ins this method is used to put up the material "type" name in the Material Editor.

Parameters:
s Reference to a string filled in with the name of the plugin class

Reimplemented from ReferenceTarget.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{s = GetObjectName();}      
int NumSubs ( ) [inline, virtual]
Remarks:
The system uses a virtual array mechanism to access the sub-anims of a plug-in. This method returns the total number of sub-anims maintained by the plug-in. If a plug-in is using a parameter block to manage its parameters it should just return 1 for all the parameters directed by the parameter block.
Returns:
The number of sub-anims used by the plug-in.
Default Implementation:
{ return 0; }

Reimplemented from Animatable.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{ return 1; }  
Animatable* SubAnim ( int  i ) [inline, virtual]
Remarks:
This method returns a pointer to the 'i-th' sub-anim. If a plug-in is using a parameter block to manage all its parameters it should just return a pointer to the parameter block itself from this method. This method may return NULL so developers need to check the return value before calling other sub anim methods (such as SubAnimName()).
Parameters:
i This is the index of the sub-anim to return.
Default Implementation:
{ return NULL };

Reimplemented from Animatable.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{ return (Animatable*)pblock; }
CoreExport MSTR SubAnimName ( int  i ) [virtual]
Remarks:
This method returns the name of the 'i-th' sub-anim to appear in track view. The system has no idea what name to assign to the sub-anim (it only knows it by the virtual array index), so this method is called to retrieve the name to display. Developer need to make sure the 'i-th' SubAnim() is non-NULL or this method will fail.
Parameters:
i The index of the parameter name to return
Returns:
The name of the 'i-th' parameter.

Reimplemented from Animatable.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

virtual CoreExport BaseInterface* GetInterface ( Interface_ID  id ) [virtual]

Inherited from Animatable.

Returns a pointer to the Base Interface for the interface ID passed.

Parameters:
id - The unique ID of the interface to get
Returns:
A Pointer to the Interface

Reimplemented from Object.

CoreExport void* GetInterface ( ULONG  id ) [virtual]

Inherited from Animatable.

Returns a pointer to the interface.

Parameters:
id - The id of the interface.
Returns:
A Pointer to the Interface

Reimplemented from Object.

Reimplemented in PodObj, MSPluginSimpleObject, and MSSimpleObjectXtnd.

int NumRefs ( ) [inline, virtual]

Returns the total number of references this ReferenceMaker can hold.

The plugin implements this method to indicate the total number of of references it can make. This includes all references whether they are NULL (inactive) or non-NULL (active) at the time when this method is called. A plugin can hold a variable number of references, thus the return value of this method is not to be cached and reused by client code.

Returns:
The total number of references this plugin can hold. The default implementation is return 0.

Reimplemented from ReferenceMaker.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{return 1;}
RefTargetHandle GetReference ( int  i ) [inline, virtual]

Returns the 'i-th' reference.

The plugin implements this method to return its 'i-th' reference. The plug-in simply keeps track of its references using an integer index for each one. This method is normally called by the system.

Parameters:
i - The index of the reference to retrieve. Valid values are from 0 to NumRefs()-1.
Returns:
The reference handle of the 'i-th' reference. Note that different calls to this method with the same 'i' value can result in different reference handles being retrieved, as the plugin changes the scene objects it references as its 'i-th' reference.

Reimplemented from ReferenceMaker.

Reimplemented in SimpleObject2, MSPluginSimpleObject, and MSSimpleObjectXtnd.

{return (RefTargetHandle)pblock;}
virtual void SetReference ( int  i,
RefTargetHandle  rtarg 
) [inline, protected, virtual]

Stores a ReferenceTarget as its 'i-th' reference`.

The plugin implements this method to store the reference handle passed to it as its 'i-th' reference. In its implementation of this method, the plugin should simply assign the reference handle passed in as a parameter to the member variable that holds the 'i-th' reference. Other reference handling methods such as ReferenceMaker::DeleteReference(), or ReferenceMaker::ReplaceReference() should not be called from within this method. The plugin itself or other plugins should not call this method directly. The system will call this method when a new reference is created or an existing one is replaced by calling ReferenceMaker::ReplaceReference().

Parameters:
i - The index of the reference to store. Valid values are from 0 to NumRefs()-1.
rtarg - The reference handle to store.

Reimplemented from ReferenceMaker.

Reimplemented in SimpleObject2, MSPluginSimpleObject, and MSSimpleObjectXtnd.

{pblock=(IParamBlock*)rtarg;}       
CoreExport RefResult NotifyRefChanged ( Interval  changeInt,
RefTargetHandle  hTarget,
PartID partID,
RefMessage  message 
) [virtual]

Receives and responds to messages.

A plugin which makes references must implement a method to receive and respond to messages broadcast by its dependents. This is done by implementing NotifyRefChanged(). The plugin developer usually implements this method as a switch statement where each case is one of the messages the plugin needs to respond to. The Method StdNotifyRefChanged calls this, which can change the partID to new value. If it doesn't depend on the particular message& partID, it should return REF_DONTCARE.

  • For developer that need to update a dialog box with data about an object you reference note the following related to this method: This method may be called many times. For instance, say you have a dialog box that displays data about an object you reference. This method will get called many time during the drag operations on that object. If you updated the display every time you'd wind up with a lot of 'flicker' in the dialog box. Rather than updating the dialog box each time, you should just invalidate the window in response to the NotifyRefChanged() call. Then, as the user drags the mouse your window will still receive paint messages. If the scene is complex the user may have to pause (but not let up on the mouse) to allow the paint message to go through since they have a low priority. This is the way many windows in 3ds Max work.
Parameters:
changeInt - This is the interval of time over which the message is active. Currently, all plug-ins will receive FOREVER for this interval.
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 List of Reference Messages for more information about the meaning of the partID for some common messages.
message - The message parameters passed into this method is the specific message which needs to be handled.
Returns:
The return value from this method is of type RefResult. This is usually REF_SUCCEED indicating the message was processed. Sometimes, the return value may be REF_STOP. This return value is used to stop the message from being propagated to the dependents of the item.

Implements ReferenceMaker.

Reimplemented in MSPluginSimpleObject.

virtual void BuildMesh ( TimeValue  t ) [pure virtual]
Remarks:
This method is called to build the mesh representation of the object using its parameter settings at the time passed. The plug-in should use the data member mesh to store the built mesh.
Parameters:
TimeValue t

The time at which to build the mesh.

Implemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

virtual BOOL OKtoDisplay ( TimeValue  t ) [inline, virtual]
Remarks:
This method returns a BOOL to indicate if it is okay to draw the object at the time passed. Normally it is always OK to draw the object, so the default implementation returns TRUE. However for certain objects it might be a degenerate case to draw the object at a certain time (perhaps the size went to zero for example), so these objects could return FALSE.
Parameters:
TimeValue t

The time at which the object would be displayed.
Default Implementation:
{ return TRUE; }
Returns:
TRUE if the object may be displayed; otherwise FALSE.

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{return TRUE;}
virtual void InvalidateUI ( ) [inline, virtual]
Remarks:
This is called if the user interface parameters needs to be updated because the user moved to a new time. The UI controls must display values for the current time.
Example:
If the plug-in uses a parameter map for handling its UI, it may call a method of the parameter map to handle this:
        pmapParam->Invalidate();
If the plug-in does not use parameter maps, it should call the SetValue() method on each of its controls that display a value, for example the spinner controls. This will cause to the control to update the value displayed. The code below shows how this may be done for a spinner control. Note that ip and pblock are assumed to be initialized interface and parameter block pointers:
        void foo(IObjParam* ip, IParamBlock* pblock)
        {
            float newval;
            Interval valid = FOREVER;
            TimeValue t = ip->GetTime();
            // Get the value from the parameter block at the current time.
            pblock->GetValue( PB_ANGLE, t, newval, valid );
            // Set the value. Note that the notify argument is passed as FALSE.
            // This ensures no messages are sent when the value changes.
            angleSpin->SetValue( newval, FALSE );
        }

Reimplemented in MSPluginSimpleObject, and MSSimpleObjectXtnd.

{}
virtual ParamDimension* GetParameterDim ( int  pbIndex ) [inline, virtual]
Remarks:
This method returns the parameter dimension of the parameter whose index is passed.
Parameters:
int pbIndex

The index of the parameter to return the dimension of.
Returns:
Pointer to a ParamDimension.
Example:
return stdNormalizedDim;
Default Implementation:
The default implementation returns defaultDim.

See also:
ParamDimension

Reimplemented in MSSimpleObjectXtnd.

{return defaultDim;}
virtual MSTR GetParameterName ( int  pbIndex ) [inline, virtual]
Remarks:
This method returns the name of the parameter whose index is passed.
Parameters:
int pbIndex

The index of the parameter to return the name of.
Returns:
The name of the parameter.
Default Implementation:
The default implementation returns MSTR(_M("Parameter"))

Reimplemented in MSSimpleObjectXtnd.

{return MSTR(_M("Parameter"));}     

Member Data Documentation

SimpleObject* editOb [static]

SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject
SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject SimpleObject