- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

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

# MPxToolCommand Class Reference
OpenMayaUI - API module for user interface | Proxy classes

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:
[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

MPxToolCommand | ( |  | ) |

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]`

Search for all occurrences

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] | args | List of arguments passed to the command.

Returns:
  Status code

Status Codes:
  - MS::kSuccess The command was successful
  - MS::kFailure An error occured during the command

Reimplemented from MPxCommand.

Examples:
  helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.

MStatus cancel | ( |  | ) | `[virtual]`

Search for all occurrences

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:
  - MS::kSuccess The cancel was successfull.
  - MS::kFailure Object error.

MStatus finalize | ( |  | ) | `[virtual]`

Search for all occurrences

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:
  - MS::kSuccess The finalize was successfull.
  - MS::kFailure Object error.

Examples:
  helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

Reimplemented from MPxCommand.

MStatus doFinalize | ( | MArgList & | command | ) | `[protected]`

Search for all occurrences

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] | command | An MArgList reference representing an equivalent MEL command

Returns:
  Status code

Status Codes:
  - MS::kSuccess The doFinalize was successfull.
  - MS::kFailure Object error.

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