- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Static Public Attributes

# MPxLocatorNode Class Reference
OpenMayaUI - API module for user interface | Proxy classes

This reference page is linked to from the following overview topics: Parent class descriptions, Scene Overrides, Transition Guide, Devkit Samples, 5.2 Accessing Resource Handles and Device Handle, Overview of example plug-ins, Appendix C: Frequently asked questions.

Search for all occurrences

## Detailed Description

Base class for user defined locators.

MPxLocatorNode allows the creation of user-defined locators. A locator is a DAG shaped that is drawn on the screen, but that has is not rendered. Locators are full dependency nodes and can have attributes and a compute method.

To create a locator, derive off of this class and override the draw method. The draw method can be overridden to draw custom geometry using standard OpenGL calls. The other methods of the parent class MPxNode may also be overridden to perform dependency node capabilities as well.

Examples:

  curvedArrowsNode.cpp, cvColorNode.cpp, footPrintManip.cpp, footPrintNode.cpp, and swissArmyManip.cpp.

`#include <MPxLocatorNode.h>`

Inheritance diagram for MPxLocatorNode:
[legend]

List of all members.

## Public Member Functions
| MPxLocatorNode ()
| Constructor
virtual | ~MPxLocatorNode ()
| Destructor
virtual MPxNode::Type | type () const
| This method returns the type of the node.
virtual void | draw (M3dView &view, const MDagPath &path, M3dView::DisplayStyle style, M3dView::DisplayStatus)
| Overriding this method allows the drawing of custom geometry using standard OpenGL calls.
virtual bool | isBounded () const
| This method should be overridden to return true if the user supplies a bounding box routine.
virtual MBoundingBox | boundingBox () const
| This method should be overridden to return a bounding box for the locator.
unsigned int | color (M3dView::DisplayStatus displayStatus)
| This method returns the index of the color that is the default draw color for the given display status.
MColor | colorRGB (M3dView::DisplayStatus displayStatus)
| This method returns the RGB values of the default draw color for the given display status.
virtual bool | excludeAsLocator () const
| When the modelPanel is set to not draw locators, returing true will also not draw the custom locator.
virtual bool | isTransparent () const
| Indicates that this locator uses transparency during ::draw method calls.
virtual bool | drawLast () const
| Indicates that this locator should be the last item draw in a given refresh cycle.
virtual bool | useClosestPointForSelection () const
| Determines whether Maya should call closestPoint() when doing single selection.
virtual MPoint | closestPoint (MPoint cursorRayPoint, MVector cursorRayDir) const
| Returns the point on the locator, in the locator's local space, which is closest along the specified ray.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.
## Static Public Attributes
static MObject | underWorldObject
| under world attribute Search for all occurrences
static MObject | localPosition
| local position attribute Search for all occurrences
static MObject | localPositionX
| X component of localPosition. Search for all occurrences
static MObject | localPositionY
| Y component of localPosition. Search for all occurrences
static MObject | localPositionZ
| Z component of localPosition. Search for all occurrences
static MObject | worldPosition
| world position attribute Search for all occurrences
static MObject | worldPositionX
| X component of worldPosition. Search for all occurrences
static MObject | worldPositionY
| Y component of worldPosition. Search for all occurrences
static MObject | worldPositionZ
| Z component of worldPosition. Search for all occurrences
static MObject | localScale
| local scale attribute Search for all occurrences
static MObject | localScaleX
| X component of localScale. Search for all occurrences
static MObject | localScaleY
| Y component of localScale. Search for all occurrences
static MObject | localScaleZ
| Z component of localScale. Search for all occurrences
static MObject | nodeBoundingBox
| bounding box attribute Search for all occurrences
static MObject | nodeBoundingBoxMin
| bounding box minimum point Search for all occurrences
static MObject | nodeBoundingBoxMinX
| X component of boundingBoxMin. Search for all occurrences
static MObject | nodeBoundingBoxMinY
| Y component of boundingBoxMin. Search for all occurrences
static MObject | nodeBoundingBoxMinZ
| Z component of boundingBoxMin. Search for all occurrences
static MObject | nodeBoundingBoxMax
| bounding box maximum point Search for all occurrences
static MObject | nodeBoundingBoxMaxX
| X component of boundingBoxMax. Search for all occurrences
static MObject | nodeBoundingBoxMaxY
| Y component of boundingBoxMax. Search for all occurrences
static MObject | nodeBoundingBoxMaxZ
| Z component of boundingBoxMax. Search for all occurrences
static MObject | nodeBoundingBoxSize
| bounding box size vector Search for all occurrences
static MObject | nodeBoundingBoxSizeX
| X component of boundingBoxSize. Search for all occurrences
static MObject | nodeBoundingBoxSizeY
| Y component of boundingBoxSize. Search for all occurrences
static MObject | nodeBoundingBoxSizeZ
| Z component of boundingBoxSize. Search for all occurrences
static MObject | center
| object center attribute Search for all occurrences
static MObject | boundingBoxCenterX
| X component of boundingBoxCenter. Search for all occurrences
static MObject | boundingBoxCenterY
| Y component of boundingBoxCenter. Search for all occurrences
static MObject | boundingBoxCenterZ
| Z component of boundingBoxCenter. Search for all occurrences
static MObject | matrix
| matrix attribute Search for all occurrences
static MObject | inverseMatrix
| inverse matrix attribute Search for all occurrences
static MObject | worldMatrix
| world matrix attribute Search for all occurrences
static MObject | worldInverseMatrix
| inverse world matrix attribute Search for all occurrences
static MObject | parentMatrix
| parent matrix attribute Search for all occurrences
static MObject | parentInverseMatrix
| inverse parent matrix attribute Search for all occurrences
static MObject | visibility
| visibility attribute Search for all occurrences
static MObject | intermediateObject
| intermediate object attribute Search for all occurrences
static MObject | isTemplated
| template attribute Search for all occurrences
static MObject | instObjGroups
| instances object group info attribute Search for all occurrences
static MObject | objectGroups
| object groups attributes Search for all occurrences
static MObject | objectGrpCompList
| component in object groups attribute Search for all occurrences
static MObject | objectGroupId
| group id attribute Search for all occurrences
static MObject | objectGroupColor
| group id attribute Search for all occurrences
static MObject | useObjectColor
| controls choice of wireframe dormant object color Search for all occurrences
static MObject | objectColor
| the per object dormant wireframe color Search for all occurrences

## Constructor & Destructor Documentation

MPxLocatorNode | ( |  | ) |

Constructor

Class constructor.

~MPxLocatorNode | ( |  | ) | `[virtual]`

Destructor

Class destructor.

## Member Function Documentation

MPxNode::Type type | ( |  | ) | const`[virtual]`

Search for all occurrences

This method returns the type of the node.

This method should not be overridden by the user. It will return MPxNode::kLocatorNode.

Returns:
  The type of node

Status Codes:
  - MS::kSuccess The undo was successful
  - MS::kFailure This method is not undoable

Reimplemented from MPxNode.

void draw | ( | M3dView & | view,
|  | const MDagPath & | path,
|  | M3dView::DisplayStyle | style,
|  | M3dView::DisplayStatus | status
| ) |  | `[virtual]`

Search for all occurrences

Overriding this method allows the drawing of custom geometry using standard OpenGL calls.

The OpenGL state should be left in the same state that it was in previously. The OpenGL routine glPushAttrib may be used to make this easier.

When this routine is called, the following conditions may be assumed:

- the correct transform matrix will be loaded for the locator, so the geometry should be drawn in local space
- the correct default color will be set for wire frame drawing given the object's state (eg active, dormant, etc.)
- the object is not invisible or hidden
- if the object has a bounding box, then the bounding box is at least partially in the frustum

As a convenience, this draw method will also be used by OpenGL's selection mechanism to determine whether this object gets selected by a particular mouse event. The user does not need to write a separate selection routine.

Parameters:

  [in] | view | 3D view that is being drawn into
  [in] | path | to this locator in the DAG
  [in] | style | style to draw object in
  [in] | status | selection status of object

Examples:
  curvedArrowsNode.cpp, cvColorNode.cpp, footPrintManip.cpp, footPrintNode.cpp, and swissArmyManip.cpp.

bool isBounded | ( |  | ) | const`[virtual]`

Search for all occurrences

This method should be overridden to return true if the user supplies a bounding box routine.

Supplying a bounding box routine makes refresh and selection more efficient.

Returns:
  A boolean value indicating whether a bounding box routine has been supplied

Examples:
  curvedArrowsNode.cpp, cvColorNode.cpp, footPrintManip.cpp, footPrintNode.cpp, and swissArmyManip.cpp.

MBoundingBox boundingBox | ( |  | ) | const`[virtual]`

Search for all occurrences

This method should be overridden to return a bounding box for the locator.

If this method is overridden, then MPxLocatorNode::isBounded should also be overridden to return true.

Returns:
  The bounding box of the locator

Examples:
  curvedArrowsNode.cpp, footPrintManip.cpp, footPrintNode.cpp, and swissArmyManip.cpp.

unsigned int color | ( | M3dView::DisplayStatus | displayStatus | ) |

Search for all occurrences

This method returns the index of the color that is the default draw color for the given display status.

The index should be used with the methods of M3dView. The value is not an index into the OpenGL color table.

The index that is returned will be into the active, dormant, or template color tables depending on the display status passed in.

Parameters:

  [in] | displayStatus | display status

Returns:
  The index of the color

MColor colorRGB | ( | M3dView::DisplayStatus | displayStatus | ) |

Search for all occurrences

This method returns the RGB values of the default draw color for the given display status.

Parameters:

  [in] | displayStatus | display status

Returns:
  The color

bool excludeAsLocator | ( |  | ) | const`[virtual]`

Search for all occurrences

When the modelPanel is set to not draw locators, returing true will also not draw the custom locator.

If false is returned, the custom locator will also be drawn.

The default return value is true.

Returns:
  true if the custom locator should be treated like a standard maya locator.

bool isTransparent | ( |  | ) | const`[virtual]`

Search for all occurrences

Indicates that this locator uses transparency during ::draw method calls.

Objects with transparency must be drawn in a special queue, i.e. after all opaque objects are drawn.

The default return value is false.

Returns:
  true if the locator uses transparency while drawing, false otherwise.

Examples:
  curvedArrowsNode.cpp.

bool drawLast | ( |  | ) | const`[virtual]`

Search for all occurrences

Indicates that this locator should be the last item draw in a given refresh cycle.

Objects drawn out-of-order will not preserve the proper transparency sorting. Conflicts among multiple objects with the drawLast indicator set to TRUE will be resolved by their order in the Outliner, where they will be drawn top-to-bottom.

The default return value is false.

Returns:
  true, the locator will be drawn after all other objects in the scene.

Examples:
  curvedArrowsNode.cpp.

bool useClosestPointForSelection | ( |  | ) | const`[virtual]`

Search for all occurrences

Determines whether Maya should call closestPoint() when doing single selection.

When doing single selection Maya generally chooses the object closest to the selection ray. For locators it first does a hit test by calling the locator's draw method to determine if any part of it lies within the selection box. If the hit test succeeds Maya will add the locator to the list of objects being considered for selection and will use the center of the locator (i.e. its local origin) in determining its distance from the selection ray. This works well for locators which mark a single point in space, with no offset, but may not work as well for more complex locators.

If this method is overridden to return true, then rather than using the locator's center to determine its distance from the selection ray, Maya will pass the ray to the closestPoint() method and use the point it returns. Note that you will have override closestPoint() as well to provide an appropriate point.

Returns:
  true if the locator uses a custom location for selection, false otherwise.

MPoint closestPoint | ( | MPoint | rayPoint,
|  | MVector | rayDir
| ) |  | const`[virtual]`

Search for all occurrences

Returns the point on the locator, in the locator's local space, which is closest along the specified ray.

By default, the locator's origin (0, 0, 0) is returned.

This is currently only used by Maya during single selection. See useClosestPointForSelection() for further details on that.

Parameters:

  [in] | rayPoint | The base point defining the ray in space
  [in] | rayDir | The ray direction in space

Returns:
  The point that Maya should consider as the closest point of intersection along the parameter ray.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

Reimplemented from MPxNode.

MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode
MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode MPxLocatorNode