#include <MDagPath.h>
DAG Path.
Provides methods for obtaining one or all Paths to a specified DAG Node, determining if a Path is valid and if two Paths are equivalent, obtaining the length, transform, and inclusive and exclusive matrices of a Path, as well as performing Path to Path assignment.
DAG Paths may be used as parameters to some methods in the DAG Node Function Set (MFnDagNode).
It is often useful to combine DAG Paths into DAG Path arrays (MDagPathArray).
Use this DAG Path Class to obtain and query Paths to DAG Nodes. A DAG path is a path from the world node to a particular object in the DAG.
If a DAG object is instanced, then an MDagPath is required to identify a particular instance. DAG paths are also required when doing world space transformations.
Use this class in conjunction with the DAG Iterator (MItDag), DAG Node Function Set (MFnDagNode) and DAG Path Array class (MDagPathArray) to query and edit the DAG.
Public Member Functions | |
MDagPath () | |
Class Constructor. More... | |
MDagPath (const MDagPath &src) | |
Copy constructor. More... | |
virtual | ~MDagPath () |
Class Destructor. More... | |
MStatus | getAllPathsBelow (MDagPathArray &pathArray) |
Return all paths to leaf objects below this path excluding transforms. More... | |
bool | hasFn (MFn::Type type, MStatus *ReturnStatus=nullptr) const |
Returns true if the object at the end of this DAG path supports the given function set. More... | |
MFn::Type | apiType (MStatus *ReturnStatus=nullptr) const |
Returns the type of the object at the end of the path. More... | |
bool | isValid (MStatus *ReturnStatus=nullptr) const |
Determines if Path is valid. More... | |
MObject | node (MStatus *ReturnStatus=nullptr) const |
Retrieves the DAG Node for this DAG Path. More... | |
MObject | transform (MStatus *ReturnStatus=nullptr) const |
Retrieves the lowest Transform in the DAG Path. More... | |
unsigned int | length (MStatus *ReturnStatus=nullptr) const |
Determines the number of DAG Nodes in the Path not including the root. More... | |
MStatus | extendToShape () |
If the object at the end of this path is a transform and there is a shape node directly beneath it in the hierarchy, then the path is extended to that geometry node. More... | |
MStatus | extendToShapeDirectlyBelow (unsigned int) |
This method is used if the end of the path is a transform and there are shapes directly below the transform. More... | |
MStatus | numberOfShapesDirectlyBelow (unsigned int &) const |
If the object at the end of this path is a transform, this method will return the number of shapes directly below the transform. More... | |
MStatus | push (const MObject &child) |
Push an object onto the end of the path. More... | |
MStatus | pop (unsigned int num=1) |
Pop the given number of objects off of the end of the path. More... | |
unsigned int | childCount (MStatus *ReturnStatus=nullptr) const |
Return the number of children that the object at the end of the path has. More... | |
MObject | child (unsigned int i, MStatus *ReturnStatus=nullptr) const |
Return the child object at the given index, where the parent is the object at the end of the path. More... | |
MMatrix | inclusiveMatrix (MStatus *ReturnStatus=nullptr) const |
Determines the inclusive matrix of the Path. More... | |
MMatrix | exclusiveMatrix (MStatus *ReturnStatus=nullptr) const |
Determines the exclusive matrix of the Path. More... | |
MMatrix | inclusiveMatrixInverse (MStatus *ReturnStatus=nullptr) const |
Determines the inverse inclusive matrix of the Path. More... | |
MMatrix | exclusiveMatrixInverse (MStatus *ReturnStatus=nullptr) const |
Determines the inverse exclusive matrix of the Path. More... | |
MDagPath & | operator= (const MDagPath &src) |
Assigns the DAG Path on the RHS of the operator to the DAG Path on the LHS. More... | |
bool | operator== (const MDagPath &src) const |
Determines if the DAG Path on the LHS of the operator is equal to the DAG Path on the RHS. More... | |
MStatus | set (const MDagPath &src) |
Sets this DAG Path equal to the specified DAG Path. More... | |
unsigned int | pathCount (MStatus *ReturnStatus=nullptr) const |
Return the number of paths which make up this path. More... | |
MStatus | getPath (MDagPath &path, unsigned int i=0) const |
Return the i'th path. More... | |
MString | fullPathName (MStatus *ReturnStatus=nullptr) const |
Return a string representing the full path from the root of the dag to this object. More... | |
MString | partialPathName (MStatus *ReturnStatus=nullptr) const |
Return a string representing the partial path from the root of the dag to this object. More... | |
bool | isInstanced (MStatus *ReturnStatus=nullptr) const |
Returns true if the object at the end of the DAG path is instanced. More... | |
unsigned int | instanceNumber (MStatus *ReturnStatus=nullptr) const |
For an instanced object, this returns the instance number that this path represents in the DAG. More... | |
bool | isVisible (MStatus *ReturnStatus=nullptr) const |
Returns true if the DAG Node at the end of the path is visible to the viewport. More... | |
bool | isTemplated (MStatus *ReturnStatus=nullptr) const |
Returns true if the DAG Node at the end of the path is templated. More... | |
MDAGDrawOverrideInfo | getDrawOverrideInfo () const |
Get the draw override information for the given path. More... | |
Static Public Member Functions | |
static MStatus | getAllPathsTo (const MObject &node, MDagPathArray &pathArray) |
Determines all Paths to the specified DAG Node. More... | |
static MStatus | getAPathTo (const MObject &node, MDagPath &path) |
Determines the Path to the specified DAG Node. More... | |
static const char * | className () |
Returns the name of this class. More... | |
static MDagPath | getAPathTo (const MObject &node, MStatus *ReturnStatus=nullptr) |
Obsolete. More... | |
OPENMAYA_MAJOR_NAMESPACE_OPEN MDagPath | ( | ) |
Class Constructor.
Creates a DAG Path
Copy constructor.
Duplicate the given path.
[in] | src | the path to be copied |
|
virtual |
Class Destructor.
No additional action.
|
static |
Determines all Paths to the specified DAG Node.
[in] | node | DAG Node for which Paths are determined |
[out] | pathArray | Array containing all DAG Paths to the specified Node (implicit return) |
Determines the Path to the specified DAG Node.
The Path returned is rooted at the World. If the object is instanced and has multiple paths, then the first one that is found is returned.
[in] | node | DAG Node for which Paths are determined |
[out] | path | reference to the path of the specified DAG Node |
MStatus getAllPathsBelow | ( | MDagPathArray & | pathArray | ) |
Return all paths to leaf objects below this path excluding transforms.
[out] | pathArray | Array containing all DAG Paths below this path excluding transforms. |
Returns true if the object at the end of this DAG path supports the given function set.
If the object at the end of this DAG path is a transform node and has a child that is a shape, then that node will be checked as well. All function sets that take an MDagPath
[in] | type | function set type to check |
[out] | ReturnStatus | status code |
Returns the type of the object at the end of the path.
[out] | ReturnStatus | status code |
bool isValid | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Determines if Path is valid.
[out] | ReturnStatus | status code |
Retrieves the DAG Node for this DAG Path.
[out] | ReturnStatus | Status Code |
Retrieves the lowest Transform in the DAG Path.
[out] | ReturnStatus | Status Code |
unsigned int length | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Determines the number of DAG Nodes in the Path not including the root.
[out] | ReturnStatus | status code |
MStatus extendToShape | ( | ) |
If the object at the end of this path is a transform and there is a shape node directly beneath it in the hierarchy, then the path is extended to that geometry node.
NOTE: This method will fail if there multiple shapes below the transform.
MStatus extendToShapeDirectlyBelow | ( | unsigned int | index | ) |
This method is used if the end of the path is a transform and there are shapes directly below the transform.
The shape to extend to is set by passing in an appropriate index parameter.
Use the numberOfShapesDirectlyBelow() method to determine how many shapes are below
[in] | index | contains the index of the shape to extend the path to |
MStatus numberOfShapesDirectlyBelow | ( | unsigned int & | num | ) | const |
If the object at the end of this path is a transform, this method will return the number of shapes directly below the transform.
[in] | num | on success, this parameter will be set to the number of shapes directly underneath the transform |
Push an object onto the end of the path.
The object must be a child of the object that is currently at the end of the path.
[in] | child | child object to push onto the path |
MStatus pop | ( | unsigned int | num = 1 | ) |
Pop the given number of objects off of the end of the path.
[in] | num | number of objects to pop off of the path |
unsigned int childCount | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Return the number of children that the object at the end of the path has.
[out] | ReturnStatus | status code |
Return the child object at the given index, where the parent is the object at the end of the path.
[in] | index | child's index |
[out] | ReturnStatus | status code |
Determines the inclusive matrix of the Path.
[out] | ReturnStatus | status code |
Determines the exclusive matrix of the Path.
[out] | ReturnStatus | status code |
Determines the inverse inclusive matrix of the Path.
[out] | ReturnStatus | status code |
Determines the inverse exclusive matrix of the Path.
[out] | ReturnStatus | status code |
Assigns the DAG Path on the RHS of the operator to the DAG Path on the LHS.
[in] | src | the path to be copied |
bool operator== | ( | const MDagPath & | src | ) | const |
Determines if the DAG Path on the LHS of the operator is equal to the DAG Path on the RHS.
[in] | src | The path to be compared. |
Sets this DAG Path equal to the specified DAG Path.
[in] | src | DAG Path to be copied. |
unsigned int pathCount | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Return the number of paths which make up this path.
[out] | ReturnStatus | status code |
Return the i'th path.
The zero'th path is the top-most path and must be rooted by the world. Additional paths are paths in the underworld of the object at the end of the previous path (path i-1).
[out] | path | reference to the destination path |
[in] | i | the index of the path to retrieve |
Return a string representing the full path from the root of the dag to this object.
[out] | ReturnStatus | status code |
Return a string representing the partial path from the root of the dag to this object.
The partial path is the minimum path that is still unique. This string may contain wildcards.
[out] | ReturnStatus | status code |
bool isInstanced | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Returns true if the object at the end of the DAG path is instanced.
It is instanced if there is more than one path to the node from the top of the DAG. Each instance of the node will be drawn separately in the view, but the geometry will be shared.
[out] | ReturnStatus | status code |
unsigned int instanceNumber | ( | MStatus * | ReturnStatus = nullptr | ) | const |
For an instanced object, this returns the instance number that this path represents in the DAG.
The instance number can be used to determine which element of the world space array attributes of a DAG node to connect to get information regarding this instance.
[out] | ReturnStatus | status code |
bool isVisible | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Returns true if the DAG Node at the end of the path is visible to the viewport.
This method does not account for any viewport specific filtering.
If the object is not in the current render layer then it is not visible.
If the value of the visibility attribute is false for any DAG Node along the path, the object is invisible. Also, the object is invisible if it or its ancestor is in an invisible display layer. Additionally, intermediate objects are considered invisible as are objects which have the display geometry flag toggled to off (see the 'toggle' command).
[out] | ReturnStatus | status code |
bool isTemplated | ( | MStatus * | ReturnStatus = nullptr | ) | const |
Returns true if the DAG Node at the end of the path is templated.
If the value of the template attribute is true for any DAG Node along the path, this method will return true. If the display override for any DAG node along the path is template, this method will return true. Finally, this method will return true if any DAG node along the path is in a templated display layer.
[out] | ReturnStatus | status code |
MDAGDrawOverrideInfo getDrawOverrideInfo | ( | ) | const |
Get the draw override information for the given path.
It will check from the bottom object of this path, then go upwards to find the first enabled draw override and record that information. If no enabled draw override is found, a default draw override information will be given with draw override disabled inside it.
|
static |
Returns the name of this class.
Obsolete.
This method is obsolete.
Determines the Path to the specified DAG Node. The Path returned is rooted at the World. If the object is instanced and has multiple paths, then the first one that is found is returned.
[in] | node | DAG Node for which Paths are determined |
[out] | ReturnStatus | Status Code |