Class SimpleWSMObject

3DS Max Plug-In SDK

Class SimpleWSMObject

See Also: Class WSMObject, Class IParamBlock, Class Mesh, Class Interval.

class SimpleWSMObject : public WSMObject

Description:

This is the base class for creating space warp objects. This class implements many of the methods required to create a space warp object. The only limitation for a space warp object using SimpleWSMObject 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 SimpleWSMObject must use these same data members. These are listed below:

public:

IParamBlock *pblock;

Pointer to a parameter block. Clients of SimpleWSMObject should use this pointer when the pblock reference is created.

Mesh mesh;

The mesh object that is built by BuildMesh().

Interval ivalid;

The validity interval of the mesh.

Methods:

Space warp object plug-ins which subclass off SimpleWSMObject must implement these methods. The default implementations are noted.

Prototype:

virtual void BuildMesh(TimeValue t)=0;

Remarks:

Implemented by the Plug-In.

This method is called to build the mesh representation of the object using its parameter settings at the time passed.

Parameters:

TimeValue t

The time at which to build the mesh.

Prototype:

virtual ParamDimension *GetParameterDim(int pbIndex)

Remarks:

Implemented by the Plug-In.

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.

Return Value:

Pointer to a ParamDimension.

Example:

return stdNormalizedDim;

Default Implementation:

The default implementation returns defaultDim.

See Also: ParamDimension

Prototype:

virtual TSTR GetParameterName(int pbIndex)

Remarks:

Implemented by the Plug-In.

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.

Return Value:

The name of the parameter.

Default Implementation:

The default implementation returns TSTR(_T("Parameter"))

Prototype:

virtual void InvalidateUI()

Remarks:

Implemented by the Plug-In.

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

(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 );

Prototype:

virtual BOOL OKtoDisplay(TimeValue t)

Remarks:

Implemented by the Plug-In.

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; }

Return Value:

TRUE if the object may be displayed; otherwise FALSE.