class MPxContextCommand

Jump to documentation

Base class for context creation commands (OpenMayaUI) (OpenMayaMPx.py)

public members:

MPxContextCommand ()
virtual ~MPxContextCommand ()
virtual MStatus doEditFlags ()
virtual MStatus doQueryFlags ()
virtual MPxContext * makeObj ()
virtual MStatus appendSyntax ()
MStatus setResult (bool result)
MStatus setResult (int result)
MStatus setResult (double result)
MStatus setResult (const MString &result)

protected members:

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

Documentation

The base class for context creation commands.
Description

This is the base class for context creation commands.

The purpose of this command class is to create instances of user contexts derived from MPxContext, and to allow the MEL programmer to edit and query various properties of the context related to this command.

The user will derive off of this class and override the makeObj method which will be called when this command is invoked in Maya.

The context command is registered in Maya using MFnPlugin::registerContextCommand

Functions

MPxContextCommand:: MPxContextCommand ()

Description

Class constructor.

MPxContextCommand:: ~MPxContextCommand ()

Description

Class destructor.

MStatus MPxContextCommand:: doEditFlags ()

Description

This method is called when the command is called in edit mode. This method should be overridden by context 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.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxContextCommand:: doQueryFlags ()

Description

This method is called when the command is called in query mode. This method should be overridden by context 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.

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MPxContext * MPxContextCommand:: makeObj ()

Description

This function is used to instantiate a proxy context. In your derived class, declare this function:

	MPxContext * derivedClass::makeObj() {
		return new userContextClass;
	}
	

where userContextClass is derived from MPxContext.

Return Value

  • Returns a pointer to an MPxContext.

MStatus MPxContextCommand:: appendSyntax ()

Description

This method should be overridden to append syntax to the context 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".

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxContextCommand:: setResult (bool result)

Description

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

Arguments

  • result the boolean result

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxContextCommand:: setResult (int result)

Description

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

Arguments

  • result the integer result

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxContextCommand:: setResult (double result)

Description

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

Arguments

  • result the double result

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MStatus MPxContextCommand:: setResult (const MString &result)

Description

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

Arguments

  • result the string result

Return Value

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MSyntax MPxContextCommand:: syntax ( MStatus *ReturnStatus) const

Description

This method returns the syntax object of this context command. From an overridden version of the appendSyntax method you may append to the syntax object.

Arguments

  • ReturnStatus return status

Return Value

  • the syntax object

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

MArgParser MPxContextCommand:: parser ( MStatus *ReturnStatus) const

Description

This method returns the argument parser of this context command. The argument parser can be used in the overridden versions of doEditFlags and doQueryFlags to determine which flags are set.

Arguments

  • ReturnStatus return status

Return Value

  • the argument parser

Status Codes

  • MS::kSuccess operation successful
  • MS::kFailure operation failed

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright