Class UtilityObj

3DS Max Plug-In SDK

Class UtilityObj

See Also: Class Interface, Class IUtil.

class UtilityObj

Description:

3ds max utility plug-ins are derived from this class. Methods are provided for editing the utilities parameters and responding to changes in the current selection set. An interface pointer is provided for calling the utility methods provided by MAX.

Note: Utility plug-ins are not a direct participant in the geometry pipeline system of 3ds max in the same way modifiers or space warps are. For this reason, UtilityObj plug-ins are not suitable for modifying objects flowing down the pipeline. Use Modifier or WSModifier plug-ins for this purpose.

Also note: It is possible to create a utility plug-in that uses a modeless dialog box. When 3ds max itself uses modeless dialogs, it disables input to the other open windows such as the Track View, the Materials Editor, etc. In this way, the user cannot perform some action that could disturb the operation of the modeless dialog. For example using Track View, a user could assign a different controller to a node, and a utility plug-in might be accessing keys from the node's previous controller. Since utility plug-ins cannot currently prevent the user from operating these other parts of MAX, developers need to be careful about the use of modeless dialogs.

Methods:

Prototype:

virtual void BeginEditParams(Interface *ip,IUtil *iu)=0;

Remarks:

Implemented by the Plug-In.

This method is called when the utility plug-in may be used in the Utility branch of the command panel. The plug-in may add rollup pages to the command panel in this method for example.

Parameters:

Interface *ip

An interface pointer you may use to call methods of the Interface class.

IUtil *iu

An interface pointer you may use to close the current utility in the command panel.

Prototype:

virtual void EndEditParams(Interface *ip,IUtil *iu)=0;

Remarks:

Implemented by the Plug-In.

This method is called when the utility plug-in is done being used in the Utility branch of the command panel (for example if the user changes to the Create branch).

Parameters:

Interface *ip

An interface pointer you may use to call methods of the Interface class.

IUtil *iu

An interface pointer you may use to close the current utility in the command panel.

Prototype:

virtual void SelectionSetChanged(Interface *ip,IUtil *iu);

Remarks:

Implemented by the Plug-In.

This method is called when the selection set changes. A plug-in may implement this method to respond to this condition.

Parameters:

Interface *ip

An interface pointer you may use to call methods of the Interface class.

IUtil *iu

An interface pointer you may use to close the current utility in the command panel.

Prototype:

virtual void SetStartupParam(TSTR param);

Remarks:

This method is available in release 2.0 and later only.

This method is called after BeginEditParams() when the user starts the utility from the command line with the option -U and passes an argument to the utility.

Parameters:

TSTR param

The command line argument is passed here.

Default Implementation:

{}

Prototype:

virtual void DeleteThis()=0;

Remarks:

Implemented by the Plug-In.

This method is called to delete the utility object allocated by ClassDesc::Create().

For example if the developer has used the new operator to allocate memory for their plug-in class they should implement this method as { delete this; } to delete the plug-in object.

In some cases it may be better to use a single static instance of the plug-in class and not allocate and deallocate memory. For example some of the sample utility plug-ins use a single static instance of their plug-in class. This is done so that if the user moves between branches in the command panel (goes into the Create branch and then returns to the Utility branch) all the utility plug-in parameters remain intact. If the memory was allocated and deallocated each time the parameter would be 'forgotten'. The samples that use a single static instance implement this method as {} (NULL). See the sample code in \MAXSDK\SAMPLES\UTILITIES\COLCLIP.CPP for an example.