#include <MPxLocatorNode.h>
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.
Public Member Functions | |
MPxLocatorNode () | |
Constructor More... | |
virtual | ~MPxLocatorNode () |
Destructor More... | |
virtual MPxNode::Type | type () const |
This method returns the type of the node. More... | |
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. More... | |
virtual bool | isBounded () const |
This method should be overridden to return true if the user supplies a bounding box routine. More... | |
virtual MBoundingBox | boundingBox () const |
This method should be overridden to return a bounding box for the locator. More... | |
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. More... | |
MColor | colorRGB (M3dView::DisplayStatus displayStatus) |
This method returns the RGB values of the default draw color for the given display status. More... | |
virtual bool | excludeAsLocator () const |
When the modelPanel is set to not draw locators, returing true will also not draw the custom locator. More... | |
virtual bool | isTransparent () const |
Indicates that this locator uses transparency during ::draw method calls. More... | |
virtual bool | drawLast () const |
Indicates that this locator should be the last item draw in a given refresh cycle. More... | |
virtual bool | useClosestPointForSelection () const |
Determines whether Maya should call closestPoint() when doing single selection. More... | |
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. More... | |
virtual MSelectionMask | getShapeSelectionMask () const |
This routine can be overridden to provide information about the selection mask of the locator. More... | |
Public Member Functions inherited from MPxNode | |
MPxNode () | |
Constructor. More... | |
virtual | ~MPxNode () |
Destructor. | |
virtual void | postConstructor () |
Post constructor. More... | |
virtual MStatus | compute (const MPlug &plug, MDataBlock &dataBlock) |
This method should be overridden in user defined nodes. More... | |
virtual bool | getInternalValueInContext (const MPlug &plug, MDataHandle &dataHandle, MDGContext &ctx) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual bool | setInternalValueInContext (const MPlug &plug, const MDataHandle &dataHandle, MDGContext &ctx) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual bool | getInternalValue (const MPlug &plug, MDataHandle &dataHandle) |
This method is obsolete. More... | |
virtual bool | setInternalValue (const MPlug &plug, const MDataHandle &dataHandle) |
This method is obsolete. More... | |
virtual int | internalArrayCount (const MPlug &plug, const MDGContext &ctx) const |
This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More... | |
virtual void | copyInternalData (MPxNode *) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual MStatus | legalConnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const |
This method allows you to check for legal connections being made to attributes of this node. More... | |
virtual MStatus | legalDisconnection (const MPlug &plug, const MPlug &otherPlug, bool asSrc, bool &isLegal) const |
This method allows you to check for legal disconnections being made to attributes of this node. More... | |
virtual MStatus | setDependentsDirty (const MPlug &plug, MPlugArray &plugArray) |
This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More... | |
virtual MStatus | preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode) |
Prepare a node's internal state for threaded evaluation. More... | |
virtual MStatus | postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType) |
Clean up node's internal state after threaded evaluation. More... | |
virtual SchedulingType | schedulingType () const |
When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More... | |
virtual MStatus | connectionMade (const MPlug &plug, const MPlug &otherPlug, bool asSrc) |
This method gets called when connections are made to attributes of this node. More... | |
virtual MStatus | connectionBroken (const MPlug &plug, const MPlug &otherPlug, bool asSrc) |
This method gets called when connections are broken with attributes of this node. More... | |
virtual MStatus | dependsOn (const MPlug &plug, const MPlug &otherPlug, bool &depends) const |
This method may be overridden by the user defined node. More... | |
virtual bool | isPassiveOutput (const MPlug &plug) const |
This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More... | |
virtual MStatus | shouldSave (const MPlug &plug, bool &isSaving) |
This method may be overridden by the user defined node. More... | |
virtual MPlug | passThroughToOne (const MPlug &plug) const |
This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More... | |
virtual bool | passThroughToMany (const MPlug &plug, MPlugArray &plugArray) const |
This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More... | |
virtual bool | isAbstractClass () const |
Override this class to return true if this node is an abstract node. More... | |
virtual MStringArray | getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const |
Use this method to return all external files used by this node. More... | |
virtual void | getExternalContent (MExternalContentInfoTable &table) const |
Returns the external content (files) that this node depends on. More... | |
bool | addExternalContentForFileAttr (MExternalContentInfoTable &table, const MObject &attr) const |
Adds content info to the specified table from a file path attribute. More... | |
bool | setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &table) |
Sets content info in the specified attribute from the table. More... | |
virtual void | setExternalContent (const MExternalContentLocationTable &table) |
Changes the location of external content in batch. More... | |
virtual MTypeId | typeId () const |
Returns the TYPEID of this node. More... | |
virtual MString | typeName () const |
Returns the type name of this node. More... | |
virtual MString | name () const |
Returns the name of this particular instance of this class. More... | |
virtual MObject | thisMObject () const |
Returns the MObject associated with this user defined node. More... | |
virtual MStatus | setExistWithoutInConnections (bool flag) |
This method specifies whether or not the node can exist without input connections. More... | |
virtual bool | existWithoutInConnections (MStatus *ReturnStatus=NULL) const |
Determines whether or not this node can exist without input connections. More... | |
virtual MStatus | setExistWithoutOutConnections (bool flag) |
This method specifies whether or not the node can exist without output connections. More... | |
virtual bool | existWithoutOutConnections (MStatus *ReturnStatus=NULL) const |
Determines whether or not this node can exist without output connections. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
Static Public Member Functions inherited from MPxNode | |
static MStatus | addAttribute (const MObject &attr) |
This method adds a new attribute to a user defined node type during the type's initialization. More... | |
static MStatus | inheritAttributesFrom (const MString &parentClassName) |
This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More... | |
static MStatus | attributeAffects (const MObject &whenChanges, const MObject &isAffected) |
This method specifies that a particular input attribute affects a specific output attribute. More... | |
static const char * | className () |
Returns the name of this class. More... | |
Static Public Attributes | |
static MObject | underWorldObject |
under world attribute | |
static MObject | localPosition |
local position attribute | |
static MObject | localPositionX |
X component of localPosition. | |
static MObject | localPositionY |
Y component of localPosition. | |
static MObject | localPositionZ |
Z component of localPosition. | |
static MObject | worldPosition |
world position attribute | |
static MObject | worldPositionX |
X component of worldPosition. | |
static MObject | worldPositionY |
Y component of worldPosition. | |
static MObject | worldPositionZ |
Z component of worldPosition. | |
static MObject | localScale |
local scale attribute | |
static MObject | localScaleX |
X component of localScale. | |
static MObject | localScaleY |
Y component of localScale. | |
static MObject | localScaleZ |
Z component of localScale. | |
static MObject | nodeBoundingBox |
bounding box attribute | |
static MObject | nodeBoundingBoxMin |
bounding box minimum point | |
static MObject | nodeBoundingBoxMinX |
X component of boundingBoxMin. | |
static MObject | nodeBoundingBoxMinY |
Y component of boundingBoxMin. | |
static MObject | nodeBoundingBoxMinZ |
Z component of boundingBoxMin. | |
static MObject | nodeBoundingBoxMax |
bounding box maximum point | |
static MObject | nodeBoundingBoxMaxX |
X component of boundingBoxMax. | |
static MObject | nodeBoundingBoxMaxY |
Y component of boundingBoxMax. | |
static MObject | nodeBoundingBoxMaxZ |
Z component of boundingBoxMax. | |
static MObject | nodeBoundingBoxSize |
bounding box size vector | |
static MObject | nodeBoundingBoxSizeX |
X component of boundingBoxSize. | |
static MObject | nodeBoundingBoxSizeY |
Y component of boundingBoxSize. | |
static MObject | nodeBoundingBoxSizeZ |
Z component of boundingBoxSize. | |
static MObject | center |
object center attribute | |
static MObject | boundingBoxCenterX |
X component of boundingBoxCenter. | |
static MObject | boundingBoxCenterY |
Y component of boundingBoxCenter. | |
static MObject | boundingBoxCenterZ |
Z component of boundingBoxCenter. | |
static MObject | matrix |
matrix attribute | |
static MObject | inverseMatrix |
inverse matrix attribute | |
static MObject | worldMatrix |
world matrix attribute | |
static MObject | worldInverseMatrix |
inverse world matrix attribute | |
static MObject | parentMatrix |
parent matrix attribute | |
static MObject | parentInverseMatrix |
inverse parent matrix attribute | |
static MObject | visibility |
visibility attribute | |
static MObject | intermediateObject |
intermediate object attribute | |
static MObject | isTemplated |
template attribute | |
static MObject | instObjGroups |
instances object group info attribute | |
static MObject | objectGroups |
object groups attributes | |
static MObject | objectGrpCompList |
component in object groups attribute | |
static MObject | objectGroupId |
group id attribute | |
static MObject | objectGroupColor |
group id attribute | |
static MObject | useObjectColor |
controls choice of wireframe dormant object color | |
static MObject | objectColor |
the per object dormant wireframe color | |
Static Public Attributes inherited from MPxNode | |
static MObject | message |
message attribute | |
static MObject | isHistoricallyInteresting |
is historically interesting attribute | |
static MObject | caching |
caching attribute | |
static MObject | state |
state attribute | |
static MObject | frozen |
frozen attribute | |
MPxLocatorNode | ( | ) |
Constructor
Class constructor.
|
virtual |
Destructor
Class destructor.
|
virtual |
This method returns the type of the node.
This method should not be overridden by the user. It will return MPxNode::kLocatorNode.
Reimplemented from MPxNode.
|
virtual |
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:
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.
[in] | view | 3D view that is being drawn into |
[in] | path | to the parent (transform node) of this locator in the DAG. To obtain the locator shape node, use MDagPath::extendToShape() if there is only one shape node under the transform or MDagPath::extendToShapeDirectlyBelow(unsigned int index) with the shape index if there are multiple shapes under the transform. |
[in] | style | style to draw object in |
[in] | status | selection status of object |
|
virtual |
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.
|
virtual |
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.
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.
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.
[in] | displayStatus | display status |
MColor colorRGB | ( | M3dView::DisplayStatus | displayStatus | ) |
This method returns the RGB values of the default draw color for the given display status.
[in] | displayStatus | display status |
|
virtual |
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.
|
virtual |
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. Note this flag is not respected by Viewport 2.0.
|
virtual |
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. Note this flag is not respected by Viewport 2.0.
|
virtual |
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 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.
[in] | rayPoint | The base point defining the ray in space |
[in] | rayDir | The ray direction in space |
|
virtual |
This routine can be overridden to provide information about the selection mask of the locator.
By default the selection mask for locators is returned.
|
static |
Returns the name of this class.