Manage what is selectable in Maya. (OpenMaya) (OpenMaya.py)
Selection masks provide a way to control what is selectable in Maya.
Selection masks can be created by OR'ing several types together, or by using the addMask method to add a selection type to an MSelectionMask.
Example - to set the object selection mask to nurbsSurfaces, nurbsCurves, cameras, and lights
MSelectionMask mask( MSelectionMask::kSelectNurbsSurfaces ); mask.addMask( MSelectionMask::kSelectNurbsCurves ); mask = mask | MSelectionMask::kSelectCameras | MSelectionMask::kSelectLights; MGlobal::setObjectSelectionMask( mask );
apiMeshShape.cpp, apiMeshShape.h, apiMeshShapeUI.cpp, apiSimpleShapeUI.cpp, and quadricShape.cpp.
#include <MSelectionMask.h>
enum SelectionType |
Types of objects which can be selected.
MSelectionMask | ( | ) |
Constructor.
Creates an empty selection mask.
MSelectionMask | ( | MSelectionMask::SelectionType | selType | ) |
Constructor.
Creates a selection mask of the specified type.
[in] | selType | the selection type of this mask |
MSelectionMask | ( | const MString & | selTypeName | ) |
Constructor.
Creates a selection mask of the specified type.
[in] | selTypeName | name of the selection type |
MSelectionMask | ( | const MSelectionMask & | in | ) |
Copy constructor.
Duplicates the given mask
[in] | in | mask to be copied |
~MSelectionMask | ( | ) | [virtual] |
Class destructor.
Removes the selection mask.
MStatus setMask | ( | MSelectionMask::SelectionType | selType | ) |
Sets the selection mask to the specified selection type.
[in] | selType | the selection type to be set |
MStatus setMask | ( | MSelectionMask & | mask | ) |
Sets the selection type for this mask to the selection type of the specified mask.
[in] | mask | the mask with the selection type to be set |
MStatus addMask | ( | MSelectionMask::SelectionType | selType | ) |
Add the specified selection type to this mask.
[in] | selType | the selection type to add |
bool intersects | ( | MSelectionMask::SelectionType | selType, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns true if the specified selection type is contained within this selection mask.
[in] | selType | the selection type to test |
[out] | ReturnStatus | status code |
bool intersects | ( | MSelectionMask & | mask, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Returns true if the specified selection mask is contained within this selection mask.
[in] | mask | the selection mask to test |
[out] | ReturnStatus | status code |
MSelectionMask operator| | ( | MSelectionMask::SelectionType | selType | ) |
Add the specified selection type to this mask.
[in] | selType | the selection type to add |
MSelectionMask operator| | ( | MSelectionMask & | mask | ) |
Add the selection type of the specified mask to this mask.
[in] | mask | the mask containing the selection type to add |
MSelectionMask & operator= | ( | const MSelectionMask & | other | ) |
Assignment operator.
[in] | other | the mask to be copied |
bool registerSelectionType | ( | const MString & | selTypeName, |
int | priority = 0 |
||
) | [static] |
Registers a new selection type.
It is perfectly legal for 2 plug-ins to register the same selection type. Currently we use the registration count. The selection type is deleted only when deregisterSelectionType() as been called the same number of times as this function - registerSelectionType().
When registerSelectionType() is invoked and the selection type already exists,we neither enable it nor change its priority, just add its registration count by 1. The reason is the user might has modified these values after loading the plug-in that has register the selection type the first time.
[in] | selTypeName | Name of the selection type. |
[in] | priority | Priority of the selection type,see 'selectPriority' command. |
bool deregisterSelectionType | ( | const MString & | selTypeName | ) | [static] |
Unregisters a previously registered selection type.
[in] | selTypeName | Name of the selection type. |
int getSelectionTypePriority | ( | const MString & | selTypeName | ) | [static] |
Gets the selection priority corresponding to a given selection type.
[in] | selTypeName | Name of the selection type. |