MItDependencyGraph Class Reference

#include <MItDependencyGraph.h>

Class Description

Dependency Graph Iterator.

Iterate over Dependency Graph (DG) Nodes or Plugs starting at a specified root Node or Plug.

Set and query the root of the iteration.

Set and query the direction (downstream or upstream), traversal priority (depth first or breadth first) and level of detail (Node level or Plug level) of the iteration.

Set and disable a filter to iterate over only specific types (MFn::Type) of Nodes.

Reset the root, filter, direction, traversal priority and level of detail of the iteration.

Prune branches of the graph from iteration.

In Maya, all geometry, animation and rendering information is implemented in nodes in the Dependency Graph (DG). The DG includes the Directed Acyclic Graph (DAG). Therefore, all DAG nodes are also DG nodes. The data on nodes is associated with Attributes. Attributes on nodes are connected to Attributes on other nodes via plugs on the Attributes. Plugs are, in effect the external intefaces of Attributes.

The DG Iterator Class (MItDependencyGraph) provides methods for iterating over either nodes or plugs, as well as methods for setting and querying the characteristics and behaviour of the iterator.

This iterator will traverse all connected attributes upstream or downstream from the root node of the traversal. For non root nodes, only attributes that are affected by the incoming attribute to that node will be traversed. Hence, only nodes to which data from the root node is flowing will be traversed.

By default, the iterator does not traverse world-space attribute dependencies (an example of a world-space dependency is that translateX affects worldMatrix). The setTraversalOverWorldSpaceDependents method can be used to enable such traversal. Note that even when world-space traversal is enabled, the iterator will only iterate to connected nodes. It does not iterate up and down through the dag hierarchy.

The DG Iterator is used in conjunction with the Maya Object (MObject), plug (MPlug), Maya Object Array (MObjectArray) and plug Array (MPlugArray) classes.

It is also useful to use Function Sets specific to the nodes returned by the iterator to query and modify the nodes in the DG.

The DG itself can be modified using a DG Modifer (MDGModifier).

Additionally, nodes can be added to and retrieved from selection lists using the Selection List (MSelectionList) class and Selection List Iterator (MItSelectionList). This can be useful for obtaining the root node for an iteration.

Attributes on the nodes can be manipulated using the Attribute Function Set (MFnAttribute) and its derivations.

+ Examples:

Public Types

enum  Direction { kDownstream, kUpstream }
 Direction within the DG relative to root Node or Plug. More...
 
enum  Traversal { kDepthFirst, kBreadthFirst }
 Perform a depth first or breadth first traversal. More...
 
enum  Level { kNodeLevel, kPlugLevel }
 Level of detail of the iteration. More...
 

Public Member Functions

 MItDependencyGraph (MObject &rootNode, MFn::Type filter=MFn::kInvalid, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kNodeLevel, MStatus *ReturnStatus=NULL)
 Constructor for a DG Iterator with a root node. More...
 
 MItDependencyGraph (MPlug &rootPlug, MFn::Type filter=MFn::kInvalid, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kPlugLevel, MStatus *ReturnStatus=NULL)
 Constructor for a DG Iterator with a root plug. More...
 
 MItDependencyGraph (MObject &rootNode, MPlug &rootPlug, MIteratorType &infoObject, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kNodeLevel, MStatus *ReturnStatus=NULL)
 Constructor for a DG Iterator with a root node or a root plug. More...
 
 ~MItDependencyGraph ()
 Class destructor.
 
MStatus reset ()
 Clears iterator data and resets the iterator to the root node or plug. More...
 
MStatus resetTo (MObject &rootNode, MFn::Type filter=MFn::kInvalid, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kNodeLevel)
 Clears iterator data and re-initializes the iterator. More...
 
MStatus resetTo (MPlug &rootPlug, MFn::Type filter=MFn::kInvalid, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kPlugLevel)
 Clears iterator data and re-initializes the iterator. More...
 
MStatus resetTo (MObject *rootNode, MPlug *rootPlug, MIteratorType &infoObject, Direction direction=kDownstream, Traversal traversal=kDepthFirst, Level level=kPlugLevel)
 Clears iterator data and re-initializes the iterator. More...
 
MObject rootNode (MStatus *ReturnStatus=NULL)
 Retrieves the root node of the iteration. More...
 
MPlug rootPlug (MStatus *ReturnStatus=NULL)
 Retrieves the root plug of the iteration. More...
 
MFn::Type currentFilter (MStatus *ReturnStatus=NULL)
 Retrieves the current node type filter. More...
 
MStatus setCurrentFilter (MFn::Type filter=MFn::kInvalid)
 Sets the node or plug filter. More...
 
MStatus resetFilter ()
 Resets the node or plug filter to default, MFn::kInvalid (filter disabled). More...
 
bool isPruningOnFilter (MStatus *ReturnStatus=NULL)
 Tests whether or not the iteration path is pruned automatically at nodes or plugs which do not match the filter. More...
 
MStatus enablePruningOnFilter ()
 Enables automatic pruning of iteration path at nodes or plugs which do not match the filter. More...
 
MStatus disablePruningOnFilter ()
 Disables automatic pruning of iteration path at nodes or plugs which do not match the filter. More...
 
bool isDirectionDownStream (MStatus *ReturnStatus=NULL)
 Tests whether or not the iteration is moving downstream (in the direction of data flow) in the DG. More...
 
Direction currentDirection (MStatus *ReturnStatus=NULL)
 Reports the direction of the iteration through the graph. More...
 
MStatus toggleDirection ()
 Toggles the direction of the iteration. More...
 
bool isTraversalDepthFirst (MStatus *ReturnStatus=NULL)
 Tests whether or not the iteration is proceeding depth first (away from the root of the iteration) in the DG. More...
 
Traversal currentTraversal (MStatus *ReturnStatus=NULL)
 Reports the traversal mode of the iteration through the graph. More...
 
MStatus toggleTraversal ()
 Toggles the traversal of the iteration. More...
 
bool atNodeLevel (MStatus *ReturnStatus=NULL)
 Tests whether or not the iteration is at the node level of detail (every node is visited only once) in the DG. More...
 
Level currentLevel (MStatus *ReturnStatus=NULL)
 Reports the level of the iteration through the graph. More...
 
MStatus setTraversalOverWorldSpaceDependents (bool val)
 This method controls whether the iterator will include world-space attribute dependencies in its traversal. More...
 
bool isTraversingOverWorldSpaceDependents (MStatus *ReturnStatus=NULL)
 Tests whether the iterator is set to traverse world-space attribute dependencies. More...
 
MStatus toggleLevel ()
 Toggles the level of the iteration. More...
 
MStatus next ()
 Iterates to the next node or plug in accordance with the direction, traversal, level and filter. More...
 
bool isDone (MStatus *ReturnStatus=NULL)
 Indicates whether or not all nodes or plugs have been iterated over in accordance with the direction, traversal, level and filter. More...
 
MStatus prune ()
 Prunes the search path at the current plug. More...
 
MObject thisNode (MStatus *ReturnStatus=NULL)
 This method is obsolete. More...
 
MObject currentItem (MStatus *ReturnStatus=NULL)
 Retrieves the current node of the iteration. More...
 
bool thisNodeHasUnknownType (MStatus *ReturnStatus=NULL)
 Indicates whether or not the current node has an unrecognised type. More...
 
MPlug thisPlug (MStatus *ReturnStatus=NULL)
 Retrieves the current plug of the iteration. More...
 
MPlug previousPlug (MStatus *ReturnStatus=NULL)
 Retrieves the previous plug of the iteration. More...
 
MStatus getNodesVisited (MObjectArray &nodesVisted) const
 Retrieves all nodes visited during the iteration. More...
 
MStatus getPlugsVisited (MPlugArray &plugsVisted) const
 Retrieves all plugs visited during the iteration. More...
 
MStatus getNodePath (MObjectArray &path) const
 Retrieves the direct path from the current node to the root node. More...
 
MStatus getPlugPath (MPlugArray &path) const
 Retrieves the direct path from the current plug to the root plug, with the current plug in element 0 of the array and the root plug in the final element of the array. More...
 

Static Public Member Functions

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

Member Enumeration Documentation

enum Direction

Direction within the DG relative to root Node or Plug.

Enumerator
kDownstream 

From source to destination.

kUpstream 

From destination to source.

enum Traversal

Perform a depth first or breadth first traversal.

Enumerator
kDepthFirst 

Away from root first.

kBreadthFirst 

Equidistant from root first.

enum Level

Level of detail of the iteration.

Enumerator
kNodeLevel 

Visit each Node at most once.

kPlugLevel 

Visit each Plug at most once.

Constructor & Destructor Documentation

MItDependencyGraph ( MObject rootNode,
MFn::Type  filter = MFn::kInvalid,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kNodeLevel,
MStatus ReturnStatus = NULL 
)

Constructor for a DG Iterator with a root node.

If a valid filter is enabled, the iterator automatically advances to the next node after the root node that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootNodeRoot node
[in]filterObject type filter (see MFn::Type)
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
[out]ReturnStatusStatus Code (see below)
Status Codes:
MItDependencyGraph ( MPlug rootPlug,
MFn::Type  filter = MFn::kInvalid,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kPlugLevel,
MStatus ReturnStatus = NULL 
)

Constructor for a DG Iterator with a root plug.

The type of root and the level of the iteration are independent. If a valid filter is enabled, the iterator automatically advances to the next node after the root node that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootPlugRoot plug
[in]filterObject type filter (see MFn::Type)
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
[out]ReturnStatusStatus Code (see below)
Status Codes:
MItDependencyGraph ( MObject rootNode,
MPlug rootPlug,
MIteratorType infoObject,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kNodeLevel,
MStatus ReturnStatus = NULL 
)

Constructor for a DG Iterator with a root node or a root plug.

If the root node is to be specified, then the root plug will be null. If root plug is non-null, then null should be passed on to root node. The type of root and the level of the iteration are independent. If a valid filter is enabled, the iterator automatically advances to the next node after the root node that matches one of the filter in the filter list, which is specified thro' MIteratorType object. no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootNodeRoot node, to which the iterator has to be set to, This can be NULL if we are resetting the root to plug object.
[in]rootPlugRoot plug, to which the iterator has to be set to, This can be NULL if we are resetting the root to node object.
[in]infoObjectMIteratorType object, having info about the filter list.
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
[out]ReturnStatusStatus Code (see below)
Status Codes:

Member Function Documentation

MStatus reset ( )

Clears iterator data and resets the iterator to the root node or plug.

If a valid filter is enabled, the iterator automatically advances to the next node after the root node that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Returns
Status Code
Status Codes:
MStatus resetTo ( MObject rootNode,
MFn::Type  filter = MFn::kInvalid,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kNodeLevel 
)

Clears iterator data and re-initializes the iterator.

If a valid filter is provided, the iterator automatically advances to the next node after the root node that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootNodeRoot node of the iteration
[in]filterObject type filter (see MFn::Type)
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
Returns
Status Code
Status Codes:
  • MS::kSuccess Iterator created
  • MS::kInvalidParameter Invalid parameter passed for direction, traversal, or level - default used, or Invalid parameter passed for root node - node does not exist or is not accesible
  • MS::kFailure Iterator not reset - iterator does not exist or is not accessible
MStatus resetTo ( MPlug rootPlug,
MFn::Type  filter = MFn::kInvalid,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kPlugLevel 
)

Clears iterator data and re-initializes the iterator.

If a valid filter is enabled, the iterator automatically advances to the next node after the root node that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootPlugRoot plug of the iteration
[in]filterObject type filter (see MFn::Type)
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
Returns
Status Code
Status Codes:
  • MS::kSuccess Iterator created
  • MS::kInvalidParameter Invalid parameter passed for direction, traversal, or level - default used, or Invalid parameter passed for root node - node does not exist or is not accesible
  • MS::kFailure Iterator not reset - iterator does not exist or is not accessible
MStatus resetTo ( MObject rootNode,
MPlug rootPlug,
MIteratorType infoObject,
Direction  direction = kDownstream,
Traversal  traversal = kDepthFirst,
Level  level = kPlugLevel 
)

Clears iterator data and re-initializes the iterator.

The filter list is reset to the new list specified thro' MIteratorType object. If a valid filter is enabled, the iterator automatically advances to the next node after the root node/plug that matches the filter. If no matching node is found the status is failure (MFn::kFailure).

Parameters
[in]rootNodeRoot Node of the iteration. This can be null if the root has to be reset to plug.
[in]rootPlugRoot plug of the iteration. This can be null if the root has to be reset to node.
[in]infoObjectMIteratorType Object which has info about the filter list and the object type, the root will be reset to.
[in]directionPrimary direction of iteration
[in]traversalOrder of traversal
[in]levelLevel of detail of the iteration
Returns
Status Code
Status Codes:
  • MS::kSuccess Iterator created
  • MS::kInvalidParameter Invalid parameter passed for direction, traversal, or level - default used, or Invalid parameter passed for root node - node does not exist or is not accesible
  • MS::kFailure Iterator not reset - iterator does not exist or is not accessible
MObject rootNode ( MStatus ReturnStatus = NULL)

Retrieves the root node of the iteration.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
The root node
Status Codes:
  • MS::kSuccess Root node is valid
  • MS::kFailure Root node not retrieved - iterator does not exist or is not accessible, or root node does not exist or is not accessible
MPlug rootPlug ( MStatus ReturnStatus = NULL)

Retrieves the root plug of the iteration.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
The root plug
Status Codes:
  • MS::kSuccess Root plug is valid
  • MS::kFailure Root plug not retrieved - iterator does not exist or is not accessible, or root plug does not exist or is not accessible
MFn::Type currentFilter ( MStatus ReturnStatus = NULL)

Retrieves the current node type filter.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
The current node type filter
Status Codes:
MStatus setCurrentFilter ( MFn::Type  filter = MFn::kInvalid)

Sets the node or plug filter.

Plug filtering is based on the type of the corresponding Attribute. Defaults to disabled (MFn::kInvalid). If a valid filter is specified, the iterator automatically advances to the next node that matches the filter. If no matching node status is failure (MFn::kFailure).

Disables pruning on the new filter (default). Use enablePruningOnFilter() method to enable pruning. No other iterator data is changed. If new filter is the same as current filter, no action is taken.

Parameters
[in]filternode or Attribute type filter (see MFn::Type)
Returns
Status Code
Status Codes:
MStatus resetFilter ( )

Resets the node or plug filter to default, MFn::kInvalid (filter disabled).

Disables pruning on the filter (default). Resets the iterator.

Returns
Status Code
Status Codes:
bool isPruningOnFilter ( MStatus ReturnStatus = NULL)

Tests whether or not the iteration path is pruned automatically at nodes or plugs which do not match the filter.

Parameters
[in]ReturnStatusStatus Code (see below)
Returns
Bool: true if pruning is enabled, false otherwise.
Status Codes:
  • MS::kSuccess State is valid
  • MS::kFailure Pruning state not known (default returned) - iterator does not exist or is not accessible
MStatus enablePruningOnFilter ( )

Enables automatic pruning of iteration path at nodes or plugs which do not match the filter.

Returns
Status Code
Status Codes:
MStatus disablePruningOnFilter ( )

Disables automatic pruning of iteration path at nodes or plugs which do not match the filter.

Returns
Status Code
Status Codes:
+ Examples:
bool isDirectionDownStream ( MStatus ReturnStatus = NULL)

Tests whether or not the iteration is moving downstream (in the direction of data flow) in the DG.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Direction is valid
  • MS::kFailure Direction not known (default returned) - iterator does not exist or is not accessible
MItDependencyGraph::Direction currentDirection ( MStatus ReturnStatus = NULL)

Reports the direction of the iteration through the graph.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Direction is valid
  • MS::kFailure Direction not known (default returned) - iterator does not exist or is not accessible
MStatus toggleDirection ( )

Toggles the direction of the iteration.

Resets the root of the iteration to the current node or plug depending on the level of iteration. Clears iterator path data. If a valid filter is enabled, the iterator automatically advances to the next node that matches the filter. If no matching node is found the status is failure (MFn::kFailure). No other iterator parameters are affected.

Returns
Status Code
Status Codes:
bool isTraversalDepthFirst ( MStatus ReturnStatus = NULL)

Tests whether or not the iteration is proceeding depth first (away from the root of the iteration) in the DG.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Traversal is valid
  • MS::kFailure Traversal not known (default returned) - iterator does not exist or is not accessible
MItDependencyGraph::Traversal currentTraversal ( MStatus ReturnStatus = NULL)

Reports the traversal mode of the iteration through the graph.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Traversal is valid
  • MS::kFailure Traversal not known (default returned) - iterator does not exist or is not accessible
MStatus toggleTraversal ( )

Toggles the traversal of the iteration.

Resets the root of the iteration to the current node or plug depending on the level of iteration. Clears iterator path data. If a valid filter is enabled, the iterator automatically advances to the next node that matches the filter. If no matching node is found the status is failure (MFn::kFailure). No other iterator parameters are affected.

Returns
Status Code
Status Codes:
bool atNodeLevel ( MStatus ReturnStatus = NULL)

Tests whether or not the iteration is at the node level of detail (every node is visited only once) in the DG.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Level is valid
  • MS::kFailure Level not known (default returned) - iterator does not exist or is not accessible
MItDependencyGraph::Level currentLevel ( MStatus ReturnStatus = NULL)

Reports the level of the iteration through the graph.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Status Codes:
  • MS::kSuccess Level is valid
  • MS::kFailure Level not known (default returned) - iterator does not exist or is not accessible
MStatus setTraversalOverWorldSpaceDependents ( bool  val)

This method controls whether the iterator will include world-space attribute dependencies in its traversal.

For example, say there is an animation curve attached to the translateX attribute on a transform, and an upstream iterator starts at the worldMatrix attribute. If world-space traversal is enabled, the iterator will get to the animation curve. Note however that even when world-space traversal is enabled, the iterator will only iterate to connected nodes. It does not iterate up and down through the dag hierarchy.

By default, traversal of world-space dependencies is disabled.

Parameters
[in]valTrue to enable traversal of world-space dependencies, false to disable.
Returns
Status Code
Status Codes:
bool isTraversingOverWorldSpaceDependents ( MStatus ReturnStatus = NULL)

Tests whether the iterator is set to traverse world-space attribute dependencies.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
  • true Traversing of world-space attributes is enabled.
  • false Traversing of world-space attributes is disabled.
Status Codes:
MStatus toggleLevel ( )

Toggles the level of the iteration.

Resets the root of the iteration to the current node or plug depending on the level of iteration. Clears iterator path data. If a valid filter is enabled, the iterator automatically advances to the next node that matches the filter. If no matching node is found the status is failure (MFn::kFailure). No other iterator parameters are affected.

Returns
Status Code
Status Codes:
MStatus next ( )

Iterates to the next node or plug in accordance with the direction, traversal, level and filter.

If a valid filter is set, the iterator only visits those nodes that match the filter. When filtering is enabled nodes that have unknown type are treated as non-matching nodes. With filtering disabled, iteration to a node with an unknown type is treated as a failure. An attempt to iterate when there is nothing left to iterate over has no effect.

Returns
Status Code
Status Codes:
  • MS::kSuccess Iteration successful, or the iteration was already complete (i.e. isDone() was already true), or nothing left to iterate over.
  • MS::kFailure Could not iterate - iterator does not exist or is not accessible, or node has unrecognized type, or Attribute of plug is inaccessible, or could not update plug path length.
+ Examples:
bool isDone ( MStatus ReturnStatus = NULL)

Indicates whether or not all nodes or plugs have been iterated over in accordance with the direction, traversal, level and filter.

If a valid filter is set, the iterator only visits those nodes that match the filter.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
  • true Iteration is done
  • false Iteration is not done
Status Codes:
+ Examples:
MStatus prune ( )

Prunes the search path at the current plug.

Iterator will not visit any of the plugs connected to the pruned plug.

Returns
Status Code
Status Codes:
  • MS::kSuccess Path pruned.
  • MS::kFailure Could not prune path - iterator does not exist or is not accessible, or iteration is done
MObject thisNode ( MStatus ReturnStatus = NULL)

This method is obsolete.

Deprecated:
Use the MItDependencyGraph::currentItem method instead.

Retrieves the current node of the iteration. Results in a null object on failure or if the node is of a unrecognized type.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Current node
Status Codes:
  • MS::kSuccess node is valid
  • MS::kFailure node not retrieved. Iterator does not exist or is not accessible, or node does not exist or is not accessible, or node type is not recognized, or iteration is done (null Object returned)
+ Examples:
MObject currentItem ( MStatus ReturnStatus = NULL)

Retrieves the current node of the iteration.

Results in a null object on failure or if the node is of a unrecognized type.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Current node
Status Codes:
  • MS::kSuccess node is valid
  • MS::kFailure node not retrieved - iterator does not exist or is not accessible, or node does not exist or is not accessible, or node type is not recognized, or iteration is done (null Object returned)
bool thisNodeHasUnknownType ( MStatus ReturnStatus = NULL)

Indicates whether or not the current node has an unrecognised type.

This is useful if an unexpected failure is encountered in the next() or thisNode() methods.

Returns true only if node exists but is not a recognizable type.

Returns false if node exists and is recognizable. Also returns false on failure or if the iteration is done.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
  • true Unknown type
  • false Type is known or iterator is done or failure encountered
Status Codes:
  • MS::kSuccess Return valid
  • MS::kFailure Return not valid - iterator does not exist or is not accessible, or node does not exist or is not accessible
MPlug thisPlug ( MStatus ReturnStatus = NULL)

Retrieves the current plug of the iteration.

Results in a null plug on failure.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
Current plug
Status Codes:
  • MS::kSuccess plug is valid
  • MS::kFailure plug not retrieved - the iteration is done, iterator does not exist or is not accessible, or plug does not exist or is not accessible (null plug returned)
MPlug previousPlug ( MStatus ReturnStatus = NULL)

Retrieves the previous plug of the iteration.

Results in a null plug on failure. Null plug may also indicate that the current plug is the root plug.

Parameters
[out]ReturnStatusStatus Code (see below)
Returns
  • Current plug
Status Codes:
  • MS::kSuccess plug is valid
  • MS::kFailure plug not retrieved - iterator does not exist or is not accessible, plug does not exist or is not accessible, or current plug may be root plug (null plug returned)
MStatus getNodesVisited ( MObjectArray nodes) const

Retrieves all nodes visited during the iteration.

State of the provided array is undefined if this method fails.

Parameters
[out]nodesTarget array for retrieved nodes. On success contains all nodes visited
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Could not retrieve nodes - iterator does not exist or is not accessible, or list of nodes does not exist or is not accessible;
MStatus getPlugsVisited ( MPlugArray plugs) const

Retrieves all plugs visited during the iteration.

State of the provided array is undefined if this method fails.

Parameters
[out]plugsTarget array for retrieved plugs. On success contains all plugs visited
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Could not retrieve plugs - iterator does not exist or is not accessible, or list of plugs does not exist or is not accessible;
MStatus getNodePath ( MObjectArray path) const

Retrieves the direct path from the current node to the root node.

Path does not include the current node. State of the provided array is undefined if this method fails.

Parameters
[out]pathTarget array for retrieved path. On success contains direct path from the current node to the root node
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Could not retrieve path - iterator does not exist or is not accessible, or path does not exist or is not accessible;
+ Examples:
MStatus getPlugPath ( MPlugArray path) const

Retrieves the direct path from the current plug to the root plug, with the current plug in element 0 of the array and the root plug in the final element of the array.

Once the iterator is done (i.e. isDone() returns true) there is no longer a current plug and this method will return an empty array.

If this method fails the state of the returned array is undefined.

Parameters
[out]pathTarget array for retrieved path. On success contains direct path from the current plug to the root plug
Returns
Status Code
Status Codes:
  • MS::kSuccess
  • MS::kFailure Could not retrieve path - iterator does not exist or is not accessible, or path does not exist or is not accessible;
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:
  • MItDependencyGraph.h
  • MItDependencyGraph.cpp