This reference page is linked to from the following overview topics: Modifier Plug-ins, Handling Requests for Interfaces, Plug-in Architecture, Plug-in Base Classes, Modeling, Pipeline Overview, Objects Flowing through the Pipeline, Modifier Channels, Geometry Modifiers, Material Modifiers, Selection Modifiers, Simple Modifiers, Topology Modifiers, Whole Object Modifiers, Modifier Compatible Types, Validity Intervals, World-Space Modifiers, Indicating Required Input Object Types, Indicating Changed Channels, Performing Object Modification, Sub-Object Selection in Edit Modifiers, Improving Modifier Responsiveness, World Space Modifier Plug-in Overview.
This is the class from which you may derive Object Space and Space Warp (World Space) Modifier plug-ins.
This class is subclassed off of BaseObject so the modifier can put up a graphical representation in the viewport to use as a gizmo.
#include <object.h>
Public Member Functions |
|
CoreExport | Modifier () |
CoreExport | ~Modifier () |
virtual CoreExport MSTR | GetName () |
Implemented by the System. |
|
virtual CoreExport void | SetName (MSTR n) |
Implemented by the System. |
|
SClass_ID | SuperClassID () |
Retrieves a constant representing the type
of the plugin. |
|
void | DisableModApps () |
This method is used internally. |
|
void | EnableModApps () |
This method is used internally. |
|
void | DisableMod () |
Implemented by the System. |
|
void | EnableMod () |
Implemented by the System. |
|
int | IsEnabled () |
Implemented by the System. |
|
void | DisableModInViews () |
Implemented by the System. |
|
void | EnableModInViews () |
Implemented by the System. |
|
int | IsEnabledInViews () |
Implemented by the System. |
|
void | DisableModInRender () |
Implemented by the System. |
|
void | EnableModInRender () |
Implemented by the System. |
|
int | IsEnabledInRender () |
Implemented by the System. |
|
virtual CoreExport Interval | LocalValidity (TimeValue t) |
This method returns the validity interval of
a modifier. |
|
virtual ChannelMask | ChannelsUsed ()=0 |
These are channels that the modifier needs
in order to perform its modification. |
|
virtual ChannelMask | ChannelsChanged ()=0 |
These are the channels that the modifier
actually modifies. |
|
virtual void | NotifyInputChanged (Interval changeInt, PartID partID, RefMessage message, ModContext *mc) |
This method is called when an item in the
modifier stack before this modifier sends a
REFMSG_CHANGE message via NotifyDependents().
|
|
virtual bool | ChangesSelType () |
If a modifier want to make it possible to
sitch dynamically between changing the selection type that flows up
the stack, or leaving it like it is, it can overwrite this.
|
|
CoreExport ChannelMask | TotalChannelsUsed () |
Returns the same value as
ChannelsUsed() above except GFX_DATA_CHANNEL will be ORed in if
the TOPO_CHANNEL or the TEXMAP_CHANNEL are being used. |
|
CoreExport ChannelMask | TotalChannelsChanged () |
Returns the same value as ChannelsChanged()
above except GFX_DATA_CHANNEL will be ORed in if the TOPO_CHANNEL,
the TEXMAP_CHANNEL , or the VERTCOLOR_CHANNEL are being changed.
|
|
virtual void | ModifyObject (TimeValue t, ModContext &mc, ObjectState *os, INode *node)=0 |
This is the method that actually modifies
the input object. |
|
virtual int | NeedUseSubselButton () |
This method is no longer used. |
|
virtual BOOL | DependOnTopology (ModContext &mc) |
Modifiers that place a dependency on
topology should return TRUE for this method. |
|
virtual Class_ID | InputType ()=0 |
This is the type of object that the modifier
knows how to modify. |
|
virtual void | ForceNotify (Interval &i) |
virtual IOResult | SaveLocalData (ISave *isave, LocalModData *ld) |
When a 3ds Max file is being saved, this
method is called so that the modifier can save the localData
structure that is hung off each
ModContext. |
|
virtual IOResult | LoadLocalData (ILoad *iload, LocalModData **pld) |
When a 3ds Max file is being loaded, this
method is called so that the modifier can load the LocalModData
structure that is hung off each
ModContext. |
|
CoreExport IOResult | Save (ISave *isave) |
Implemented by the System. |
|
CoreExport IOResult | Load (ILoad *iload) |
Implemented by the System. |
|
CoreExport void | EnumModContexts (ModContextEnumProc *proc) |
Implemented by the System. |
|
CoreExport void | GetIDerivedObject (ModContext *mc, IDerivedObject *&derObj, int &modIndex) |
This method will retrieve the IDerivedObject and index of
this modifier for a given modifier context. |
|
virtual CoreExport void | CopyAdditionalChannels (Object *fromObj, Object *toObj) |
In case the modifier changes the object type
(basically the os->obj pointer in ModifyObject) *and* changes
the ExtensionChannel, it has to overwrite this method and copy only
the channels that it doesn't modify/added already to the new
object. |
|
CoreExport SvGraphNodeReference | SvTraverseAnimGraph (IGraphObjectManager *gom, Animatable *owner, int id, DWORD flags) |
CoreExport MSTR | SvGetName (IGraphObjectManager *gom, IGraphNode *gNode, bool isBeingEdited) |
CoreExport bool | SvCanSetName (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvSetName (IGraphObjectManager *gom, IGraphNode *gNode, MSTR &name) |
CoreExport bool | SvHandleDoubleClick (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport COLORREF | SvHighlightColor (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvIsSelected (IGraphObjectManager *gom, IGraphNode *gNode) |
Returns true if the object is selected in
its schematic view. |
|
CoreExport MultiSelectCallback * | SvGetMultiSelectCallback (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvCanSelect (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvCanInitiateLink (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvCanConcludeLink (IGraphObjectManager *gom, IGraphNode *gNode, IGraphNode *gNodeChild) |
CoreExport bool | SvLinkChild (IGraphObjectManager *gom, IGraphNode *gNodeThis, IGraphNode *gNodeChild) |
CoreExport bool | SvCanRemoveThis (IGraphObjectManager *gom, IGraphNode *gNode) |
CoreExport bool | SvRemoveThis (IGraphObjectManager *gom, IGraphNode *gNode) |
Called when the user deletes this object in
the schematic view... |
|
Friends |
|
class | ModNameRestore |
CoreExport Modifier | ( | ) |
CoreExport ~Modifier | ( | ) |
virtual CoreExport MSTR GetName | ( | ) | [virtual] |
virtual CoreExport void SetName | ( | MSTR | n | ) | [virtual] |
Implemented by the System.
Sets the name of the modifier to the name passed.
n | Specifies the name to set. |
SClass_ID SuperClassID | ( | ) | [inline, virtual] |
Retrieves a constant representing the type of the plugin.
Reimplemented from ReferenceTarget.
Reimplemented in OSModifier, WSModifier, SimpleOSMToWSMMod, SimpleOSMToWSMMod2, MSPluginModifier, MSModifierXtnd, MSPluginSimpleMod, and MSSimpleModXtnd.
{ return OSM_CLASS_ID; }
void DisableModApps | ( | ) | [inline] |
This method is used internally.
{ NotifyDependents(FOREVER,PART_OBJ,REFMSG_DISABLE); }
void EnableModApps | ( | ) | [inline] |
This method is used internally.
{ NotifyDependents(FOREVER,PART_OBJ,REFMSG_ENABLE); }
void DisableMod | ( | ) | [inline] |
Implemented by the System.
This disables the modifier in the history browser (modifier stack).
{ SetAFlag(A_MOD_DISABLED); NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE),REFMSG_CHANGE); }
void EnableMod | ( | ) | [inline] |
Implemented by the System.
This enables the modifier in the history browser (modifier stack).
{ ClearAFlag(A_MOD_DISABLED); NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); }
int IsEnabled | ( | ) | [inline] |
Implemented by the System.
This returns the status (enabled or disabled) of the modifier in the history browser.
{ return !TestAFlag(A_MOD_DISABLED); }
void DisableModInViews | ( | ) | [inline] |
Implemented by the System.
Disables the modifier in the viewports (it remains active in the renderer unless DisableMod() above is used).
{ SetAFlag(A_MOD_DISABLED_INVIEWS); NotifyDependents(FOREVER, (PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); }
void EnableModInViews | ( | ) | [inline] |
Implemented by the System.
Enables the modifier in the viewports.
{ ClearAFlag(A_MOD_DISABLED_INVIEWS); NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); }
int IsEnabledInViews | ( | ) | [inline] |
Implemented by the System.
Returns nonzero if the modifier is enabled in the view ports; otherwise zero.
{ return !TestAFlag(A_MOD_DISABLED_INVIEWS); }
void DisableModInRender | ( | ) | [inline] |
Implemented by the System.
This turns off the modifier in the renderer
{ SetAFlag(A_MOD_DISABLED_INRENDER); NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); }
void EnableModInRender | ( | ) | [inline] |
Implemented by the System.
This turns on the modifier in the renderer
{ ClearAFlag(A_MOD_DISABLED_INRENDER); NotifyDependents(FOREVER,(PartID)(PART_ALL|PART_OBJECT_TYPE), REFMSG_CHANGE); }
int IsEnabledInRender | ( | ) | [inline] |
Implemented by the System.
This returns the status (enabled or disabled) of the modifier in the renderer.
{ return !TestAFlag(A_MOD_DISABLED_INRENDER); }
virtual 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.
NotifyDependents(FOREVER, PART_ALL, REFMSG_CHANGE);
t | The time to calculate the Interval. |
Reimplemented in SimpleMod, SimpleWSMMod, MSPluginModifier, and MSModifierXtnd.
virtual ChannelMask ChannelsUsed | ( | ) | [pure 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.
{ return GEOM_CHANNEL|TOPO_CHANNEL; }
Implemented in SimpleMod, SimpleWSMMod, MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
virtual ChannelMask ChannelsChanged | ( | ) | [pure 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.
Implemented in SimpleMod, SimpleWSMMod, MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
virtual void NotifyInputChanged | ( | Interval | changeInt, |
PartID | partID, | ||
RefMessage | message, | ||
ModContext * | mc | ||
) | [inline, virtual] |
This method is called when an item in the modifier stack before this modifier sends a REFMSG_CHANGE message via NotifyDependents().
Consider the following example: Assume the modifier stack contains a Sphere Object, then a Bend, then a Edit Mesh. The Edit Mesh modifier does not have a reference to the Bend or the Sphere because it does not officially depend on these items. However it does depend on them in a certain sense, because it modifies the data that these items produce. So, if they change it may affect the modifier. A modifier may build a cache based on its input object. The modifier needs a way to know when to discard this cache because the input object has changed. Whenever one of the items before this modifier in the stack sends out a REFMSG_CHANGE message via NotifyDependents() to indicate it has changed this method is called. The modifier may respond in a way appropriate to it, for example by discarding its cache of the input object. It is not legal, to issue a NotifyDependent()'s in the NotifyInputChanged() method of a modifier, without checking for reentrancy. Imagine, you have an instanced modifier applied to the same object in the stack. Sending a refmsg from the NotifyInputChanged method will casue an endles loop. Simply putting a guard in, that checks for reentrancy should get rid of the problem.
changeInt | This is the interval from the message. It is reserved for future use - now it will always be FOREVER. |
partID | This is the partID from the message. |
message | This is the message sent. |
mc | The ModContext for the pipeline that changed. If a modifier is applied to multiple objects, then there are ModApps in each pipeline that it is applied to. These ModApps are pointing to the same modifier. Consider the following example: Say you apply a Bend modifier to a Sphere, a Cylinder and a Box object. There are three ModApps but only one Bend modifier. Then you go to the Sphere and adjust its Radius. This will cause NotifyInputChanged() to be called on the Bend because the Bend's input changed. However only one of its inputs changed - only the Sphere changed and not the Cylinder or the Box. Therefore NotifyInputChanged() will be called once, and the ModContext passed in will be for the Sphere's changed pipeline. It is possible that all three objects could change at the same time. If an instanced float controller was assigned to the radius, width, and height - one parameter for each object - then the controller was adjusted in the function curve editor, all three items would change. In this case NotifyInputChanged() would be called three times on the Bend. Once for each pipeline, once with each ModContext. |
Reimplemented in MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
{}
virtual bool ChangesSelType | ( | ) | [inline, virtual] |
If a modifier want to make it possible to sitch dynamically between changing the selection type that flows up the stack, or leaving it like it is, it can overwrite this.
The default implementation indicates that it changes the selection type, if the SUBSEL_TYPE_CHANNEL is part of ChannelsChanged(). Note that ChannelsChanged() can not dynamically changed for various reasons.
{ return ChannelsChanged()&SUBSEL_TYPE_CHANNEL ? true : false;}
CoreExport ChannelMask TotalChannelsUsed | ( | ) |
Returns the same value as ChannelsUsed() above except GFX_DATA_CHANNEL will be ORed in if the TOPO_CHANNEL or the TEXMAP_CHANNEL are being used.
CoreExport ChannelMask TotalChannelsChanged | ( | ) |
Returns the same value as ChannelsChanged() above except GFX_DATA_CHANNEL will be ORed in if the TOPO_CHANNEL, the TEXMAP_CHANNEL , or the VERTCOLOR_CHANNEL are being changed.
virtual void ModifyObject | ( | TimeValue | t, |
ModContext & | mc, | ||
ObjectState * | os, | ||
INode * | node | ||
) | [pure 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.
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. |
Implemented in SimpleMod, SimpleWSMMod, MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
virtual int NeedUseSubselButton | ( | ) | [inline, virtual] |
virtual BOOL DependOnTopology | ( | ModContext & | mc | ) | [inline, virtual] |
Modifiers that place a dependency on topology should return TRUE for this method.
An example would be a modifier that stores a selection set base on vertex indices. This modifier depends on the indices being intact for it to operate correctly.
mc | Reference to the ModContext. |
Reimplemented in MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
{return FALSE;}
virtual Class_ID InputType | ( | ) | [pure 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.
Implemented in SimpleMod, SimpleWSMMod, MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
virtual void ForceNotify | ( | Interval & | i | ) | [inline, virtual] |
Reimplemented from BaseObject.
{NotifyDependents(i,ChannelsChanged(),REFMSG_CHANGE );}
virtual IOResult SaveLocalData | ( | ISave * | isave, |
LocalModData * | ld | ||
) | [inline, virtual] |
When a 3ds Max file is being saved, this method is called so that the modifier can save the localData structure that is hung off each ModContext.
If the modifier doesn't store any data in the ModContext it can ignore this method.
isave | You may use this pointer to call methods of ISave to write data. |
ld | Pointer to the LocalModData for the modifier. |
Reimplemented in MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
{ return IO_OK; }
virtual IOResult LoadLocalData | ( | ILoad * | iload, |
LocalModData ** | pld | ||
) | [inline, virtual] |
When a 3ds Max file is being loaded, this method is called so that the modifier can load the LocalModData structure that is hung off each ModContext.
If the modifier doesn't store any data in the ModContext it can ignore this method.
iload | You may use this pointer to call methods of ILoad to read data. |
pld | A pointer to a pointer in the ModContext. The modifier must set this pointer to point at a new LocalModData derived class. |
Reimplemented in MSPluginModifier, MSModifierXtnd, and MSSimpleModXtnd.
{ return IO_OK; }
Implemented by the System.
This method handles saving the modifier name. This method should be called by the derived class BEFORE it saves any chunks. See the sample code below.
isave | You may use this pointer to call methods of ISave to write data. |
IOResult DispMod::Save(ISave *isave) { // First save the modifier name by calling the base class version. Modifier::Save(isave); // Then save this modifiers data. isave->BeginChunk(BMIO_CHUNK); bi.Save(isave); isave->EndChunk(); return IO_OK; }
Reimplemented from ReferenceMaker.
Reimplemented in MSPluginModifier, and MSPluginSimpleMod.
Implemented by the System.
iload | You may use this pointer to call methods of ILoad to read data. |
Reimplemented from ReferenceMaker.
Reimplemented in MSPluginModifier, and MSPluginSimpleMod.
CoreExport void EnumModContexts | ( | ModContextEnumProc * | proc | ) |
Implemented by the System.
This method will call the callback object proc method once for each application of the modifier.
proc | The callback object whose proc method is called. |
CoreExport void GetIDerivedObject | ( | ModContext * | mc, |
IDerivedObject *& | derObj, | ||
int & | modIndex | ||
) |
This method will retrieve the IDerivedObject and index of this modifier for a given modifier context.
mc | Points to the ModContext for the modifier. |
derObj | A pointer to the IDerivedObject is returned here. |
modIndex | The zero based index of the modifier in the derived object is returned here. |
virtual CoreExport void CopyAdditionalChannels | ( | Object * | fromObj, |
Object * | toObj | ||
) | [inline, virtual] |
In case the modifier changes the object type (basically the os->obj pointer in ModifyObject) *and* changes the ExtensionChannel, it has to overwrite this method and copy only the channels that it doesn't modify/added already to the new object.
fromObj | |
toObj |
{ toObj->CopyAdditionalChannels(fromObj);}
CoreExport SvGraphNodeReference SvTraverseAnimGraph | ( | IGraphObjectManager * | gom, |
Animatable * | owner, | ||
int | id, | ||
DWORD | flags | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
owner | The owning animatable. |
id | This is usually the sub-anim number (but can actually be any value the developer chooses). |
flags | See List of Schematic %View AddAnimatable Flags. |
Reimplemented from Animatable.
Reimplemented in SimpleWSMMod.
CoreExport MSTR SvGetName | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode, | ||
bool | isBeingEdited | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
isBeingEdited | TRUE if the item is being edited; FALSE if not. |
{ Animatable *owner; int subNum; MSTR name; owner = gNode->GetOwner(); subNum = gNode->GetID(); name = owner->SubAnimName(subNum); return name; }
Reimplemented from Animatable.
CoreExport bool SvCanSetName | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvSetName | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode, | ||
MSTR & | name | ||
) | [virtual] |
gom< | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
name | The new name to set. |
Reimplemented from Animatable.
CoreExport bool SvHandleDoubleClick | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to the node in the schematic view. |
Reimplemented from Animatable.
CoreExport COLORREF SvHighlightColor | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvIsSelected | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
Returns true if the object is selected in its schematic view.
Reimplemented from Animatable.
CoreExport MultiSelectCallback* SvGetMultiSelectCallback | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to the node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvCanSelect | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to the node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvCanInitiateLink | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvCanConcludeLink | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode, | ||
IGraphNode * | gNodeChild | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
gNodeChild | Points to the child node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvLinkChild | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNodeThis, | ||
IGraphNode * | gNodeChild | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNodeThis | Points to this node in the schematic view. |
gNodeChild | Points to the child node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvCanRemoveThis | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
Reimplemented from Animatable.
CoreExport bool SvRemoveThis | ( | IGraphObjectManager * | gom, |
IGraphNode * | gNode | ||
) | [virtual] |
Called when the user deletes this object in the schematic view...
gom | Points to the schematic view window manager. |
gNode | Points to this node in the schematic view. |
Reimplemented from Animatable.
friend class ModNameRestore
[friend] |