Class SimpleOSMToWSMObject

3DS Max Plug-In SDK

Class SimpleOSMToWSMObject

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

class SimpleOSMToWSMObject : public SimpleWSMObject

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 {

 public:

  BendWSM() {}

  BendWSM(BendMod *m) : SimpleOSMToWSMObject(m) {}

  void DeleteThis() { delete this; }

  SClass_ID SuperClassID() {return WSM_OBJECT_CLASS_ID;}

  Class_ID ClassID() {return BENDWSM_CLASSID;}

  TCHAR *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:

public:

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

Methods:

Prototype:

SimpleOSMToWSMObject();

Remarks:

Constructor.

Prototype:

SimpleOSMToWSMObject(SimpleMod *m);

Remarks:

Constructor.

Parameters:

SimpleMod *m

This is a pointer to the SimpleMod instance this WSM is based on.

Prototype:

Deformer &GetDecayDeformer(TimeValue t,Deformer &mdef,Point3 origin,Interval &iv);

Remarks:

Implemented by the System.

This class enhances the deformation done by the object space modifier to include a decay parameter. This allows the deformation to decay over distance. This helper method is used internally in this.