C++ API Reference

Base class for user defined locators. More...

#include <MPxLocatorNode.h>

+ Inheritance diagram for MPxLocatorNode:

Public Member Functions

 MPxLocatorNode ()
 Constructor More...
 
 ~MPxLocatorNode () override
 Destructor More...
 
MPxNode::Type type () const override
 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...
 
void getCacheSetup (const MEvaluationNode &evalNode, MNodeCacheDisablingInfo &disablingInfo, MNodeCacheSetupInfo &cacheSetupInfo, MObjectArray &monitoredAttributes) const override
 Disables Cached Playback support by default. 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 &, MDataBlock &)
 This method should be overridden in user defined nodes. More...
 
virtual bool getInternalValue (const MPlug &, MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual bool setInternalValue (const MPlug &, const MDataHandle &)
 This method is overridden by nodes that store attribute data in some internal format. More...
 
virtual int internalArrayCount (const MPlug &) 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 &, const MPlug &, 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 &, const MPlug &, 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 void configCache (const MEvaluationNode &, MCacheSchema &) const
 Defines the node's behavior when participating in Cached Playback. More...
 
virtual MTimeRange transformInvalidationRange (const MPlug &source, const MTimeRange &input) const
 Override this method to register this node as an Invalidation-Range-Transformation kernel (IRT kernel) An IRT kernel node will change the invalidation time range for its downstream nodes For example, Dynamics-solver will transform invalidation time range [a,b] to [a,+inf) And Clip-Time-Editor will send out the invalidation range for each of the clip [a,b] to ( [t0+a,t0+b] U [t1+a,t1+b] U [t2+a,t2+b] U ... More...
 
bool hasInvalidationRangeTransformation () const
 Checks if this MPxNode derived node overrides the MPxNode::transformInvalidationRange method.
 
virtual MStatus connectionMade (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are made to attributes of this node. More...
 
virtual MStatus connectionBroken (const MPlug &, const MPlug &, bool asSrc)
 This method gets called when connections are broken with attributes of this node. More...
 
virtual MStatus dependsOn (const MPlug &, const MPlug &, bool &depends) const
 This method may be overridden by the user defined node. More...
 
virtual bool isPassiveOutput (const MPlug &) 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 &, bool &isSaving)
 This method may be overridden by the user defined node. More...
 
virtual MPlug passThroughToOne (const MPlug &) 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 &, MPlugArray &) 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 bool isTrackingTopology () const
 Override this class to return true if this node wants to track topology. 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 &, const MObject &attr) const
 Adds content info to the specified table from a file path attribute. More...
 
bool setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &)
 Sets content info in the specified attribute from the table. More...
 
virtual void setExternalContent (const MExternalContentLocationTable &)
 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...
 
void _setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
MDataBlock _forceCache (const MDGContext &)
 This method is obsolete. More...
 
virtual bool getInternalValueInContext (const MPlug &, MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual bool setInternalValueInContext (const MPlug &, const MDataHandle &, MDGContext &)
 This method is obsolete. More...
 
virtual int internalArrayCount (const MPlug &, const MDGContext &) const
 This method is obsolete. 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 MStatus attributeAffects (const MObject &whenChanges, const MObject &isAffected, bool affectsTopology)
 This method is an extension to the other version of the attributeAffects method. 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
 

Additional Inherited Members

- Public Types inherited from MPxNode
enum  Type {
  kDependNode, kLocatorNode, kDeformerNode, kManipContainer,
  kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode,
  kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode,
  kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode,
  kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode,
  kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster,
  kGeometryFilter, kBlendShape, kLast
}
 Defines the type of node. More...
 
enum  SchedulingType {
  kParallel, kSerial, kGloballySerial, kUntrusted ,
  kDefaultScheduling = kSerial, kSerialize = kSerial, kGloballySerialize = kGloballySerial
}
 Defines the degree of parallelism of a node. More...
 
- Protected Member Functions inherited from MPxNode
virtual MDataBlock forceCache ()
 USE _forceCache() IN SCRIPT. More...
 
virtual MStatus setDoNotWrite (bool flag)
 USE _setDoNotWrite() IN SCRIPT. More...
 
virtual bool doNotWrite (MStatus *ReturnStatus=NULL) const
 USE _doNotWrite() IN SCRIPT. More...
 
virtual void setMPSafe (bool isMPSafe)
 This method is obsolete. More...
 
virtual MDataBlock forceCache (const MDGContext &)
 This method is obsolete. More...
 

Detailed Description

Base class for user defined locators.

MPxLocatorNode allows the creation of user-defined locators. A locator is a DAG shape that is drawn on the screen, but that 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:
cvColorNode/cvColorNode.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, MayaPluginForSpreticle/spReticleLoc.h, rawfootPrintNode/rawfootPrintNode.cpp, simpleEvaluationDraw/simpleEvaluationDraw.cpp, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, swissArmyManip/swissArmyManip.cpp, tessellatedQuad/TessellatedQuadNode.h, transformDrawNode/transformDrawNode.cpp, and uiDrawManager/uiDrawManager.cpp.

Constructor & Destructor Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MPxLocatorNode ( )

Constructor

Class constructor.

~MPxLocatorNode ( )
override

Destructor

Class destructor.

Member Function Documentation

MPxNode::Type type ( ) const
overridevirtual

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

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]view3D view that is being drawn into
[in]pathto 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]stylestyle to draw object in
[in]statusselection status of object
Examples:
MayaPluginForSpreticle/spReticleLoc.h, and tessellatedQuad/TessellatedQuadNode.h.
bool isBounded ( ) const
virtual
void getCacheSetup ( const MEvaluationNode evalNode,
MNodeCacheDisablingInfo disablingInfo,
MNodeCacheSetupInfo cacheSetupInfo,
MObjectArray monitoredAttributes 
) const
overridevirtual

Disables Cached Playback support by default.

Built-in locators all enable Cached Playback by default, but plug-ins have to explicitly enable it by overriding this method.

This method should be overridden to enable Cached Playback by default for custom locators.

Parameters
[in]evalNodeThis node's evaluation node, contains animated plug information
[out]disablingInfoInformation about why the node disables caching to be reported to the user
[out]cacheSetupInfoPreferences and requirements this node has for caching
[out]monitoredAttributesAttributes impacting the behavior of this method that will be monitored for change

Reimplemented from MPxNode.

Examples:
footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, and rawfootPrintNode/rawfootPrintNode.cpp.
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.

Parameters
[in]displayStatusdisplay status
Returns
The index of the color
MColor colorRGB ( M3dView::DisplayStatus  displayStatus)

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

Parameters
[in]displayStatusdisplay status
Returns
The color
bool excludeAsLocator ( ) const
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.

Returns
true if the custom locator should be treated like a standard maya locator.
Examples:
MayaPluginForSpreticle/spReticleLoc.h.
bool isTransparent ( ) const
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.

Returns
true if the locator uses transparency while drawing, false otherwise.
Examples:
MayaPluginForSpreticle/spReticleLoc.h.
bool drawLast ( ) const
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.

Returns
true, the locator will be drawn after all other objects in the scene.
Examples:
MayaPluginForSpreticle/spReticleLoc.h.
bool useClosestPointForSelection ( ) const
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
true if the locator uses a custom location for selection, false otherwise.
MPoint closestPoint ( MPoint  rayPoint,
MVector  rayDir 
) const
virtual

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]rayPointThe base point defining the ray in space
[in]rayDirThe ray direction in space
Returns
The point that Maya should consider as the closest point of intersection along the parameter ray.
MSelectionMask getShapeSelectionMask ( ) const
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.

Returns
The selection mask of the locator.
Examples:
footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, and footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files: