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

MPxModelEditorCommand Class Reference

This reference page is linked to from the following overview topics: Removal of MStatus return codes from .NET API, Example Scripted Plug-ins.


Search for all occurrences

Detailed Description

Base class for editor creation commands.

MPxModelEditorCommand is the base class for user defined model editor commands. This command gives all of the flags and options of the modelEditor command in addition to any user defined flags or behaviours. When registering this command, use the MFnPlugin::MFnPlugin::registerModelEditorCommand() method. A MPx3dModelView is also required to be used with MPxModelEditorCommand and is specified when the MPxModelEditorCommand is registered.

Examples:

narrowPolyViewerCmd.cpp, and narrowPolyViewerCmd.h.

#include <MPxModelEditorCommand.h>

List of all members.

Public Member Functions

 MPxModelEditorCommand ()
 Class constructor.
virtual ~MPxModelEditorCommand ()
 Class destructor.
virtual MStatus doEditFlags ()
 This method is called when the command is called in edit mode.
virtual MStatus doQueryFlags ()
 This method is called when the command is called in query mode.
virtual MStatus appendSyntax ()
 This method should be overridden to append syntax to the panel command.
virtual bool skipFlagForCreate (const MString &longFlag)
 Returns true if the passed long flag name should be skipped during the creation portion of the command.
MStatus setResult (bool result)
 This method should be called when the result of the panel command is a boolean.
MStatus setResult (int result)
 This method should be called when the result of the panel command is an integer.
MStatus setResult (double result)
 This method should be called when the result of the panel command is a double.
MStatus setResult (const MString &result)
 This method should be called when the result of the panel command is a string.
MStatus setResult (const MStringArray &result)
 This method should be called when the result of the panel command is a string array.
MStatus setResult (const MDoubleArray &result)
 This method should be called when the result of the panel command is a double array.
MStatus setResult (const MIntArray &result)
 This method should be called when the result of the panel command is an integer array.
virtual MString editorCommandName () const
 Returns the name of editor command.
virtual MString editorMenuScriptName () const
 Returns the name of the script that should get executed to construct the menu for the editor.
virtual MPx3dModelViewmakeModelView (MStatus *ReturnStatus=NULL)
 This method is called when the modelEditor is being created and it can be overriden to allow the user to handle the allocation of the modelView directly.
MPx3dModelViewmodelView (MStatus *ReturnStatus=NULL) const
 Returns a pointer to the MPx3dModelView created by this command.

Static Public Member Functions

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

Protected Member Functions

MSyntax syntax (MStatus *ReturnStatus=NULL) const
 USE _syntax() IN SCRIPT.
MArgParser parser (MStatus *ReturnStatus=NULL) const
 USE _parser() IN SCRIPT.

Member Function Documentation

MStatus doEditFlags ( ) [virtual]

This method is called when the command is called in edit mode.

This method should be overridden by panel commands to determine which edit flags are set in conjunction with the argument parser for this command. The argument parser for this command can be obtained by calling the parser method. If the command is called with both the edit flag and the query flag, then the query flag will be ignored.

If the command returns MS::kUnknownParameter, the flag is processed by the parent class.

Returns:
Examples:
narrowPolyViewerCmd.h.
MStatus doQueryFlags ( ) [virtual]

This method is called when the command is called in query mode.

This method should be overridden by panel commands to determine which query flags are set in conjunction with the argument parser for this command. The argument parser for this command can be obtained by calling the parser method. If the command is called with both the edit flag and the query flag, then the query flag will be ignored.

If the command returns MS::kUnknownParameter, the flag is processed by the parent class.

Returns:
Examples:
narrowPolyViewerCmd.h.
MStatus appendSyntax ( ) [virtual]

This method should be overridden to append syntax to the panel command.

The syntax object can be obtained by calling the syntax method. The following flags cannot be used as user-defined flags as they are reserved for edit and query: "-e", "-edit", "-q", "-query".

Returns:
Examples:
narrowPolyViewerCmd.h.
bool skipFlagForCreate ( const MString longFlag) [virtual]

Returns true if the passed long flag name should be skipped during the creation portion of the command.

Parameters:
[in]longFlagThe string containing the long flag name.
Returns:
Return true if the flag shoiuld be skipped during creation.
Status Codes:
MStatus setResult ( bool  result)

This method should be called when the result of the panel command is a boolean.

Parameters:
[in]resultthe boolean result
Returns:
MStatus setResult ( int  result)

This method should be called when the result of the panel command is an integer.

Parameters:
[in]resultthe integer result
Returns:
MStatus setResult ( double  result)

This method should be called when the result of the panel command is a double.

Parameters:
[in]resultthe double result
Returns:
MStatus setResult ( const MString result)

This method should be called when the result of the panel command is a string.

Parameters:
[in]resultthe string result
Returns:
MStatus setResult ( const MStringArray result)

This method should be called when the result of the panel command is a string array.

Parameters:
[in]resultthe string array result
Returns:
MStatus setResult ( const MDoubleArray result)

This method should be called when the result of the panel command is a double array.

Parameters:
[in]resultthe double array result
Returns:
MStatus setResult ( const MIntArray result)

This method should be called when the result of the panel command is an integer array.

Parameters:
[in]resultthe integer array result
Returns:
MString editorCommandName ( ) const [virtual]

Returns the name of editor command.

The user should override this method to return the name of their model editor command. This method is called when the model editor is being created and is used to be able to associate this command's name with that model editor.

Currently this association is used by playblast to call the appropriate plugin model editor command to provide information for the (-cameraSetup) flag. An override for this method and an override for the doQueryFlags() method must be provided to support multiple camera rendering via playblast.

Refer the the documentation on the modelEditor command for further information about the -cameraSetup flag.

Returns:
The name of the editor command
MString editorMenuScriptName ( ) const [virtual]

Returns the name of the script that should get executed to construct the menu for the editor.

The script should take a string argument that holds the name of the created editor.

If no script is passed, the created editor will not have a menu.

Returns:
The name of the script
MPx3dModelView * makeModelView ( MStatus ReturnStatus = NULL) [virtual]

This method is called when the modelEditor is being created and it can be overriden to allow the user to handle the allocation of the modelView directly.

Also, as this method exists on MPxModelEditorCommand, the user has direct access to the command line flags in create mode for the command (an example use would be to detect that a -quadbuffer flag was passed on creating the view, and you could then bring up the panel with quadbuffering enabled).

Parameters:
[out]ReturnStatusreturn status
Status Codes:
Returns:
  • NULL - unable to create the modelView for this command.
  • pointer to modelView - modelView successfully created.
MPx3dModelView * modelView ( MStatus ReturnStatus = NULL) const

Returns a pointer to the MPx3dModelView created by this command.

If the MPx3dModelView was not created, NULL may be returned.

Parameters:
ReturnStatusreturn status
Status Codes:
Returns:
Pointer to the created MPx3dModelView
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.
Examples:
narrowPolyViewerCmd.h.
MSyntax syntax ( MStatus ReturnStatus = NULL) const [protected]

USE _syntax() IN SCRIPT.

This method returns the syntax object of this panel command.

The syntax object can be appended to in an overridden version of the appendSyntax method.

Parameters:
[out]ReturnStatusreturn status
Returns:
The syntax object
Status Codes:
MArgParser parser ( MStatus ReturnStatus = NULL) const [protected]

USE _parser() IN SCRIPT.

This method returns the argument parser of this panel command.

The argument parser can be used in the overridden versions of doEditFlags and doQueryFlags to determine which flags are set.

Parameters:
[out]ReturnStatusreturn status
Returns:
The argument parser
Status Codes:

MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand
MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand MPxModelEditorCommand