Public Member Functions | Static Public Member Functions | Protected Member Functions

MPxToolCommand Class Reference

This reference page is linked to from the following overview topics: MPxToolCommand, Using the Maya Python API, Appendix D: Frequently asked questions.


Search for all occurrences

Detailed Description

Base class for interactive tool commands.

This is the base class for interactive tool commands.

An interactive tool command is a command that can be invoked as a MEL command or from within a user defined context (see MPxContext).

Tool commands have the same functionality as MPxCommands, but include several additional methods for use in interactive contexts: setUpInteractive, cancel, finalize, and doFinalize.

Examples:

helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.

#include <MPxToolCommand.h>

Inheritance diagram for MPxToolCommand:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 MPxToolCommand ()
 Class constructor.
virtual ~MPxToolCommand ()
 Class Destructor.
virtual MStatus doIt (const MArgList &args)=0
 This method should perform a command by setting up internal class data and then calling the redoIt method.
virtual MStatus cancel ()
 This method cancels the command.
virtual MStatus finalize ()
 This method is used to create a string representing the command and its arguments.

Static Public Member Functions

static const char * className ()
 Returns the name of this class.

Protected Member Functions

MStatus doFinalize (MArgList &command)
 USE _doFinalize() IN SCRIPT.

Constructor & Destructor Documentation

Class constructor.

This constructor should only be called from within a user context that uses this tool.

The context is responsible for setting up the internal state variables for the derived tools and for creating a command string for journalling.

~MPxToolCommand ( ) [virtual]

Class Destructor.

The user can override this method to free up any allocated data within the derived MPxToolCommand class.


Member Function Documentation

virtual MStatus doIt ( const MArgList args) [pure virtual]

This method should perform a command by setting up internal class data and then calling the redoIt method.

The actual action performed by the command should be done in the redoIt method. This is a pure virtual method, and must be overridden in derived classes.

Parameters:
[in]argsList of arguments passed to the command.
Returns:
Status code
Status Codes:

Reimplemented from MPxCommand.

Examples:
helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.
MStatus cancel ( ) [virtual]

This method cancels the command.

The user should override this method when the original program state needs to be restored.

Returns:
Status code
Status Codes:
MStatus finalize ( ) [virtual]

This method is used to create a string representing the command and its arguments.

Users should override this method and contruct an MArgList and then pass it to doFinalize for journalling.

Returns:
Status code
Status Codes:
Examples:
helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

Reimplemented from MPxCommand.

MStatus doFinalize ( MArgList command) [protected]

USE _doFinalize() IN SCRIPT.

Call this method with an MArgList representing your command.

This method will register the command with the undo manager for journalling.

Parameters:
[in]commandAn MArgList reference representing an equivalent MEL command
Returns:
Status code
Status Codes:
Examples:
helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.

MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand
MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand MPxToolCommand