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

SimpleMod Class Reference

This reference page is linked to from the following overview topics: Plug-in Base Classes, Getting and Setting Parameter Block Values, Simple Modifiers, Validity Intervals, Intervals, Hit Testing, Parameter Editing on the Command Panel, Enumerating and Identifying Sub-Animatables, Viewport Functionality, Indicating Required Input Object Types, Indicating Required Channels, Indicating Changed Channels, Performing Object Modification, Using a Deformer, Modifier Validity, Displaying the Modifier Gizmo, Implementing Sub-Object Selection, Sub-Object Coordinate Systems, Managing Modifier Parameters, World Space Modifier Plug-in Overview.


Search for all occurrences

Detailed Description

Base class for parameter block 1 (PB1) based object space modifiers.

Note:
It is recommended that class SimpleMod2 is used instead in order to take advantage of the parameter block 2 (PB2) system.
Description:
The SimpleMod class supplies most of the methods needed to implement an object space modifier.

This is a base class that is intended to be derived from, rather than be instantiated directly.

To be a 'Simple' modifier, the following assumptions are made:

The modifier only modifies the geometry channel.

The modifier uses an instance of a class derived from Deformer to do the modifying.

The modifier's gizmo is represented as a 3D box that has had the modifier applied to it.

This class maintains a pointer to a parameter block. Derived classes that use a single parameter block don't need to overwrite methods for managing sub-anims and references since SimpleMod's implementation of the respective methods takes care of this.

Derived classes that maintains several parameter blocks, must overwrite the methods NumSubs(), SubAnim(i), SubAnimName(i), NumRefs(), GetReference(i) and SetReference(i) and call the SimpleMod methods when 'i' refers to the parameters maintained by SimpleMod.

When objects derived from SimpleMod are cloning themselves, they should call this method on the clone to copy SimpleMod's data:

void SimpleModClone(SimpleMod *smodSource);

Classes derived from SimpleMod probably want to override these. If they do, they should call these from within their implementation of these methods.

void BeginEditParams(IObjParam *ip, ULONG flags,Animatable *prev);

void EndEditParams(IObjParam *ip, ULONG flags,Animatable *next);
Data Members:
Control *tmControl;

Points to the transform controller for the Gizmo.

Control *posControl;

Points to the position controller for the Center.

IParamBlock *pblock;

Pointer to a parameter block. Clients of SimpleMod should use the following value as the reference index of this parameter block. #define SIMPMOD_PBLOCKREF 2

static IObjParam *ip;

Storage for the interface pointer.

static MoveModBoxCMode *moveMode;

Storage for the move modifier box command mode.

static RotateModBoxCMode *rotMode;

Storage for the rotate modifier box command mode.

static UScaleModBoxCMode *uscaleMode;

Storage for the uniform scale modifier box command mode.

static NUScaleModBoxCMode *nuscaleMode;

Storage for the non-uniform scale modifier box command mode.

static SquashModBoxCMode *squashMode;

Storage for the squash modifier box command mode.

static SimpleMod *editMod;

Storage for the instance of SimpleMod that is being edited in the command panel.

#include <simpmod.h>

Inheritance diagram for SimpleMod:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  SimpleMod ()
ChannelMask  ChannelsUsed ()
  These are channels that the modifier needs in order to perform its modification.
ChannelMask  ChannelsChanged ()
  These are the channels that the modifier actually modifies.
CoreExport void  ModifyObject (TimeValue t, ModContext &mc, ObjectState *os, INode *node)
  This is the method that actually modifies the input object.
Class_ID  InputType ()
  This is the type of object that the modifier knows how to modify.
CoreExport Interval  LocalValidity (TimeValue t)
  This method returns the validity interval of a modifier.
CoreExport Matrix3  CompMatrix (TimeValue t, ModContext &mc, Matrix3 &ntm, Interval &valid, BOOL needOffset)
CoreExport void  CompOffset (TimeValue t, Matrix3 &offset, Matrix3 &invoffset)
CoreExport int  HitTest (TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext *mc)
  This method is used in modifier gizmo hit testing.
CoreExport int  Display (TimeValue t, INode *inode, ViewExp *vpt, int flagst, ModContext *mc)
  When this method is called the plug-in should respond by performing a quick render of the modifier gizmo in viewport using the current TM.
CoreExport void  GetWorldBoundBox (TimeValue t, INode *inode, ViewExp *vpt, Box3 &box, ModContext *mc)
  This method computes the world space bounding box of the modifier gizmo (or any object that when in sub-object mode has a gizmo).
CoreExport void  GetSubObjectCenters (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc)
  When the user is in a sub-object selection level, the system needs to get the reference coordinate system definition from the current modifier being edited so that it can display the axis.
CoreExport void  GetSubObjectTMs (SubObjAxisCallback *cb, TimeValue t, INode *node, ModContext *mc)
  When the user is in a sub-object selection level, the system needs to get the reference coordinate system definition from the current modifier being edited so that it can display the axis.
BOOL  ChangeTopology ()
  This method asks the question of an object or modifier "Do you change topology"? An object or modifier returns TRUE if it is capable of changing topology when its parameters are being edited; otherwise FALSE.
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 void  Move (TimeValue t, Matrix3 &partm, Matrix3 &tmAxis, Point3 &val, BOOL localOrigin=FALSE)
  When this method is called the plug-in should respond by moving its selected sub-object components.
CoreExport void  Rotate (TimeValue t, Matrix3 &partm, Matrix3 &tmAxis, Quat &val, BOOL localOrigin=FALSE)
  When this method is called the plug-in should respond by rotating its selected sub-object components.
CoreExport void  Scale (TimeValue t, Matrix3 &partm, Matrix3 &tmAxis, Point3 &val, BOOL localOrigin=FALSE)
  When this method is called the plug-in should respond by scaling its selected sub-object components.
int  NumRefs ()
  Returns the total number of references this ReferenceMaker can hold.
CoreExport RefTargetHandle  GetReference (int i)
  Returns the 'i-th' reference.
int  NumSubs ()
CoreExport Animatable SubAnim (int i)
CoreExport MSTR  SubAnimName (int i)
CoreExport int  SubNumToRefNum (int subNum)
CoreExport BOOL  AssignController (Animatable *control, int subAnim)
CoreExport RefResult  NotifyRefChanged (Interval changeInt, RefTargetHandle hTarget, PartID &partID, RefMessage message)
  Receives and responds to messages.
CreateMouseCallBack GetCreateMouseCallBack ()
  This method allows the system to retrieve a callback object used in creating an object in the 3D viewports.
CoreExport void  ActivateSubobjSel (int level, XFormModes &modes)
  When the user changes the selection of the sub-object drop down, this method is called to notify the plug-in.
CoreExport void  SimpleModClone (SimpleMod *smodSource)
CoreExport void  SimpleModClone (SimpleMod *smodSource, RemapDir &remap)
CoreExport void  BeginEditParams (IObjParam *ip, ULONG flags, Animatable *prev)
CoreExport void  EndEditParams (IObjParam *ip, ULONG flags, Animatable *next)
virtual Deformer GetDeformer (TimeValue t, ModContext &mc, Matrix3 &mat, Matrix3 &invmat)=0
virtual void  InvalidateUI ()
virtual Interval  GetValidity (TimeValue t)
virtual ParamDimension GetParameterDim (int pbIndex)
virtual MSTR  GetParameterName (int pbIndex)
virtual BOOL  GetModLimits (TimeValue t, float &zmin, float &zmax, int &axis)
CoreExport int  NumSubObjTypes ()
  Objects and modifiers that support subobjects have to overwrite this method - as well as GetSubObjType() - and return a class derived from ISubObjType in GetSubObjType().
CoreExport ISubObjType GetSubObjType (int i)
  Returns a pointer to the sub-object type for the sub-object whose index is passed.

Public Attributes

Control tmControl
Control posControl
IParamBlock pblock

Static Public Attributes

static CoreExport IObjParam ip
static MoveModBoxCMode moveMode
static RotateModBoxCMode rotMode
static UScaleModBoxCMode uscaleMode
static NUScaleModBoxCMode nuscaleMode
static SquashModBoxCMode squashMode
static SimpleMod editMod

Protected Member Functions

virtual CoreExport  ~SimpleMod ()
  Destructor. This is a base class that is not meant to be instantiated directly.
virtual CoreExport void  SetReference (int i, RefTargetHandle rtarg)
  Stores a ReferenceTarget as its 'i-th' reference`.

Constructor & Destructor Documentation

virtual CoreExport ~SimpleMod ( ) [protected, virtual]

Destructor. This is a base class that is not meant to be instantiated directly.

CoreExport SimpleMod ( )

Member Function Documentation

ChannelMask ChannelsUsed ( ) [inline, virtual]

These are channels that the modifier needs in order to perform its modification.

This should at least include the channels specified in ChannelsChanged() but may include more. Note that ChannelsUsed() is called many times but the channels returned should not change on the fly.

Returns:
The channels required. See objectChannels.
Sample Code:

Implements Modifier.

Reimplemented in MSSimpleModXtnd.

ChannelMask ChannelsChanged ( ) [inline, virtual]

These are the channels that the modifier actually modifies.

Note that ChannelsChanged() is called many times but the channels returned should not change on the fly.

Returns:
The channels that are changed. See objectChannels

Implements Modifier.

Reimplemented in MSSimpleModXtnd.

{ return PART_GEOM; }
CoreExport void ModifyObject ( TimeValue  t,
ModContext mc,
ObjectState os,
INode node 
) [virtual]

This is the method that actually modifies the input object.

This method is responsible for altering the object and then updating the validity interval of the object to reflect the validity of the modifier.

Parameters:
t The time at which the modification is being done.
mc A reference to the ModContext.
os The object state flowing through the pipeline. This contains a pointer to the object to modify.
node The node the modifier is applied to. This parameter is always NULL for Object Space Modifiers and non-NULL for World Space Modifiers (Space Warps). This is because a given WSM is only applied to a single node at a time whereas an OSM may be applied to several nodes. This may be used for example by particle system space warps to get the transformation matrix of the node at various times.
See also:
The topic on Modifiers in the Programmers Guide.

Implements Modifier.

Reimplemented in MSSimpleModXtnd.

Class_ID InputType ( ) [inline, virtual]

This is the type of object that the modifier knows how to modify.

Simple modifiers that just modify points of an object can operate on generic 'Deformable' objects. Deformable objects are any type of object that has points. A modifier could also work on a particular type of object such as a TriObject or PatchObject.

Returns:
The Class_ID of the item. You can request any Class_ID for your input type. For example, Class_ID(OMNI_LIGHT_CLASS_ID, 0). See List of Class_IDs.

Implements Modifier.

Reimplemented in MSSimpleModXtnd.

{return defObjectClassID;}
CoreExport Interval LocalValidity ( TimeValue  t ) [virtual]

This method returns the validity interval of a modifier.

It is simply the combination of the validity of all the modifier's parameters. It's used to determine when to cache in the pipeline, but is not directly responsible for determining when ModifyObject() is called. ModifyObject() is called when the pipeline needs to be evaluated either because someone sent a REFMSG_CHANGE message or the validity of the object does not include the current time.

If a modifier is not animated it's OK to simply return FOREVER from
this method. In the case where the modifier changes because a user changes a non-animated control in the user interface (for instance a check box), you can cause reevaluation by notifying your dependents of the change, i.e.:
Parameters:
t The time to calculate the Interval.
See also:
Advanced Topics on Intervals.

Reimplemented from Modifier.

CoreExport Matrix3 CompMatrix ( TimeValue  t,
ModContext mc,
Matrix3 ntm,
Interval valid,
BOOL  needOffset 
)
CoreExport void CompOffset ( TimeValue  t,
Matrix3 offset,
Matrix3 invoffset 
)
CoreExport int HitTest ( TimeValue  t,
INode inode,
int  type,
int  crossing,
int  flags,
IPoint2 p,
ViewExp vpt,
ModContext mc 
) [virtual]

This method is used in modifier gizmo hit testing.

It is called to determine if the specified screen point intersects the gizmo. 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.
mc A pointer to the modifiers ModContext.
Returns:
Nonzero if the item was hit; otherwise 0.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

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

When this method is called the plug-in should respond by performing a quick render of the modifier gizmo in viewport using the current TM.

Note for Modifiers: For this method to be called properly, one must send two reference messages using NotifyDependents. In BeginEditParams send: NotifyDependents(Interval(t,t), PART_ALL, REFMSG_MOD_DISPLAY_ON);

In EndEditParams send: NotifyDependents(Interval(t,t), PART_ALL, REFMSG_MOD_DISPLAY_OFF);

Parameters:
t The time to display the item.
inode The node to render.
vpt An interface pointer that may be used to call methods associated with the viewports.
flags See Display Flags.
mc A pointer to the modifiers ModContext.
Returns:
Nonzero if the item was displayed; otherwise 0.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

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

This method computes the world space bounding box of the modifier gizmo (or any object that when in sub-object mode has a gizmo).

Parameters:
t The time to compute the bounding box.
inode The node to calculate the bounding box for.
vpt An interface pointer that may be used to call methods associated with the viewports.
box The returned bounding box.
mc A pointer to the modifiers ModContext.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

CoreExport void GetSubObjectCenters ( SubObjAxisCallback cb,
TimeValue  t,
INode node,
ModContext mc 
) [virtual]

When the user is in a sub-object selection level, the system needs to get the reference coordinate system definition from the current modifier being edited so that it can display the axis.

This method specifies the position of the center. The plug-in enumerates its centers and calls the callback cb once for each.

Parameters:
cb The callback object whose methods may be called. See Class SubObjAxisCallback.
t The time to enumerate the centers.
node A pointer to the node.
mc A pointer to the ModContext.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

CoreExport void GetSubObjectTMs ( SubObjAxisCallback cb,
TimeValue  t,
INode node,
ModContext mc 
) [virtual]

When the user is in a sub-object selection level, the system needs to get the reference coordinate system definition from the current modifier being edited so that it can display the axis.

This method returns the axis system of the reference coordinate system. The plug-in enumerates its TMs and calls the callback cb once for each. See Sub-Object Coordinate Systems.

Parameters:
cb The callback object whose methods may be called.
t The time to enumerate the TMs.
node A pointer to the node.
mc A pointer to the ModContext.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

BOOL ChangeTopology ( ) [inline, virtual]

This method asks the question of an object or modifier "Do you change topology"? An object or modifier returns TRUE if it is capable of changing topology when its parameters are being edited; otherwise FALSE.

When an item is selected for editing, and there is a modifier in the pipeline that depends on topology, the system calls this method to see if it may potentially change the topology. If this method returns TRUE the system will put up a warning message indicating that a modifier exists in the stack that depends on topology.

Reimplemented from BaseObject.

Reimplemented in MSSimpleModXtnd.

{return FALSE;}
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 void Move ( TimeValue  t,
Matrix3 partm,
Matrix3 tmAxis,
Point3 val,
BOOL  localOrigin = FALSE 
) [virtual]

When this method is called the plug-in should respond by moving its selected sub-object components.

Parameters:
t The time of the transformation.
partm The 'parent' transformation matrix. This matrix represents a transformation that would take points in the modifier's space and convert them into world space points. This is constructed as the node's transformation matrix times the inverse of the ModContext's transformation matrix. The node whose transformation is used is the node the user clicked on in the scene - modifiers can be instanced so there could be more than one node.
tmAxis The matrix that represents the axis system. This is the space in which the transformation is taking place.
val This value is a vector with X, Y, and Z representing the movement along each axis.
localOrigin When TRUE the transformation is occurring about the sub-object's local origin.

Reimplemented from BaseObject.

CoreExport void Rotate ( TimeValue  t,
Matrix3 partm,
Matrix3 tmAxis,
Quat val,
BOOL  localOrigin = FALSE 
) [virtual]

When this method is called the plug-in should respond by rotating its selected sub-object components.

Parameters:
t The time of the transformation.
partm The 'parent' transformation matrix. This matrix represents a transformation that would take points in the modifier's space and convert them into world space points. This is constructed as the node's transformation matrix times the inverse of the ModContext's transformation matrix. The node whose transformation is used is the node the user clicked on in the scene - modifiers can be instanced so there could be more than one node.
tmAxis The matrix that represents the axis system. This is the space in which the transformation is taking place.
val The amount to rotate the selected components.
localOrigin When TRUE the transformation is occurring about the sub-object's local origin. Note: This information may be passed onto a transform controller (if there is one) so they may avoid generating 0 valued position keys for rotation and scales. For example if the user is rotating an item about anything other than its local origin then it will have to translate in addition to rotating to achieve the result. If a user creates an object, turns on the animate button, and rotates the object about the world origin, and then plays back the animation, the object does not do what the was done interactively. The object ends up in the same position, but it does so by both moving and rotating. Therefore both a position and a rotation key are created. If the user performs a rotation about the local origin however there is no need to create a position key since the object didn't move (it only rotated). So a transform controller can use this information to avoid generating 0 valued position keys for rotation and scales.

Reimplemented from BaseObject.

CoreExport void Scale ( TimeValue  t,
Matrix3 partm,
Matrix3 tmAxis,
Point3 val,
BOOL  localOrigin = FALSE 
) [virtual]

When this method is called the plug-in should respond by scaling its selected sub-object components.

Parameters:
t The time of the transformation.
partm The 'parent' transformation matrix. This matrix represents a transformation that would take points in the modifier's space and convert them into world space points. This is constructed as the node's transformation matrix times the inverse of the ModContext's transformation matrix. The node whose transformation is used is the node the user clicked on in the scene - modifiers can be instanced so there could be more than one node.
tmAxis The matrix that represents the axis system. This is the space in which the transformation is taking place.
val This value is a vector with X, Y, and Z representing the scale along X, Y, and Z respectively.
localOrigin When TRUE the transformation is occurring about the sub-object's local origin. See the note above in the Rotate method. The following methods may be used to receive notification about the starting and ending phases of transforming the item when in sub-object selection.

Reimplemented from BaseObject.

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 MSPluginSimpleMod, and MSSimpleModXtnd.

{return 3;}
CoreExport RefTargetHandle GetReference ( int  i ) [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 SimpleMod2, MSPluginSimpleMod, and MSSimpleModXtnd.

virtual CoreExport void SetReference ( int  i,
RefTargetHandle  rtarg 
) [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 SimpleMod2, MSPluginSimpleMod, and MSSimpleModXtnd.

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 MSPluginSimpleMod, and MSSimpleModXtnd.

{return 3;}
CoreExport Animatable* SubAnim ( int  i ) [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 SimpleMod2, MSPluginSimpleMod, and MSSimpleModXtnd.

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 MSPluginSimpleMod, and MSSimpleModXtnd.

CoreExport int SubNumToRefNum ( int  subNum ) [virtual]
Remarks:
This method is used for copying and pasting in the track view. It converts an anim index to a reference index or returns -1 if there is no correspondence. If a client does not wish an anim to be copied or pasted then it can return -1 even if there is a corresponding reference num.
Parameters:
subNum The anim index to return the corresponding reference index of.
Default Implementation:
{ return -1}
Returns:
The reference index corresponding to the anim index passed. Return -1 if there is no correspondence.

Reimplemented from Animatable.

CoreExport BOOL AssignController ( Animatable control,
int  subAnim 
) [virtual]
Remarks:
This method is called to assign the controller to the sub-anim whose index is passed.
Parameters:
control The controller to assign.
subAnim The index of the sub-anim to assign the controller to.
Default Implementation:
{ return FALSE; }
Returns:
Returns TRUE if the controller was assigned; otherwise FALSE.

Reimplemented from Animatable.

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

CreateMouseCallBack* GetCreateMouseCallBack ( ) [inline, virtual]

This method allows the system to retrieve a callback object used in creating an object in the 3D viewports.

This method returns a pointer to an instance of a class derived from CreateMouseCallBack. This class has a method proc() which is where the programmer defines the user/mouse interaction during the object creation phase.

Returns:
A pointer to an instance of a class derived from CreateMouseCallBack.

Implements BaseObject.

Reimplemented in MSSimpleModXtnd.

{return NULL;} 
CoreExport void ActivateSubobjSel ( int  level,
XFormModes modes 
) [virtual]

When the user changes the selection of the sub-object drop down, this method is called to notify the plug-in.

This method should provide instances of a class derived from CommandMode to support move, rotate, non-uniform scale, uniform scale, and squash modes. These modes replace their object mode counterparts however the user still uses the move/rotate/scale tool buttons in the toolbar to activate them. If a certain level of sub-object selection does not support one or more of the modes NULL may be passed. If NULL is specified the corresponding toolbar button will be grayed out.

Parameters:
level The sub-object selection level the command modes should be set to support. A level of 0 indicates object level selection. If level is greater than or equal to 1 the index refers to the types registered by the object in the order they appeared in the list when registered by Interface::RegisterSubObjectTypes(). See Class Interface.
modes The command modes to support
Sample Code:
    void SimpleMod::ActivateSubobjSel(int level, XFormModes& modes)
    {
        switch ( level ) {
            case 1:                                   // Modifier box
                modes = XFormModes(moveMode,rotMode,nuscaleMode,uscaleMode,squashMode,NULL);
                break;
            case 2:                                   // Modifier Center
                modes = XFormModes(moveMode,NULL,NULL,NULL,NULL,NULL);
                break;
        }
        NotifyDependents(FOREVER,PART_DISPLAY,REFMSG_CHANGE);
    }
See also:
Class XFormModes.

Reimplemented from BaseObject.

CoreExport void SimpleModClone ( SimpleMod smodSource )
CoreExport void SimpleModClone ( SimpleMod smodSource,
RemapDir remap 
)
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 MSPluginSimpleMod, and MSSimpleModXtnd.

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 MSPluginSimpleMod, and MSSimpleModXtnd.

virtual Deformer& GetDeformer ( TimeValue  t,
ModContext mc,
Matrix3 mat,
Matrix3 invmat 
) [pure virtual]
Remarks:
This method is used to retrieve the callback object that will handle the deformation.
Parameters:
TimeValue t

Specifies the time the modification is being performed.

ModContext &mc

A reference to the ModContext.

Matrix3& mat

A reference to a matrix that describes the space the modification is supposed to happen in. This is computed from the ModContext matrix and the controllers controlling the gizmo and center of the modifier. The plug-in developers job is simply to transform each point to be deformed by this matrix before it performs its own deformation to the point. After the modifier applies its own deformation to the point, the developer transforms the point by the inverse of this matrix (passed below).

Matrix3& invmat

This is the inverse of the matrix above. See the comment above for how this is used.
Returns:
A C++ reference to the deformer callback object.

Implemented in MSPluginSimpleMod, and MSSimpleModXtnd.

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

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 MSPluginSimpleMod, and MSSimpleModXtnd.

{}
virtual Interval GetValidity ( TimeValue  t ) [inline, virtual]
Remarks:
The SimpleMod class calls this method to retrieve the validity interval of the modifier. The modifier provides this interval by starting an interval at FOREVER and intersecting it with each of its parameters validity intervals.
Parameters:
TimeValue t

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

See also:
The Advanced Topics section on Intervals.

Reimplemented in MSPluginSimpleMod, and MSSimpleModXtnd.

{return FOREVER;}
virtual ParamDimension* GetParameterDim ( int  pbIndex ) [inline, virtual]
Remarks:
Returns the dimension of the parameter whose index is passed. See Class ParamDimension.
Parameters:
int pbIndex

The index of the parameter.
Default Implementation:
{return defaultDim;}
Returns:
A pointer to the dimension of the parameter.
{return defaultDim;}
virtual MSTR GetParameterName ( int  pbIndex ) [inline, virtual]
Remarks:
Returns the name of the parameter whose index is passed.
Parameters:
int pbIndex

Index of the parameter.
Default Implementation:
{return MSTR(_M("Parameter"));}
Returns:
The name of the parameter.
{return MSTR(_M("Parameter"));}
virtual BOOL GetModLimits ( TimeValue  t,
float &  zmin,
float &  zmax,
int &  axis 
) [inline, virtual]
Remarks:
If the effect can be limited (like the way bend/taper/twist/etc. can be limited) then it should specify the min and max limits and the axis that it is limited along. SimpleMod will then display the limits as part of the Gizmo. If it does not support limits then it should return FALSE or simply not implement this method.
Parameters:
TimeValue t

The time to get the limits.

float &zmin

The min limit.

float &zmax

The max limit.

int &axis

The axis that it is limited along: x=0, y=1, z=2.
Returns:
TRUE if limits are supported; otherwise FALSE.
Default Implementation:
{return FALSE;}

Reimplemented in MSPluginSimpleMod, and MSSimpleModXtnd.

{return FALSE;}
CoreExport int NumSubObjTypes ( ) [virtual]

Objects and modifiers that support subobjects have to overwrite this method - as well as GetSubObjType() - and return a class derived from ISubObjType in GetSubObjType().

Developers can use the GenSubObjType for convenience. If the parameter passed into GetSubObjType is -1, the system requests a ISubObjType, for the current SubObjectLevel that flows up the modifier stack. If the subobject selection of the modifier or base object does not affect the subobj selection that flows up the stack, the method must return NULL. See meshsel.cpp for a sample implementation.

Returns:
The number of sub-object types supported by the object or modifier.

Reimplemented from BaseObject.

CoreExport ISubObjType* GetSubObjType ( int  i ) [virtual]

Returns a pointer to the sub-object type for the sub-object whose index is passed.

If the parameter i passed is -1 the system requests an ISubObjType for the current SubObjectLevel that flows up the modifier stack. If the subobject selection of the modifier or base object does not affect the sub-object selection that flows up the stack NULL must be returned. See the sample code in /MAXSDK/SAMPLES/MODIFIERS/MESHSEL.CPP.

Parameters:
i The zero based index of the sub-object type to get. See the remarks above.
Returns:
The sub-object type. See Class ISubObjType.

Reimplemented from BaseObject.


Member Data Documentation

CoreExport IObjParam* ip [static]
SimpleMod* editMod [static]

SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod
SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod SimpleMod