Public Member Functions | Static Public Member Functions | Friends

MArgList Class Reference

This reference page is linked to from the following overview topics: Important plug-in features, Adding arguments, Command Arguments and Flags, MPxCommand, Flags, Differences Between Maya's C++ and Python APIs, Appendix D: Frequently asked questions.


Search for all occurrences

Detailed Description

Create and retrieve argument lists.

This class is used to create and retrieve argument lists that can be passed to API class methods that require arglists.

Do not use MArgList to parse flags for a plug-in command as the flags will not work if the command is called from Python. Use MArgParser or MArgDatabase instead.

Examples:

animFileExport.h, animFileUtils.h, animImportExport.h, animInfoCmd.cpp, apiMeshData.cpp, apiMeshData.h, blindComplexDataCmd.cpp, blindDoubleDataCmd.cpp, blindShortDataCmd.cpp, cgfxShaderCmd.cpp, cgfxShaderCmd.h, cleanPerFaceAssignmentCmd.cpp, cleanPerFaceAssignmentCmd.h, closestPointCmd.cpp, closestPointOnCurveCmd.cpp, closestPointOnCurveCmd.h, closestPointOnNurbsSurfaceCmd.cpp, closestPointOnNurbsSurfaceCmd.h, clothPaintAttrCmd.cpp, clothPaintAttrCmd.h, clusterWeightFunction.cpp, conditionTest.cpp, convertBumpCmd.cpp, convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd.cpp, createClipCmd.cpp, cvExpandCmd.cpp, cvPosCmd.cpp, dagMessageCmd.cpp, dagPoseInfoCmd.cpp, deletedMsgCmd.cpp, eventTest.cpp, exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd.cpp, fileIOMsgCmd.cpp, filteredAsciiFile.cpp, findFileTexturesCmd.cpp, findTexturesPerPolygonCmd.cpp, fluidInfoCmd.cpp, fxManagerCmd.cpp, fxManagerCmd.h, geometryCacheConverter.cpp, geometrySurfaceConstraint.cpp, geometrySurfaceConstraint.h, getAttrAffectsCmd.cpp, helix2Cmd.cpp, helixCmd.cpp, helixTool.cpp, helloCmd.cpp, helloWorldCmd.cpp, hlslShader.cpp, hlslShader.h, iffInfoCmd.cpp, iffPixelCmd.cpp, iffPpmCmd.cpp, instanceCallbackCmd.cpp, instancerListCmd.cpp, intersectCmd.cpp, intersectOnNurbsSurfaceCmd.cpp, intersectOnNurbsSurfaceCmd.h, latticeNoise.h, latticeNoiseCmd.cpp, listLightLinksCmd.cpp, listPolyHolesCmd.cpp, lockEvent.cpp, meshOpCmd.cpp, meshOpCmd.h, meshRemapCmd.cpp, meshRemapCmd.h, meshReorderCmd.cpp, meshReorderCmd.h, motionPathCmd.cpp, motionTraceCmd.cpp, moveCurveCVsCmd.cpp, moveNumericTool.cpp, moveTool.cpp, nodeCreatedCBCmd.cpp, nodeCreatedCBCmd.h, nodeInfoCmd.cpp, nodeMessageCmd.cpp, particlePathsCmd.cpp, particleSystemInfoCmd.cpp, peltOverlapCmd.cpp, pfxInfoCmd.cpp, pickCmd.cpp, pointOnMeshCmd.cpp, pointOnMeshCmd.h, polyMessageCmd.cpp, polyPrimitiveCmd.cpp, progressWindowCmd.cpp, referenceQueryCmd.cpp, renderViewInteractiveRenderCmd.cpp, renderViewRenderCmd.cpp, renderViewRenderRegionCmd.cpp, sampleCmd.cpp, sampleParticles.cpp, scanDagCmd.cpp, scanDagSyntax.cpp, spiralAnimCurveCmd.cpp, splitUVCmd.cpp, splitUVCmd.h, surfaceCreateCmd.cpp, surfaceTwistCmd.cpp, threadTestCmd.cpp, threadTestWithLocksCmd.cpp, translateCmd.cpp, undoRedoMsgCmd.cpp, userMsgCmd.cpp, viewCallbackTest.cpp, viewCaptureCmd.cpp, volumeLightCmd.cpp, whatisCmd.cpp, and zoomCameraCmd.cpp.

#include <MArgList.h>

List of all members.

Public Member Functions

 MArgList ()
 The default class constructor.
 MArgList (const MArgList &other)
 The copy constructor.
 ~MArgList ()
 The class destructor.
unsigned int length (MStatus *ReturnStatus=NULL) const
 Returns the number of arguments in the arglist.
bool asBool (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an bool.
int asInt (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an integer.
double asDouble (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as a double.
MString asString (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an MString.
MDistance asDistance (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an MDistance.
MAngle asAngle (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an MAngle.
MTime asTime (unsigned int index, MStatus *ret=NULL) const
 Return the value of the argument at a given position in the arglist as an MTime.
MVector asVector (unsigned int &index, unsigned int numElements=3, MStatus *ReturnStatus=NULL) const
 Return the value of the argument at a given position in the arglist as an MVector.
MPoint asPoint (unsigned int &index, unsigned int numElements=3, MStatus *ReturnStatus=NULL) const
 Return the value of the argument at a given position in the arglist as an MPoint.
MMatrix asMatrix (unsigned int &index, MStatus *ret=NULL) const
 Get the value of the MMatrix argument at a given position in the arglist.
MIntArray asIntArray (unsigned int &index, MStatus *ReturnStatus=NULL) const
 Get the value of the MIntArray argument at a given position in the arglist.
MDoubleArray asDoubleArray (unsigned int &index, MStatus *ReturnStatus=NULL) const
 Get the value of the MDoubleArray argument at a given position in the arglist.
const MStringArray asStringArray (unsigned int &index, MStatus *ReturnStatus=NULL) const
 Get the value of the MStringArray argument at a given position in the arglist.
MArgListoperator= (const MArgList &other)
 The assignment operator.
unsigned int flagIndex (const char *shortFlag, const char *longFlag=NULL) const
 Return the index entry of the requested flag, if it has been set.
MStatus addArg (bool arg)
 Add a new bool argument to the arglist.
MStatus addArg (int arg)
 Add a new integer argument to the arglist.
MStatus addArg (double arg)
 Add a new double argument to the arglist.
MStatus addArg (const MString &arg)
 Add a new MString argument to the arglist.
MStatus addArg (const MDistance &arg)
 Add a new MDistance argument to the arglist.
MStatus addArg (const MAngle &arg)
 Add a new MAngle argument to the arglist.
MStatus addArg (const MTime &arg)
 Add a new MTime argument to the arglist.
MStatus addArg (const MVector &arg)
 Add a new MVector argument to the arglist.
MStatus addArg (const MPoint &arg)
 Add a new MPoint argument to the arglist.
MStatus get (unsigned int index, bool &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, int &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, double &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, MString &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, MDistance &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, MAngle &ret) const
 This method is not available in Python.
MStatus get (unsigned int index, MTime &ret) const
 This method is not available in Python.
MStatus get (unsigned int &index, MVector &ret, unsigned int numElements=3) const
 This method is not available in Python.
MStatus get (unsigned int &index, MPoint &ret, unsigned int numElements=3) const
 This method is not available in Python.
MStatus get (unsigned int &index, MMatrix &ret) const
 This method is not available in Python.
MStatus get (unsigned int &index, MIntArray &ret) const
 This method is not available in Python.
MStatus get (unsigned int &index, MDoubleArray &ret) const
 This method is not available in Python.
MStatus get (unsigned int &index, MStringArray &ret) const
 This method is not available in Python.

Static Public Member Functions

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

Friends

OPENMAYA_EXPORT std::ostream & operator<< (std::ostream &os, const MArgList &args)
 This method is not available in Python.

Constructor & Destructor Documentation

MArgList ( const MArgList other)

The copy constructor.

Initialize a new arglist with the values from another arglist.

Parameters:
[in]otherthe arglist to copy from.

Member Function Documentation

unsigned int length ( MStatus ReturnStatus = NULL) const
bool asBool ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an bool.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The bool value of the indicated argument.
Status Codes:
Examples:
pointOnMeshCmd.cpp, and volumeLightCmd.cpp.
int asInt ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an integer.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The integer value of the indicated argument.
Status Codes:
Examples:
blindComplexDataCmd.cpp, fluidInfoCmd.cpp, meshOpCmd.cpp, pointOnMeshCmd.cpp, polyPrimitiveCmd.cpp, sampleCmd.cpp, sampleParticles.cpp, threadTestCmd.cpp, and threadTestWithLocksCmd.cpp.
double asDouble ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as a double.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The double value of the indicated argument.
Status Codes:
Examples:
animInfoCmd.cpp, blindComplexDataCmd.cpp, blindDoubleDataCmd.cpp, helix2Cmd.cpp, helixCmd.cpp, motionTraceCmd.cpp, moveNumericTool.cpp, moveTool.cpp, pointOnMeshCmd.cpp, sampleCmd.cpp, sampleParticles.cpp, and volumeLightCmd.cpp.
MString asString ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MString.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The MString value of the indicated argument.
Status Codes:
Examples:
animInfoCmd.cpp, cgfxShaderCmd.cpp, clothPaintAttrCmd.cpp, createClipCmd.cpp, cvPosCmd.cpp, dagPoseInfoCmd.cpp, exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd.cpp, fluidInfoCmd.cpp, geometryCacheConverter.cpp, helix2Cmd.cpp, helixCmd.cpp, helloCmd.cpp, motionTraceCmd.cpp, particleSystemInfoCmd.cpp, pfxInfoCmd.cpp, pickCmd.cpp, pointOnMeshCmd.cpp, sampleCmd.cpp, sampleParticles.cpp, scanDagCmd.cpp, viewCallbackTest.cpp, and volumeLightCmd.cpp.
MDistance asDistance ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MDistance.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The MDistance value of the indicated argument.
Status Codes:
MAngle asAngle ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MAngle.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The MAngle value of the indicated argument.
Status Codes:
MTime asTime ( unsigned int  index,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MTime.

Parameters:
[in]indexthe index of the desired argument
[out]ReturnStatusthe return status
Returns:
The MTime value of the indicated argument.
Status Codes:
MVector asVector ( unsigned int &  index,
unsigned int  numElements = 3,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MVector.

Parameters:
[in,out]indexindex of the first argument to be used as an element of the vector. On success it will be updated to point to the last argument used to build the vector (i.e. incremented by numElements-1). On failure it will be updated to point to the argument where the failure occurred.
[in]numElementsdimension of the vector to be returned. This should not exceed 3, which is the maximum number of dimensions that an MVector can hold.
[out]ReturnStatusthe return status
Returns:
The MVector value of the indicated argument.
Status Codes:
Examples:
moveNumericTool.cpp, moveTool.cpp, and translateCmd.cpp.
MPoint asPoint ( unsigned int &  index,
unsigned int  numElements = 3,
MStatus ReturnStatus = NULL 
) const

Return the value of the argument at a given position in the arglist as an MPoint.

Parameters:
[in,out]indexindex of the first argument to be used as an element of the point. On success it will be updated to point to the last argument used to build the point (i.e. incremented by numElements-1). On failure it will be updated to point to the argument where the failure occurred.
[in]numElementsdimension of the point to be returned. This should not exceed 4, which is the maximum number of dimensions that an MPoint can hold.
[out]ReturnStatusthe return status
Returns:
The MPoint value of the indicated argument.
Status Codes:
MMatrix asMatrix ( unsigned int &  index,
MStatus ret = NULL 
) const

Get the value of the MMatrix argument at a given position in the arglist.

Parameters:
[in,out]indexindex of the first argument to be used in building the matrix. On success it will be updated to point to the last argument used to build the matrix (i.e. it will be incremented by 15). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe return status
Returns:
The MMatrix value of the indicated argument.
Status Codes:
MIntArray asIntArray ( unsigned int &  index,
MStatus ReturnStatus = NULL 
) const

Get the value of the MIntArray argument at a given position in the arglist.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]ReturnStatusAPI status code
Returns:
MIntArray
MDoubleArray asDoubleArray ( unsigned int &  index,
MStatus ReturnStatus = NULL 
) const

Get the value of the MDoubleArray argument at a given position in the arglist.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]ReturnStatusAPI status code
Returns:
MDoubleArray
const MStringArray asStringArray ( unsigned int &  index,
MStatus ReturnStatus = NULL 
) const

Get the value of the MStringArray argument at a given position in the arglist.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]ReturnStatusAPI status code
Returns:
MStringArray
MArgList & operator= ( const MArgList other)

The assignment operator.

Allows assignment between MArgList instances.

Parameters:
[in]otherThe object to copy from.
unsigned int flagIndex ( const char *  shortFlag,
const char *  longFlag = NULL 
) const

Return the index entry of the requested flag, if it has been set.

Parameters:
[in]shortFlagthe short version of the flag
[in]longFlagthe int version of the flag (if any)
Returns:
The unsigned int index of the indicated argument if it has been set, kInvalidArgIndex otherwise.
MStatus addArg ( bool  arg)

Add a new bool argument to the arglist.

Parameters:
[in]argthe new bool argument
Returns:
Examples:
helixTool.cpp, moveNumericTool.cpp, and moveTool.cpp.
MStatus addArg ( int  arg)

Add a new integer argument to the arglist.

Parameters:
[in]argthe new integer argument
Returns:
MStatus addArg ( double  arg)

Add a new double argument to the arglist.

Parameters:
[in]argthe new double argument
Returns:
MStatus addArg ( const MString arg)

Add a new MString argument to the arglist.

Parameters:
[in]argthe new MString argument
Returns:
MStatus addArg ( const MDistance arg)

Add a new MDistance argument to the arglist.

Parameters:
[in]argthe new MDistance argument
Returns:
MStatus addArg ( const MAngle arg)

Add a new MAngle argument to the arglist.

Parameters:
[in]argthe new MAngle argument
Returns:
MStatus addArg ( const MTime arg)

Add a new MTime argument to the arglist.

Parameters:
[in]argthe new MTime argument
Returns:
MStatus addArg ( const MVector arg)

Add a new MVector argument to the arglist.

Parameters:
[in]argthe new MVector argument
Returns:
MStatus addArg ( const MPoint arg)

Add a new MPoint argument to the arglist.

Parameters:
[in]argthe new MPoint argument
Returns:
MStatus get ( unsigned int  index,
bool &  ret 
) const

This method is not available in Python.

Get the value of the bool argument at a given position in the arglist.

Python Notes

Use asBool() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe bool value is returned in this argument.
Returns:
Examples:
apiMeshData.cpp, closestPointCmd.cpp, convertBumpCmd.cpp, createClipCmd.cpp, cvPosCmd.cpp, dagPoseInfoCmd.cpp, exportJointClusterDataCmd.cpp, exportSkinClusterDataCmd.cpp, findFileTexturesCmd.cpp, getAttrAffectsCmd.cpp, iffInfoCmd.cpp, iffPixelCmd.cpp, iffPpmCmd.cpp, intersectCmd.cpp, latticeNoiseCmd.cpp, meshRemapCmd.cpp, meshReorderCmd.cpp, sampleCmd.cpp, undoRedoMsgCmd.cpp, viewCallbackTest.cpp, and whatisCmd.cpp.
MStatus get ( unsigned int  index,
int &  ret 
) const

This method is not available in Python.

Get the value of the integer argument at a given position in the arglist.

Python Notes

Use asInt() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe integer value is returned in this argument.
Returns:
MStatus get ( unsigned int  index,
double &  ret 
) const

This method is not available in Python.

Get the value of the double argument at a given position in the arglist.

Python Notes

Use asDouble() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe double value is returned in this argument.
Returns:
MStatus get ( unsigned int  index,
MString ret 
) const

This method is not available in Python.

Get the value of the MString argument at a given position in the arglist.

Python Notes

Use asString() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe MString value is returned in this argument.
Returns:
MStatus get ( unsigned int  index,
MDistance ret 
) const

This method is not available in Python.

Get the value of the MDistance argument at a given position in the arglist.

Python Notes

Use asDistance() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe MDistance value is returned in this argument.
Returns:
MStatus get ( unsigned int  index,
MAngle ret 
) const

This method is not available in Python.

Get the value of the MAngle argument at a given position in the arglist.

Python Notes

Use asAngle() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe MAngle value is returned in this argument.
Returns:
MStatus get ( unsigned int  index,
MTime ret 
) const

This method is not available in Python.

Get the value of the MTime argument at a given position in the arglist.

Python Notes

Use asTime() instead.

Parameters:
[in]indexthe index of the desired argument
[out]retthe MTime value is returned in this argument.
Returns:
MStatus get ( unsigned int &  index,
MVector ret,
unsigned int  numElements = 3 
) const

This method is not available in Python.

Get the value of the MVector argument at a given position in the arglist.

Python Notes

Use asVector() instead.

Parameters:
[in,out]indexindex of the first argument to be used as an element of the vector. On success it will be updated to point to the last argument used to build the vector (i.e. incremented by numElements-1). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MVector value is returned in this argument.
[in]numElementsdimension of the vector to be returned. This should not exceed 3, which is the maximum number of dimensions that an MVector can hold.
Returns:
MStatus get ( unsigned int &  index,
MPoint ret,
unsigned int  numElements = 3 
) const

This method is not available in Python.

Get the value of the MPoint argument at a given position in the arglist.

Python Notes

Use asPoint() instead.

Parameters:
[in,out]indexindex of the first argument to be used as an element of the point. On success it will be updated to point to the last argument used to build the point (i.e. incremented by numElements-1). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MPoint value is returned in this argument.
[in]numElementsdimension of the point to be returned. This should not exceed 4, which is the maximum number of dimensions that an MPoint can hold.
Returns:
MStatus get ( unsigned int &  index,
MMatrix ret 
) const

This method is not available in Python.

Get the value of the MMatrix argument at a given position in the arglist.

Python Notes

Use asMatrix() instead.

Parameters:
[in,out]indexindex of the first argument to be used in building the matrix. On success it will be updated to point to the last argument used to build the matrix (i.e. it will be incremented by 15). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MMatrix value is returned in this argument.
Returns:
MStatus get ( unsigned int &  index,
MIntArray ret 
) const

This method is not available in Python.

Get the value of the MIntArray argument at a given position in the arglist.

Python Notes

Use asIntArray() instead.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MIntArray value is returned in this argument.
Returns:
MStatus get ( unsigned int &  index,
MDoubleArray ret 
) const

This method is not available in Python.

Get the value of the MDoubleArray argument at a given position in the arglist.

Python Notes

Use asDoubleArray() instead.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MDoubleArray value is returned in this argument.
Returns:
MStatus get ( unsigned int &  index,
MStringArray ret 
) const

This method is not available in Python.

Get the value of the MStringArray argument at a given position in the arglist.

Python Notes

Use asStringArray() instead.

Parameters:
[in,out]indexindex of the first argument to be used in building the array. That argument will be taken as an integer count of the number of array elements which follow it. On success the index will be updated to point to the argument for the last array element (i.e. incremented by the number of elements). On failure it will be updated to point to the argument where the failure occurred.
[out]retthe MStringArray value is returned in this argument.
Returns:
const char * className ( ) [static]

Returns the name of this class.

Returns:
Name of this class.

Friends And Related Function Documentation

OPENMAYA_EXPORT std::ostream& operator<< ( std::ostream &  os,
const MArgList args 
) [friend]

This method is not available in Python.

The output is each string in the list, separated by spaces (and unquoted).

Parameters:
[in]osthe ostream to print to
[in]argsthe MArgList whose contents are to be printed
Returns:
The ostream reference, s, provided as the first parameter.

MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList
MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList MArgList