C++ API Reference
MCommandResult Class Reference

Result returned from executing a command. More...

#include <MCommandResult.h>

Public Types

enum  Type {
  kInvalid = 0, kInt, kInt64, kIntArray,
  kInt64Array, kDouble, kDoubleArray, kString,
  kStringArray, kVector, kVectorArray, kMatrix,
  kMatrixArray
}
 The types of results that MEL commands can return. More...
 

Public Member Functions

 MCommandResult (MStatus *ReturnStatus=NULL)
 Constructor for MCommandResult. More...
 
virtual ~MCommandResult ()
 Destructor for MCommandResult.
 
Type resultType (MStatus *ReturnStatus=NULL) const
 Returns the type of the result. More...
 
MStatus getResult (int &result) const
 Retrieves an integer result as a 32-bit int. More...
 
MStatus getResult (MInt64 &result) const
 Retrieves an integer command result as a 64-bit int. More...
 
MStatus getResult (MIntArray &result) const
 Retrieves the command result which is an int array. More...
 
MStatus getResult (MInt64Array &result) const
 Retrieves the command result which is an MInt64Array. More...
 
MStatus getResult (double &result) const
 Retrieves the command result which is a double. More...
 
MStatus getResult (MDoubleArray &result) const
 Retrieves the command result which is a double array. More...
 
MString stringResult (MStatus *ReturnResult=NULL) const
 Retrieves the command result which is a string. More...
 
MStatus getResult (MString &result) const
 NO SCRIPT SUPPORT. More...
 
MStatus getResult (MStringArray &result) const
 Retrieves the command result which is a string array. More...
 
MStatus getResult (MVector &result) const
 Retrieves the command result which is a vector. More...
 
MStatus getResult (MVectorArray &result) const
 Retrieves the command result which is a vector array. More...
 
MStatus getResult (MDoubleArray &result, int &numRows, int &numColumns) const
 Retrieves the command result which is a matrix. More...
 

Static Public Member Functions

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

Detailed Description

Result returned from executing a command.

MCommandResult collects the result returned by MGlobal::executeCommand. It can either be an int or an array of int or a double or an array of double or a string or an array of string. Use resultType to find out its type and use the appropriate getResult method to retrieve the result.

Examples:
atomImportExport/atomNodeNameReplacer.cpp, and viewImageBlitOverride/viewImageBlitOverrideMain.cpp.

Member Enumeration Documentation

enum Type

The types of results that MEL commands can return.

Enumerator
kInvalid 

 

kInt 

 

kInt64 

 

kIntArray 

 

kInt64Array 

 

kDouble 

 

kDoubleArray 

 

kString 

 

kStringArray 

 

kVector 

 

kVectorArray 

 

kMatrix 

 

kMatrixArray 

 

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MCommandResult ( MStatus ReturnStatus = NULL)

Constructor for MCommandResult.

Parameters
[out]ReturnStatusStatus code

Member Function Documentation

MStatus getResult ( int &  result) const

Retrieves an integer result as a 32-bit int.

Results too big to fit in a 32-bit int will be truncated to their least significant 32 bits.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
Examples:
atomImportExport/atomNodeNameReplacer.cpp, and viewImageBlitOverride/viewImageBlitOverrideMain.cpp.
MStatus getResult ( MInt64 &  result) const

Retrieves an integer command result as a 64-bit int.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MIntArray result) const

Retrieves the command result which is an int array.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MInt64Array result) const

Retrieves the command result which is an MInt64Array.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( double &  result) const

Retrieves the command result which is a double.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MDoubleArray result) const

Retrieves the command result which is a double array.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MString stringResult ( MStatus ReturnStatus = NULL) const

Retrieves the command result which is a string.

Parameters
[out]ReturnStatusOptional status code. See below.
Returns
The command result
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MString result) const

NO SCRIPT SUPPORT.

Retrieves the command result which is a string.

Python Notes

This method is not supported in Python. See the stringResult function which returns a string.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MStringArray result) const

Retrieves the command result which is a string array.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MVector result) const

Retrieves the command result which is a vector.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MVectorArray result) const

Retrieves the command result which is a vector array.

Parameters
[out]resultStorage for the command result
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
MStatus getResult ( MDoubleArray result,
int &  numRows,
int &  numColumns 
) const

Retrieves the command result which is a matrix.

Parameters
[out]resultStorage for the content of the matrix (row-based)
[out]numRowsThe number of rows in the matrix
[out]numColumnsThe number of columns in the matrix
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

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