C++ API Reference
MSelectionInfo Class Reference

Class to allow access to the selection state information. More...

#include <MSelectionContext.h>

Public Member Functions

bool singleSelection (MStatus *ReturnStatus=nullptr) const
 Determines if we want to select a single shape or component. More...
 
bool selectClosest (MStatus *ReturnStatus=nullptr) const
 Determines if we want to select the closest shape or component. More...
 
bool selectable (const MSelectionMask &mask, MStatus *ReturnStatus=nullptr) const
 Given the selection mask, determines if the shape is selectable. More...
 
bool selectableComponent (bool displayed, const MSelectionMask &mask, MStatus *ReturnStatus=nullptr) const
 Given the selection mask, determines if the component is selectable. More...
 
MStatus selectRect (unsigned int &x, unsigned int &y, unsigned int &width, unsigned int &height) const
 Get the current selection rectangle dimensions. More...
 
MStatus cursorPoint (int &x, int &y) const
 Get the cursor point relative to the lower left corner of the viewport. More...
 
bool isRay (MStatus *ReturnStatus=nullptr) const
 Get whether or not there is a selection ray. More...
 
MMatrix getAlignmentMatrix (MStatus *ReturnStatus=nullptr) const
 Returns the alignment matrix. More...
 
MStatus getLocalRay (MPoint &pnt, MVector &vec) const
 Get the selection ray. More...
 
bool selectForHilite (const MSelectionMask &mask, MStatus *ReturnStatus=nullptr) const
 Given the selection mask, determines if this shape can be selected for the hilite list. More...
 
bool selectOnHilitedOnly (MStatus *ReturnStatus=nullptr) const
 Determines if components can only be selected if the shape is hilited. More...
 
bool pointSnapping (MStatus *ReturnStatus=nullptr) const
 Determines if selection is launched to find snap points. More...
 
bool snapToActive (MStatus *ReturnStatus=nullptr) const
 Determines if active objects should be snapped to. More...
 

Static Public Member Functions

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

Detailed Description

Class to allow access to the selection state information.

MSelectionInfo encapsulates the selection state information.

It is read-only and cannot be instantiated by plug-ins. During the hit test phase or the selection interpretation phase of Viewport 2.0 selection, an MSelectionInfo instance is passed to the following functions for plug-ins to query the current selection state information:

The MSelectionInfo instance is only valid inside these functions, thus plug-ins should not save its pointer.

Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp, gpuCache/gpuCacheDrawOverride.cpp, gpuCache/gpuCacheDrawOverride.h, and rawfootPrintNode/rawfootPrintNode.cpp.

Member Function Documentation

bool singleSelection ( MStatus ReturnStatus = nullptr) const

Determines if we want to select a single shape or component.

Parameters
[out]ReturnStatusStatus code.
Returns
  • true a single shape/component should be selected
  • false allow multiple shapes/components to be selected
Status Codes:
bool selectClosest ( MStatus ReturnStatus = nullptr) const

Determines if we want to select the closest shape or component.

Parameters
[out]ReturnStatusStatus code.
Returns
  • true the closest shape/component should be selected
  • false any shape/component within the selection rectangle may be selected, not necessarily the closest
Status Codes:
bool selectable ( const MSelectionMask mask,
MStatus ReturnStatus = nullptr 
) const

Given the selection mask, determines if the shape is selectable.

Parameters
[in]maskselection mask
[out]ReturnStatusStatus code.
Returns
  • true the shape is selectable
  • false the shape not is selectable
Status Codes:
bool selectableComponent ( bool  displayed,
const MSelectionMask mask,
MStatus ReturnStatus = nullptr 
) const

Given the selection mask, determines if the component is selectable.

Parameters
[in]displayedis the component displayed
[in]maskselection mask
[out]ReturnStatusStatus code.
Returns
  • true the component is selectable
  • false the component not is selectable
Status Codes:
Examples:
apiMeshShape/apiMeshSubSceneOverride.cpp.
MStatus selectRect ( unsigned int &  x,
unsigned int &  y,
unsigned int &  width,
unsigned int &  height 
) const

Get the current selection rectangle dimensions.

Parameters
[out]xLower left corner of the selection rectangle (x coordinate).
[out]yLower left corner of the selection rectangle (y coordinate).
[out]widthWidth of the selection rectangle.
[out]heightHeight of the selection rectangle.
Returns
Status code
Status Codes:
Examples:
gpuCache/gpuCacheDrawOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
MStatus cursorPoint ( int &  x,
int &  y 
) const

Get the cursor point relative to the lower left corner of the viewport.

Parameters
[out]xThe x coordinate.
[out]yThe y coordinate.
Returns
Status code.
Status Codes:
bool isRay ( MStatus ReturnStatus = nullptr) const

Get whether or not there is a selection ray.

This method is used to find ray object intersection.

Parameters
[out]ReturnStatusStatus code.
Returns
  • true there is a selection ray
  • false there is no selection ray
Status Codes:
MMatrix getAlignmentMatrix ( MStatus ReturnStatus = nullptr) const

Returns the alignment matrix.

This method is used to find ray object intersection. If isRay() returns false, this will return the identity matrix.

This method maps the world space selection vector into the object space of the object. It then computes the matrix to transform the object so that the local space selection vector is aligned with the positive Z-axis.

Parameters
[out]ReturnStatusStatus code.
Returns
The alignment matrix
Status Codes:
MStatus getLocalRay ( MPoint pnt,
MVector vec 
) const

Get the selection ray.

This method is used to find ray object intersection. If isRay() returns false, the starting point will be (0, 0, 0, 1) and the direction vector (0, 0, 0).

Parameters
[out]pntray starting point
[out]vecray direction
Returns
Status code
Status Codes:
bool selectForHilite ( const MSelectionMask mask,
MStatus ReturnStatus = nullptr 
) const

Given the selection mask, determines if this shape can be selected for the hilite list.

Parameters
[in]maskthe mask to test
[out]ReturnStatusStatus code.
Returns
  • true can select for hilite
  • false can't select for hilite
Status Codes:
bool selectOnHilitedOnly ( MStatus ReturnStatus = nullptr) const

Determines if components can only be selected if the shape is hilited.

Parameters
[out]ReturnStatusStatus code.
Returns
  • true can only select components if the shape is hilited
  • false components can be selected from both hilited and non-hilited shapes
Status Codes:
bool pointSnapping ( MStatus ReturnStatus = nullptr) const

Determines if selection is launched to find snap points.

Parameters
[out]ReturnStatusStatus code.
Status Codes:
Returns
true if selection is launched to find snap points.
bool snapToActive ( MStatus ReturnStatus = nullptr) const

Determines if active objects should be snapped to.

Parameters
[out]ReturnStatusStatus code.
Status Codes:
Returns
true if active objects should be snapped to.
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: