C++ API Reference
MTemplateAction< ActionClass, CommandName, CommandSyntax > Class Template Reference

Template class for non undoable actions. More...

#include <MTemplateCommand.h>

+ Inheritance diagram for MTemplateAction< ActionClass, CommandName, CommandSyntax >:

Public Member Functions

 MTemplateAction ()
 Default constructor.
 
MStatus doIt (const MArgList &) override
 Execution of the action. Default behaviour is failure.
 
- 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)
 This method is obsolete. More...
 

Static Public Member Functions

static void * creator ()
 Method called by Maya to create an instance of this class.
 
static MStatus registerCommand (MObject obj)
 Plug-in registration method. More...
 
static MStatus deregisterCommand (MObject obj)
 Plug-in dregistration method. 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)
 This method is not available in Python. More...
 
static MStatus getCurrentResult (double &val)
 This method is not available in Python. More...
 
static MStatus getCurrentResult (MString &val)
 This method is 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...
 

Additional Inherited Members

- Public Types inherited from MPxCommand
enum  MResultType { kLong, kDouble, kString, kNoArg }
 Types of results from commands. More...
 

Detailed Description

template<class ActionClass, const char * CommandName, MCreateSyntaxFunction CommandSyntax>
class MTemplateAction< ActionClass, CommandName, CommandSyntax >

Template class for non undoable actions.

Helper template class which make writing not undoable actions easier.

Parameters:
  • ActionClass : derived from MPxCommand and used in the creator() method
  • CommandName : name of the command
  • CommandSyntax : function pointer to syntax creator
Examples:
template/helloTemplateWorld/helloTemplateWorld.cpp.

Member Function Documentation

static MStatus registerCommand ( MObject  obj)
inlinestatic

Plug-in registration method.

Parameters
[in]objPlug-in object taken from the initializePlugin() entry point.
static MStatus deregisterCommand ( MObject  obj)
inlinestatic

Plug-in dregistration method.

Parameters
[in]objPlug-in object taken from the initializePlugin() entry point.

The documentation for this class was generated from the following file: