Public Member Functions

SimpleOSMToWSMMod Class Reference

Search for all occurrences

Detailed Description

See also:
Class SimpleWSMObject, Class SimpleMod, Class Deformer, Class IParamMap.

Description:
This class is used to allow any Object Space Modifer derived from SimpleMod to easily be turned into a World Space Modifier (Space Warp).

This is very simple to do because a modifier version already contains just about everything that needs to be done. This is because the modifier works the same -- it is just in world space instead of object space.

All a developer needs to do to turn their SimpleMod modifier into the WSM version is implement a class derived from this one and call the SimpleOSMTOWSMObject constructor from their constructor. See the sample code below (for the full sample code using this class see /MAXSDK/SAMPLES/MODIFIERS/BEND.CPP).

class BendWSM : public SimpleOSMToWSMObject
{
    BendWSM() {}
    BendWSM(BendMod *m) : SimpleOSMToWSMObject(m) {}
    void DeleteThis() { delete this; }
    SClass_ID SuperClassID() {return WSM_OBJECT_CLASS_ID;}
    Class_ID ClassID() {return BENDWSM_CLASSID;}
    MCHAR *GetObjectName() {return GetString(IDS_RB_BEND2);}
};
These new modifier-based space warps are accessed in the drop-down category list of the Space Warps branch of the Create command panel. Choose Modifier-Based from the list to display buttons for each of the new space warps.
Data Members:
SimpleMod *mod;

Points to the simple modifier instance this is based on.

static IParamMap *pmapParam;

Points to the parameter map used to handle the user interface for this WSM. These are the parameter block indices for the pmap:

#define PB_OSMTOWSM_LENGTH 0

#define PB_OSMTOWSM_WIDTH 1

#define PB_OSMTOWSM_HEIGHT 2

#define PB_OSMTOWSM_DECAY 3

#include <simpmod.h>

Inheritance diagram for SimpleOSMToWSMMod:
Inheritance graph
[legend]

List of all members.

Public Member Functions

CoreExport  SimpleOSMToWSMMod ()
CoreExport  SimpleOSMToWSMMod (INode *node)
void  GetClassName (MSTR &s)
  Retrieves the name of the plugin class.
SClass_ID  SuperClassID ()
  Retrieves a constant representing the type of the plugin.
Class_ID  ClassID ()
  Retrieves a constant that uniquely identifies the plugin class.
CoreExport void  DeleteThis ()
  Deletes an instance of this class.
CoreExport RefTargetHandle  Clone (RemapDir &remap)
  This method is used by 3ds Max to clone an object.
CoreExport MCHAR *  GetObjectName ()
CoreExport Deformer GetDeformer (TimeValue t, ModContext &mc, Matrix3 &mat, Matrix3 &invmat)
CoreExport Interval  GetValidity (TimeValue t)

Constructor & Destructor Documentation

CoreExport SimpleOSMToWSMMod ( )
CoreExport SimpleOSMToWSMMod ( INode node )

Member Function Documentation

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.

{s=GetObjectName();}
SClass_ID SuperClassID ( ) [inline, virtual]

Retrieves a constant representing the type of the plugin.

Returns:
A super class id that uniquely identifies the type (category) of the plugin. Note that several plugin classes can be of the same type, thus return the same super class id. Plugins are uniquely identified by their class ids. List of Super Class IDs.
See also:
SClass_ID

Reimplemented from Modifier.

{return WSM_CLASS_ID;}
Class_ID ClassID ( ) [inline, virtual]

Retrieves a constant that uniquely identifies the plugin class.

This method must return the unique ID for the plugin class. If two ClassIDs conflict, the system will only load the first conflicting one it finds. A program (gencid.exe) is provided to generate unique class id values.

Returns:
A class id that uniquely identifies a plugin class
See also:
Class ClassID, List of Class IDs.

Reimplemented from Animatable.

{return SIMPLEOSMTOWSM_CLASSID;} 
CoreExport void DeleteThis ( ) [virtual]

Deletes an instance of this class.

3ds Max calls this method when it needs to delete a plugin object (an instance of a class derived from Animatable). Similarly, plugins that need to delete instances of an Animatable or a class directly derived from it via an Animatable pointer, should call this method instead of calling directly operator delete. Following these rules will ensure that the same memory manager is used to allocate and deallocate the object. The default implementation of this method deletes the object. Plugin instances that never need to be deleted from the heap can overwrite this method to do nothing.

Note:
See the method ClassDesc::Create() for details on how Max allocates plugin objects.
See ReferenceMaker::DeleteMe() and ReferenceTarget::MaybeAutoDelete() for information on how plugin instances are deleted by the system.
Remarks:
See Memory Allocation.

See also:
Plugin DLL Functions, Class ClassDesc.

Reimplemented from Animatable.

CoreExport RefTargetHandle Clone ( RemapDir remap ) [virtual]

This method is used by 3ds Max to clone an object.

See also:
CloneRefHierarchy(), class RemapDir This method is called by 3ds Max to have the plugin clone itself. The plug-in's implementation of this method should copy both the data structure and all the data residing in the data structure of this reference target. The plugin should clone all its references as well. Also, the plug-in's implementation of this method must call BaseClone(). In order for classes derived from this class to clone cleanly, the Clone method should just create the new instance, and then call an implementation of BaseClone that clones the references and copies any other necessary data. For example:
            class MyDerivedPlugin
                : public MyBasePlugin
            {
                const int MY_REFERENCE = 1;

                ReferenceTarget* Clone(RemapDir& remap)
                {
                    ReferenceTarget* result = new MyDerivedPlugin();
                    BaseClone(this, result, remap);
                    return result;
                }

                void BaseClone(ReferenceTarget* from, ReferenceTarget* to, RemapDir& remap)
                {
                    if (!to || !from || from == to)
                        return;    
                    MyBasePlugin::BaseClone(from, to, remap);
                    to->ReplaceReference(MY_REFERENCE, remap->CloneRef(from->GetReference(MY_REFERENCE)));
                }
            };

This method should not be directly called by plug-ins. Instead, either RemapDir::CloneRef() or CloneRefHierachy() should be used to perform cloning. These methods ensure that the mapping from the original object to the clone is added to the RemapDir used for cloning, which may be used during backpatch operations

Note:
See the remarks in method BaseClone() below.
Parameters:
remap - A RemapDir instance used for remapping references during a Clone.
Returns:
A pointer to the cloned item.

Reimplemented from ReferenceTarget.

CoreExport MCHAR* GetObjectName ( ) [virtual]
Returns:
the name that will appear in the history browser (modifier stack).

Reimplemented from BaseObject.

CoreExport Deformer& GetDeformer ( TimeValue  t,
ModContext mc,
Matrix3 mat,
Matrix3 invmat 
) [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.

See also:
The Advanced Topics section on the Geometry Pipeline System.

Implements SimpleWSMMod.

CoreExport Interval GetValidity ( TimeValue  t ) [virtual]
Remarks:
The SimpleWSMMod 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 from SimpleWSMMod.


SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod
SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod SimpleOSMToWSMMod