C++ API Reference
MSelectionList Class Reference

A list of MObjects. More...

#include <MSelectionList.h>

Public Types

enum  MergeStrategy { kMergeNormal =0, kXORWithList, kRemoveFromList }
 Specifies how to merge objects with those already in the list. More...
 

Public Member Functions

 MSelectionList ()
 Class constructor. More...
 
 MSelectionList (const MSelectionList &src)
 Copy constructor. More...
 
virtual ~MSelectionList ()
 Class destructor. More...
 
MStatus clear ()
 This method empties the selection list. More...
 
bool isEmpty (MStatus *ReturnStatus=NULL) const
 Specifies whether or not the selection list contains any items. More...
 
unsigned int length (MStatus *ReturnStatus=NULL) const
 This method returns the number of selection items in the list. More...
 
MStatus getDependNode (unsigned int index, MObject &depNode) const
 Get a handle for the dependency node of the given element of the selection list. More...
 
MStatus getDagPath (unsigned int index, MDagPath &dagPath, MObject &component=MObject::kNullObj) const
 Get the dag path and component (may be NULL) of the given element of the selection list. More...
 
MStatus getPlug (unsigned int index, MPlug &plug) const
 Get the plug at the specified index of the selection list. More...
 
MStatus getPlug (unsigned int index, bool convertComponents, MPlug &plug) const
 Get the plug at the specified index of the selection list. More...
 
MStatus add (const MObject &object, const bool mergeWithExisting=false)
 Add the specified DG node to the end of the selection list. More...
 
MStatus add (const MDagPath &object, const MObject &component=MObject::kNullObj, const bool mergeWithExisting=false)
 Add the specified DG node to the end of the selection list. More...
 
MStatus add (const MString &matchString, const bool searchChildNamespacesToo=false)
 Add the specified object(s) to the selection list. More...
 
MStatus add (const MPlug &plug, const bool mergeWithExisting=false)
 Add the specified plug to the end of the selection list. More...
 
MStatus add (const MUuid &uuid, bool mergeWithExisting=false)
 Add nodes matching the UUID to the selection list. More...
 
MStatus remove (unsigned int index)
 Removes the item at the given index from the list. More...
 
MStatus replace (unsigned int index, const MObject &item)
 Remove the item at the given index in the list and replace it with the given object. More...
 
MStatus replace (unsigned int index, const MDagPath &item, const MObject &component=MObject::kNullObj)
 Remove the item at the given index in the list and replace it with the given Dag item (or components). More...
 
MStatus replace (unsigned int index, const MPlug &plug)
 Remove the item at the given index in the list and replace it with the given plug. More...
 
bool hasItem (const MObject &item, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given dependency node is in this selection list. More...
 
bool hasItem (const MDagPath &item, const MObject &component=MObject::kNullObj, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given DAG object is in this selection list. More...
 
bool hasItem (const MPlug &plug, MStatus *ReturnStatus=NULL) const
 Determines whether or not the given plug is in this selection list. More...
 
bool hasItemPartly (const MDagPath &item, const MObject &component, MStatus *ReturnStatus=NULL) const
 This method differs from hasItem in that it determines whether or not at least one of the components of the the given DAG object are in this selection list. More...
 
MStatus toggle (const MDagPath &item, const MObject &component=MObject::kNullObj)
 Removes those components of the given selection item which are on the selection list, and adds those parts which are not. More...
 
MSelectionListoperator= (const MSelectionList &other)
 Assignment operator. More...
 
MStatus merge (const MSelectionList &other, const MergeStrategy strategy=kMergeNormal)
 Merge the two selection lists. More...
 
MStatus merge (const MDagPath &object, const MObject &component=MObject::kNullObj, const MergeStrategy strategy=kMergeNormal)
 Merge the given DAG object into the selection list. More...
 
MStatus intersect (const MSelectionList &other, bool expandToLeaves=false)
 Modify this list to contain the intersection of itself and the given list. More...
 
MStatus getSelectionStrings (MStringArray &array) const
 Gets the string representations of the items in the selection list. More...
 
MStatus getSelectionStrings (unsigned int index, MStringArray &array) const
 Gets the string representation of the given item in the selection list. More...
 

Static Public Member Functions

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

Detailed Description

A list of MObjects.

This class implements a list of MObjects.

The global selection list is a special case where the objects on the list are also active objects in Maya.

Besides the usual list methods, this class also provides an add method which retrieves objects from Maya, such as dependency nodes, by name.

Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AbcWriteJob.cpp, AbcBullet/AbcWriteJob.h, AbcBullet/MayaTransformCollectionWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/AbcWriteJob.cpp, AbcExport/AbcWriteJob.h, AbcExport/MayaCameraWriter.cpp, AbcExport/MayaMeshWriter.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, animExportUtil/animExportUtil.cpp, animImportExport/animImportExport.cpp, animInfoCmd/animInfoCmd.cpp, apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshShape.h, apiMeshShape/apiMeshSubSceneOverride.cpp, atomImportExport/atomAnimLayers.cpp, atomImportExport/atomAnimLayers.h, atomImportExport/atomFileUtils.cpp, atomImportExport/atomFileUtils.h, atomImportExport/atomImportExport.cpp, atomImportExport/atomImportExport.h, atomImportExport/atomNodeNameReplacer.cpp, atomImportExport/atomNodeNameReplacer.h, blindComplexDataCmd/blindComplexDataCmd.cpp, blindDoubleDataCmd/blindDoubleDataCmd.cpp, blindShortDataCmd/blindShortDataCmd.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, cameraSetSubclass/testExCameraSetCmd.h, cgFx/cgfxAttrDef.cpp, cgFx/cgfxShaderCmd.cpp, cgFx/cgfxShaderCmd.h, cleanPerFaceAssignment/cleanPerFaceAssignmentCmd.cpp, closestPointCmd/closestPointCmd.cpp, closestPointOnCurve/closestPointOnCurveCmd.h, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, clusterWeightFunction/clusterWeightFunction.cpp, componentScaleManip/componentScaleManip.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, createClipCmd/createClipCmd.cpp, customAttrManip/customAttrManip.cpp, cvExpandCmd/cvExpandCmd.cpp, cvPosCmd/cvPosCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, dagPoseInfoCmd/dagPoseInfoCmd.cpp, deletedMsgCmd/deletedMsgCmd.cpp, dx11Shader/dx11ShaderCmd.cpp, evaluationPruningEvaluator/evaluationPruningEvaluator.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, findFileTexturesCmd/findFileTexturesCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, fluidInfoCmd/fluidInfoCmd.cpp, fragmentDumper/fragmentDumper.cpp, getAttrAffectsCmd/getAttrAffectsCmd.cpp, glslShader/GLSLShaderCmd.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheCmd.h, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheDrawOverride.h, gpuCache/gpuCacheShapeNode.cpp, gpuCache/gpuCacheShapeNode.h, gpuCache/gpuCacheSubSceneOverride.cpp, grabUVMain.cpp, helix2Cmd/helix2Cmd.cpp, hlslShader/hlslShader.cpp, hwApiTextureTest/hwApiTextureTest.cpp, ik2Bsolver/ik2Bsolver.cpp, instancerListCmd/instancerListCmd.cpp, intersectCmd/intersectCmd.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, lassoTool/lassoTool.cpp, latticeNoise/latticeNoiseCmd.cpp, lepTranslator/lepTranslator.cpp, lineManip/lineManip.cpp, lineManipContainer/lineManipContainer.cpp, listLightLinksCmd/listLightLinksCmd.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, listRichSelectionCmd/listRichSelectionCmd.cpp, lockEvent/lockEvent.cpp, manipOverride/customTriadManip.cpp, manipOverride/manipOverride.cpp, marqueeTool/marqueeTool.cpp, meshOpCmd/meshOpCmd.cpp, MetadataSample/createMetadataCmd.cpp, MetadataSample/metadataBase.cpp, motionPathCmd/motionPathCmd.cpp, motionTraceCmd/motionTraceCmd.cpp, moveCurveCVsCmd/moveCurveCVsCmd.cpp, moveManip/moveManip.cpp, moveNumericTool/moveNumericTool.cpp, moveTool/moveTool.cpp, multiPlugInfoCmd/multiPlugInfoCmd.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.cpp, nodeIconCmd/nodeIconCmd.cpp, nodeInfoCmd/nodeInfoCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, objExport/objExport.cpp, particlePathsCmd/particlePathsCmd.cpp, particleSystemInfoCmd/particleSystemInfoCmd.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pfxInfoCmd/pfxInfoCmd.cpp, pointManip/pointManip.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, polyRawExporter/polyExporter.cpp, polyX3DExporter/polyExporter.cpp, rawfootPrintNode/rawfootPrintNode.cpp, referenceQueryCmd/referenceQueryCmd.cpp, richMoveCmd/richMoveCmd.cpp, rotateManip/rotateManip.cpp, skinClusterWeights/skinClusterWeights.cpp, spiralAnimCurveCmd/spiralAnimCurveCmd.cpp, splitUVCmd/splitUVCmd.cpp, squareScaleManip/squareScaleManip.cpp, squareScaleManipContext/squareScaleManipContext.cpp, surfaceBumpManip/surfaceBumpManip.cpp, surfaceTwistCmd/surfaceTwistCmd.cpp, testCameraSetCmd/testCameraSetCmd.cpp, threadedBoundingBox/threadedBoundingBox.cpp, translateCmd/translateCmd.cpp, viewMRenderOverride/viewMRenderOverride.cpp, viewObjectFilter/viewObjectFilter.cpp, viewObjectSetOverride/viewObjectSetOverride.cpp, viewRenderOverride/viewRenderOverride.h, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.h, viewRenderOverrideShadows/viewRenderOverrideShadows.cpp, viewRenderOverrideShadows/viewRenderOverrideShadows.h, and whatisCmd/whatisCmd.cpp.

Member Enumeration Documentation

Specifies how to merge objects with those already in the list.

Enumerator
kMergeNormal 

If the object is not already on the list, add it.

kXORWithList 

Exclusive OR: if the object is already on the list, remove it, otherwise add it.

kRemoveFromList 

Remove the object from the list.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MSelectionList ( )

Class constructor.

Creates an empty selection list.

MSelectionList ( const MSelectionList srcList)

Copy constructor.

This constructor will copy the contents of the given selection list into the newly create selection list.

Parameters
[in]srcListthe selection list to be copied.
~MSelectionList ( )
virtual

Class destructor.

Removes the selection list.

Member Function Documentation

bool isEmpty ( MStatus ReturnStatus = NULL) const

Specifies whether or not the selection list contains any items.

Parameters
[in]ReturnStatusStatus flag
Returns
true if the list is empty, false otherwise.
Status Codes:
  • MS::kSuccess Method successfully returned a result
  • MS::kFailure Error in the selection list
Examples:
AbcExport/MayaCameraWriter.cpp, AbcImport/CreateSceneHelper.cpp, animImportExport/animImportExport.cpp, atomImportExport/atomImportExport.cpp, gpuCache/gpuCacheCmd.cpp, listRichSelectionCmd/listRichSelectionCmd.cpp, and richMoveCmd/richMoveCmd.cpp.
unsigned int length ( MStatus ReturnStatus = NULL) const

This method returns the number of selection items in the list.

Parameters
[out]ReturnStatusflag
Returns
Number of items in the list
Status Codes:
  • MS::kSuccess Method successfully returned a result
  • MS::kFailure Error in the selection list
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AbcWriteJob.cpp, AbcExport/AbcExport.cpp, AbcExport/AbcWriteJob.cpp, AbcImport/CreateSceneHelper.cpp, animInfoCmd/animInfoCmd.cpp, atomImportExport/atomAnimLayers.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cgFx/cgfxAttrDef.cpp, cgFx/cgfxShaderCmd.cpp, createClipCmd/createClipCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, deletedMsgCmd/deletedMsgCmd.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, fluidInfoCmd/fluidInfoCmd.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, ik2Bsolver/ik2Bsolver.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, manipOverride/manipOverride.cpp, MetadataSample/createMetadataCmd.cpp, MetadataSample/metadataBase.cpp, moveNumericTool/moveNumericTool.cpp, multiPlugInfoCmd/multiPlugInfoCmd.cpp, nodeIconCmd/nodeIconCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, objExport/objExport.cpp, particlePathsCmd/particlePathsCmd.cpp, particleSystemInfoCmd/particleSystemInfoCmd.cpp, pfxInfoCmd/pfxInfoCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, skinClusterWeights/skinClusterWeights.cpp, threadedBoundingBox/threadedBoundingBox.cpp, viewObjectFilter/viewObjectFilter.cpp, viewRenderOverride/viewRenderOverrideOperations.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MStatus getDependNode ( unsigned int  index,
MObject depNode 
) const

Get a handle for the dependency node of the given element of the selection list.

Returns kNullObj and kFailure if selected item does not contain a dependency node.

Parameters
[in]indexthe items position in the list
[out]depNodestorage for the result
Returns
Return status
Status Codes:
  • MS::kSuccess Method successfully returned item
  • MS::kFailure Error returning item
Examples:
AbcExport/MayaCameraWriter.cpp, AbcImport/util.cpp, animInfoCmd/animInfoCmd.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, cgFx/cgfxAttrDef.cpp, cgFx/cgfxShaderCmd.cpp, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, clusterWeightFunction/clusterWeightFunction.cpp, deletedMsgCmd/deletedMsgCmd.cpp, dx11Shader/dx11ShaderCmd.cpp, evaluationPruningEvaluator/evaluationPruningEvaluator.cpp, fluidInfoCmd/fluidInfoCmd.cpp, glslShader/GLSLShaderCmd.cpp, hlslShader/hlslShader.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, latticeNoise/latticeNoiseCmd.cpp, manipOverride/manipOverride.cpp, MetadataSample/createMetadataCmd.cpp, MetadataSample/metadataBase.cpp, nodeIconCmd/nodeIconCmd.cpp, nodeMessageCmd/nodeMessageCmd.cpp, objExport/objExport.cpp, particlePathsCmd/particlePathsCmd.cpp, particleSystemInfoCmd/particleSystemInfoCmd.cpp, pfxInfoCmd/pfxInfoCmd.cpp, polyMessageCmd/polyMessageCmd.cpp, skinClusterWeights/skinClusterWeights.cpp, testCameraSetCmd/testCameraSetCmd.cpp, viewMRenderOverride/viewMRenderOverride.cpp, and viewObjectSetOverride/viewObjectSetOverride.cpp.
MStatus getDagPath ( unsigned int  index,
MDagPath dagPath,
MObject component = MObject::kNullObj 
) const

Get the dag path and component (may be NULL) of the given element of the selection list.

Parameters
[in]indexthe items position in the list
[out]dagPathstorage for the dag path of the item
[out]componentstorage for a handle for the component. This will be null if there is no component
Returns
Return status
Status Codes:
  • MS::kSuccess Method successfully returned item
  • MS::kFailure Error returning item
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/AbcWriteJob.cpp, AbcBullet/MayaTransformCollectionWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/AbcWriteJob.cpp, AbcImport/util.cpp, apiMeshShape/apiMeshShape.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraMessageCmd/cameraMessageCmd.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, closestPointOnNurbsSurfaceCmd/closestPointOnNurbsSurfaceCmd.cpp, clusterWeightFunction/clusterWeightFunction.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, dagMessageCmd/dagMessageCmd.cpp, dx11Shader/dx11ShaderCmd.cpp, exportJointClusterDataCmd/exportJointClusterDataCmd.cpp, findTexturesPerPolygonCmd/findTexturesPerPolygonCmd.cpp, glslShader/GLSLShaderCmd.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, grabUVMain.cpp, intersectOnNurbsSurfaceCmd/intersectOnNurbsSurfaceCmd.cpp, listLightLinksCmd/listLightLinksCmd.cpp, listPolyHolesCmd/listPolyHolesCmd.cpp, moveNumericTool/moveNumericTool.cpp, narrowPolyRenderOverride/narrowPolyRenderOverride.cpp, objExport/objExport.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, skinClusterWeights/skinClusterWeights.cpp, testCameraSetCmd/testCameraSetCmd.cpp, threadedBoundingBox/threadedBoundingBox.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
MStatus getPlug ( unsigned int  index,
MPlug plug 
) const

Get the plug at the specified index of the selection list.

Parameters
[in]indexthe items position in the list
[out]plugstorage for the result
Returns
Return status
Status Codes:
  • MS::kSuccess Method successfully returned item
  • MS::kFailure Error returning item
Examples:
animInfoCmd/animInfoCmd.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, and multiPlugInfoCmd/multiPlugInfoCmd.cpp.
MStatus getPlug ( unsigned int  index,
bool  convertComponents,
MPlug plug 
) const

Get the plug at the specified index of the selection list.

If convertComponents is true then components in the selection list that have a corresponding plug will return that instead.

Note: This only works if the component selection can be converted into a single plug - single component or all components selected.

Parameters
[in]indexthe items position in the list
[in]convertComponentsif true returns the plug of the component in the selection
[out]plugstorage for the result
Returns
Return status
Status Codes:
  • MS::kSuccess Method successfully returned item
  • MS::kFailure Error returning item
MStatus add ( const MObject object,
const bool  mergeWithExisting = false 
)

Add the specified DG node to the end of the selection list.

Parameters
[in]objectThe object to add
[in]mergeWithExistingThis parameter determines what to do if the given item is already present in the list:
If true, the given item is unconditionally added to the end of the list without affecting the pre-existing item.
If false, the pre-existing item is moved from its current position to the end of the list.
Returns
Status flag
Status Codes:
  • MS::kSuccess Object successfully added to the list
  • MS::kInvalidParameter item is null or is not a handle to a dependency node
  • MS::kFailure Error adding the object to the list
Examples:
AbcBullet/AbcBullet.cpp, AbcBullet/MayaTransformCollectionWriter.cpp, AbcExport/AbcExport.cpp, AbcExport/MayaCameraWriter.cpp, AbcImport/CreateSceneHelper.cpp, AbcImport/util.cpp, animInfoCmd/animInfoCmd.cpp, apiMeshShape/apiMeshShape.cpp, apiMeshShape/apiMeshSubSceneOverride.cpp, atomImportExport/atomAnimLayers.cpp, atomImportExport/atomFileUtils.cpp, atomImportExport/atomImportExport.cpp, atomImportExport/atomNodeNameReplacer.cpp, cameraSetSubclass/testExCameraSetCmd.cpp, cgFx/cgfxShaderCmd.cpp, closestPointCmd/closestPointCmd.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, createClipCmd/createClipCmd.cpp, cvExpandCmd/cvExpandCmd.cpp, cvPosCmd/cvPosCmd.cpp, dx11Shader/dx11ShaderCmd.cpp, evaluationPruningEvaluator/evaluationPruningEvaluator.cpp, findFileTexturesCmd/findFileTexturesCmd.cpp, fluidInfoCmd/fluidInfoCmd.cpp, fragmentDumper/fragmentDumper.cpp, getAttrAffectsCmd/getAttrAffectsCmd.cpp, glslShader/GLSLShaderCmd.cpp, gpuCache/gpuCacheCmd.cpp, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheShapeNode.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, hlslShader/hlslShader.cpp, intersectCmd/intersectCmd.cpp, lassoTool/lassoTool.cpp, latticeNoise/latticeNoiseCmd.cpp, listLightLinksCmd/listLightLinksCmd.cpp, objExport/objExport.cpp, particleSystemInfoCmd/particleSystemInfoCmd.cpp, peltOverlapCmd/peltOverlapCmd.cpp, pfxInfoCmd/pfxInfoCmd.cpp, pointOnMeshInfo/pointOnMeshCmd.cpp, rawfootPrintNode/rawfootPrintNode.cpp, skinClusterWeights/skinClusterWeights.cpp, testCameraSetCmd/testCameraSetCmd.cpp, viewMRenderOverride/viewMRenderOverride.cpp, viewObjectFilter/viewObjectFilter.cpp, viewObjectSetOverride/viewObjectSetOverride.cpp, and whatisCmd/whatisCmd.cpp.
MStatus add ( const MDagPath object,
const MObject component = MObject::kNullObj,
const bool  mergeWithExisting = false 
)

Add the specified DG node to the end of the selection list.

Parameters
[in]objectThe Dag Object to add
[in]componentcomponents of the object
[in]mergeWithExistingThis parameter determines what to do if the given item is already present in the list:
If true, the given item is unconditionally added to the end of the list without affecting the pre-existing item.
If false, the pre-existing item is moved from its current position to the end of the list. In addition, if the pre-existing item already had components specified, the components from the given item are merged into those of the pre-existing item.
Returns
Status flag
Status Codes:
  • MS::kSuccess Object successfully added to the list
  • MS::kInvalidParameter item is null or contains an invalid DagPath, or the component parameter is not a handle to a valid component
  • MS::kFailure Error adding the object to the list
MStatus add ( const MString matchString,
const bool  searchChildNamespacesToo = false 
)

Add the specified object(s) to the selection list.

There is an option to search all child namespaces. The object name should be specified in the same way it would be in the MEL language. It is possible to use wildcard characters, so multiple objects may be added in one method call.

NOTE: the actual namespace being searched is important. In relativeNames mode (see the method MNamespace::relativeNames), the search starts in the current namespace but with relativeNames mode off, the search starts with the root namespace.

Parameters
[in]matchStringobject match string
[in]searchChildNamespacesToooptional parameter to specify that child namespaces will also be searched. A value of true enables child namespace searching; a value of false (the default) only searches within the namespace. See the above description for details on which namespace gets searched.
Returns
Return status
Status Codes:
  • MS::kSuccess Objects successfully added to the list
  • MS::kInvalidParameter No matches were found for the string
MStatus add ( const MPlug plug,
const bool  mergeWithExisting = false 
)

Add the specified plug to the end of the selection list.

Parameters
[in]plugthe plug to add
[in]mergeWithExistingThis parameter determines what to do if the given item is already present in the list:
If true, the given item is unconditionally added to the end of the list without affecting the pre-existing item.
If false, the pre-existing item is moved from its current position to the end of the list.
Returns
Return status
Status Codes:
  • MS::kSuccess Plug was successfully added to the list
  • MS::kFailure Invalid plug
MStatus add ( const MUuid uuid,
bool  mergeWithExisting = false 
)

Add nodes matching the UUID to the selection list.

Parameters
[in]uuidthe UUID with which to look up nodes
[in]mergeWithExistingmerge new items with existing ones, or add unconditionally to end of list.
Returns
Return status
Status Codes:
  • MS::kSuccess Node was successfully added to the list
  • MS::kInvalidParameter No nodes found matching the UUID
MStatus remove ( unsigned int  index)

Removes the item at the given index from the list.

Parameters
[in]indexThe index of the item to be removed
Returns
Status flag
Status Codes:
  • MS::kSuccess Item was successfully removed
  • MS::kFailure Error removing item
Examples:
atomImportExport/atomFileUtils.cpp.
MStatus replace ( unsigned int  index,
const MObject item 
)

Remove the item at the given index in the list and replace it with the given object.

The given index must not be greater than the current number of items on the list.

Parameters
[in]itemA pointer to the replacement object
[in]indexThe index of the item to remove from the list
Returns
Status flag
Status Codes:
  • MS::kSuccess The replacement was successfull
  • MS::kInvalidParameter item is null or is not a handle to a dependency node, or the index is larger than the list size
  • MS::kFailure The replacement falied
MStatus replace ( unsigned int  index,
const MDagPath item,
const MObject component = MObject::kNullObj 
)

Remove the item at the given index in the list and replace it with the given Dag item (or components).

The given index must not be greater than the current number of items on the list.

Parameters
[in]itemthe new dag object to place into the list
[in]componentthe components of item to add
[in]indexThe index of the item to remove from the list
Returns
Status flag
Status Codes:
  • MS::kSuccess The replacement was successfull
  • MS::kInvalidParameter item is null or is not a handle to a dependency node, or the index is larger than the list size
  • MS::kFailure The replacement falied
MStatus replace ( unsigned int  index,
const MPlug plug 
)

Remove the item at the given index in the list and replace it with the given plug.

The given index must not be greater than the current number of items on the list.

Parameters
[in]plugThe replacement plug
[in]indexThe index of the item to remove from the list
Returns
Status flag
Status Codes:
  • MS::kSuccess The replacement was successfull
  • MS::kInvalidParameter item is null or is not a handle to a dependency node, or the index is larger than the list size
  • MS::kFailure The replacement falied
bool hasItem ( const MObject item,
MStatus ReturnStatus = NULL 
) const

Determines whether or not the given dependency node is in this selection list.

Note that if the selection list contains a DAG node, the overloaded version of this method that takes an MDagPath must be used. A dag path will not compare identically to a DG node, even if they both refer to the same node.

Parameters
[in]itemThe item to check for
[out]ReturnStatusStatus flag
Returns
true if the item is in this list, false otherwise
Status Codes:
  • MS::kSuccess Method successfully returned a result
  • MS::kInvalidParameter item is null or is not a handle to a dependency node
  • MS::kFailure unable to attempt test
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, viewRenderOverridePointLightShadows/viewRenderOverridePointLightShadows.cpp, and viewRenderOverrideShadows/viewRenderOverrideShadows.cpp.
bool hasItem ( const MDagPath item,
const MObject component = MObject::kNullObj,
MStatus ReturnStatus = NULL 
) const

Determines whether or not the given DAG object is in this selection list.

If the component argument is non-null, then this method will only return true of all the components of the given DAG object are on the selection list.

Parameters
[in]itemthe DAG object to check for
[in]componentthe components of item to check for
[out]ReturnStatusStatus flag
Returns
true if the item or component is in this list, false otherwise
Status Codes:
  • MS::kSuccess Method successfully returned a result
  • MS::kInvalidParameter item is null or contains an invalid DagPath, or the component parameter is not a handle to a valid component
  • MS::kFailure unable to attempt test
bool hasItem ( const MPlug plug,
MStatus ReturnStatus = NULL 
) const

Determines whether or not the given plug is in this selection list.

Parameters
[in]plugThe plug to check for
[out]ReturnStatusStatus flag
Returns
true if the plug is in this list, false otherwise
Status Codes:
  • MS::kSuccess Method successfully returned a result
  • MS::kInvalidParameter item is null or is not a handle to a dependency node
  • MS::kFailure unable to attempt test
bool hasItemPartly ( const MDagPath item,
const MObject component,
MStatus ReturnStatus = NULL 
) const

This method differs from hasItem in that it determines whether or not at least one of the components of the the given DAG object are in this selection list.

This method is only applicable when multiple components are provided.

Parameters
[in]itemthe DAG object to check for
[in]componentthe components of item to check for
[out]ReturnStatusStatus flag
Returns
true if at least one of the components in this list, false otherwise
Status Codes:
  • MS::kSuccess method successfully returned a result
  • MS::kInvalidParameter item is null or contains an invalid DagPath, or the component parameter is not a handle to a valid component
  • MS::kFailure unable to attempt test
MStatus toggle ( const MDagPath item,
const MObject component = MObject::kNullObj 
)

Removes those components of the given selection item which are on the selection list, and adds those parts which are not.

This method does nothing if no components are provided.

Parameters
[in]itemDag object to be toggled
[in]componentcomponents of the object
Returns
Status flag
Status Codes:
  • MS::kSuccess Method successfull
  • MS::kInvalidParameter item is null or is not a handle to a dependency node
  • MS::kFailure Error doing toggle
MSelectionList & operator= ( const MSelectionList other)

Assignment operator.

Parameters
[in]otherthe selection list to be copied
Returns
A reference to the copied selection list
MStatus merge ( const MSelectionList other,
const MergeStrategy  strategy = kMergeNormal 
)

Merge the two selection lists.

Parameters
[in]otherthe selection list to be merged.
[in]strategythe merging strategy. It can be one of the the following:
Returns
Status flag
Status Codes:
  • kSuccess Method successfull
  • MS::kInvalidParameter other is an empty list
  • kFailure Operation failed
Examples:
AbcImport/CreateSceneHelper.cpp, atomImportExport/atomAnimLayers.cpp, gpuCache/gpuCacheCmd.cpp, and listLightLinksCmd/listLightLinksCmd.cpp.
MStatus merge ( const MDagPath item,
const MObject component = MObject::kNullObj,
const MergeStrategy  strategy = kMergeNormal 
)

Merge the given DAG object into the selection list.

Parameters
[in]itemthe dependency node to be merged.
[in]componentcomponents of the Dag object to add
[in]strategythe merging strategy. It can be one of the following:
Returns
Status flag
Status Codes:
  • kSuccess Method successfull
  • MS::kInvalidParameter item is null or contains an invalid DagPath, or the component parameter is not a handle to a valid component
  • kFailure Operation failed
MStatus intersect ( const MSelectionList other,
bool  expandToLeaves = false 
)

Modify this list to contain the intersection of itself and the given list.

Parameters
[in]otherthe selection list to be intersected.
[in]expandToLeavesIf expandToLeaves is true, the two lists will be copied and grown to include leaf nodes before performing the intersection.
Returns
Status flag
Status Codes:
  • kSuccess Method successfully performed the intersection.
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp.
MStatus getSelectionStrings ( MStringArray array) const

Gets the string representations of the items in the selection list.

The strings will be in the format used by the scripting language.

Parameters
[out]arraystorage for the returned strings
Returns
Status flag
Status Codes:
  • MS::kSuccess Method successfull
Examples:
cgFx/cgfxShaderCmd.cpp, convertEdgesToFacesCmd/convertEdgesToFacesCmd.cpp, convertVerticesToEdgesCmd/convertVerticesToEdgesCmd.cpp, convertVerticesToFacesCmd/convertVerticesToFacesCmd.cpp, and cvExpandCmd/cvExpandCmd.cpp.
MStatus getSelectionStrings ( unsigned int  index,
MStringArray array 
) const

Gets the string representation of the given item in the selection list.

The strings will be in the format used by the scripting language. More than one string will be returned in the case that the item in the selection list has a component that that contains elements that are not contiguous (eg CV's 2 and 8 are selected on a surface).

Parameters
[in]indexindex of the element to get
[out]arraystorage for the returned strings
Returns
Status flag
Status Codes:
  • MS::kSuccess Method successfull
  • MS::kInvalidParameter Index is out of range
  • MS::kFailure Error getting the item
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

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