C++ API Reference
MTemplateCreateNodeCommand< CommandClass, CommandName, NodeName > Class Template Reference

Template class for undoable commands to create/delete a node. More...

#include <MTemplateCommand.h>

+ Inheritance diagram for MTemplateCreateNodeCommand< CommandClass, CommandName, NodeName >:

Public Member Functions

MStatus doIt (const MArgList &args) override
 Execution of the command. More...
 
MStatus redoIt () override
 Redo the create/delete.
 
MStatus undoIt () override
 Undo the create/delete.
 
- Public Member Functions inherited from MTemplateCommand< CommandClass, CommandName, MTemplateCreateNodeCommand_newSyntax >
bool isUndoable () const override
 Define the command as undoable.
 
- Public Member Functions inherited from MTemplateAction< CommandClass, CommandName, CommandSyntax >
 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 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...
 

Additional Inherited Members

- Public Types inherited from MPxCommand
enum  MResultType { kLong, kDouble, kString, kNoArg }
 Types of results from commands. More...
 
- Static Public Member Functions inherited from MTemplateAction< CommandClass, CommandName, CommandSyntax >
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...
 

Detailed Description

template<class CommandClass, const char * CommandName, const char * NodeName>
class MTemplateCreateNodeCommand< CommandClass, CommandName, NodeName >

Template class for undoable commands to create/delete a node.

Helper template class which make it easier to write commands to create/delete a node.

The command is tied into an MDGModifier to create a node with undo support.

Note
Only one such command per plug-in binary is allowed because MTemplateCreateNodeCommand_nodeHandle is a global variable.
Parameters:
  • CommandClass : derived from MPxCommand and used in the creator() method
  • CommandName : name of the command
  • NodeName : node that should be created
Examples:
lineManip/lineManip.cpp, pointManip/pointManip.cpp, squareScaleManip/squareScaleManip.cpp, squareScaleManipContext/squareScaleManipContext.cpp, and template/createTransformNodeTemplate/createTransformNodeTemplate.cpp.

Member Function Documentation

MStatus doIt ( const MArgList args)
inlineoverridevirtual

Execution of the command.

Parameters
[in]argscommand arguments

Reimplemented from MPxCommand.


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