C++ API Reference
|
Base class for interactive tool commands. More...
#include <MPxToolCommand.h>
Public Member Functions | |
MPxToolCommand () | |
Class constructor. More... | |
~MPxToolCommand () override | |
Class Destructor. More... | |
MStatus | doIt (const MArgList &args) override=0 |
This method should perform a command by setting up internal class data and then calling the redoIt method. More... | |
virtual MStatus | cancel () |
This method cancels the command. More... | |
virtual MStatus | finalize () |
This method is used to create a string representing the command and its arguments. More... | |
Public Member Functions inherited from MPxCommand | |
MPxCommand () | |
Constructor. | |
virtual | ~MPxCommand () |
Destructor. More... | |
virtual MStatus | undoIt () |
This method should undo the work done by the redoIt method based on the internal class data only. More... | |
virtual MStatus | redoIt () |
This method should do the actual work of the command based on the internal class data only. More... | |
virtual bool | isUndoable () const |
This method is used to specify whether or not the command is undoable. More... | |
virtual bool | hasSyntax () const |
This method specifies whether or not the command has a syntax object. More... | |
MSyntax | syntax () const |
This method is intended to be used in an MArgDataBase or MArgParser contructor when the plugin command's syntax is being initialized. More... | |
bool | isHistoryOn () const |
Returns whether history is on. More... | |
MString | commandString () const |
This method returns the command string that is associated with this command. More... | |
MStatus | setHistoryOn (bool state) |
This method specifies if history for this command is on. More... | |
MStatus | setCommandString (const MString &) |
Sets the command string that is associated with this command object. More... | |
MStatus | setUndoable (bool state) |
Deprecated in 2019.0 More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
Static Public Member Functions inherited from MPxCommand | |
static void | displayInfo (const MString &theInfo) |
This method is used to display information in the script editor. More... | |
static void | displayWarning (const MString &theWarning, bool showLineNumber=false) |
This method is used to display a warning in the script editor. More... | |
static void | displayError (const MString &theError, bool showLineNumber=false) |
This method is used to display an error in the script editor. More... | |
static void | clearResult () |
Initializes the place where results from Maya commands get stored. | |
static void | setResult (unsigned int val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (int val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (double val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (bool val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (const char *val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (const MString &val) |
This method puts the given value into the return value area for a command. More... | |
static void | setResult (const MIntArray &val) |
This method puts the given values into the return value area for a command. More... | |
static void | setResult (const MDoubleArray &val) |
This method puts the given values into the return value area for a command. More... | |
static void | setResult (const MStringArray &val) |
This method puts the given values into the return value area for a command. More... | |
static void | appendToResult (int val) |
This method will add the given value to the end of the result array of integers. More... | |
static void | appendToResult (double val) |
This method will add the given value to the end of the result array of doubles. More... | |
static void | appendToResult (bool val) |
This method will add the given value to the end of the result array of integers. More... | |
static void | appendToResult (const char *val) |
This method will add the given value to the end of the result array of strings. More... | |
static void | appendToResult (const MString &val) |
This method will add the given value to the end of the result array of strings. More... | |
static void | appendToResult (const MStringArray &val) |
This method will add the given value to the end of the result array of strings. More... | |
static bool | isCurrentResultArray () |
This method will return whether the return result for the command is an array or not. More... | |
static MResultType | currentResultType () |
This method will return the type of the current result for the command. More... | |
static MStatus | getCurrentResult (int &val) |
Not available in Python. More... | |
static MStatus | getCurrentResult (double &val) |
Not available in Python. More... | |
static MStatus | getCurrentResult (MString &val) |
Not available in Python. More... | |
static MStatus | getCurrentResult (MIntArray &val) |
This method gets the current node's result as an array of integers, if possible. More... | |
static MStatus | getCurrentResult (MDoubleArray &val) |
This method gets the current node's result as an array of doubles, if possible. More... | |
static MStatus | getCurrentResult (MStringArray &val) |
This method gets the current node's result as an array of strings, if possible. More... | |
static int | currentIntResult (MStatus *ReturnStatus=NULL) |
This method gets the current node's result as a int, if possible. More... | |
static double | currentDoubleResult (MStatus *ReturnStatus=NULL) |
This method gets the current node's result as a double, if possible. More... | |
static MString | currentStringResult (MStatus *ReturnStatus=NULL) |
This method gets the current node's result as a MString, if possible. More... | |
static const char * | className () |
Returns the name of this class. More... | |
Protected Member Functions | |
MStatus | doFinalize (MArgList &command) |
USE _doFinalize() IN SCRIPT. More... | |
Additional Inherited Members | |
Public Types inherited from MPxCommand | |
enum | MResultType { kLong, kDouble, kString, kNoArg } |
Types of results from commands. More... | |
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.
OPENMAYA_MAJOR_NAMESPACE_OPEN 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.
|
override |
Class Destructor.
The user can override this method to free up any allocated data within the derived MPxToolCommand class.
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.
[in] | args | List of arguments passed to the command. |
Reimplemented from MPxCommand.
Implemented in MPxPolyTweakUVInteractiveCommand.
|
virtual |
This method cancels the command.
The user should override this method when the original program state needs to be restored.
Reimplemented in MPxPolyTweakUVInteractiveCommand.
|
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.
Reimplemented in MPxPolyTweakUVInteractiveCommand.
|
static |
Returns the name of this class.
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.
[in] | command | An MArgList reference representing an equivalent MEL command |