MSelectionInfo Class Reference

#include <MSelectionContext.h>

Class 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:

Public Member Functions

bool singleSelection (MStatus *ReturnStatus=NULL) const
 Determines if we want to select a single shape or component. More...
 
bool selectClosest (MStatus *ReturnStatus=NULL) const
 Determines if we want to select the closest shape or component. More...
 
bool selectable (const MSelectionMask &mask, MStatus *ReturnStatus=NULL) const
 Given the selection mask, determines if the shape is selectable. More...
 
bool selectableComponent (bool displayed, const MSelectionMask &mask, MStatus *ReturnStatus=NULL) 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...
 
bool isRay (MStatus *ReturnStatus=NULL) const
 Get whether or not there is a selection ray. More...
 
MMatrix getAlignmentMatrix (MStatus *ReturnStatus=NULL) 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=NULL) const
 Given the selection mask, determines if this shape can be selected for the hilite list. More...
 
bool selectOnHilitedOnly (MStatus *ReturnStatus=NULL) const
 Determines if components can only be selected if the shape is hilited. More...
 

Static Public Member Functions

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

Member Function Documentation

bool singleSelection ( MStatus ReturnStatus = NULL) 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 = NULL) 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 = NULL 
) 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 = NULL 
) 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:
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:
bool isRay ( MStatus ReturnStatus = NULL) 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 = NULL) 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 = NULL 
) 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 = NULL) 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:
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:
  • MSelectionContext.h
  • MSelectionContext.cpp