Python API 2.0 Reference
OpenMaya.MItDependencyGraph Class Reference
+ Inheritance diagram for OpenMaya.MItDependencyGraph:

Public Member Functions

def __init__ ()
 
def __iter__ ()
 
def __next__ ()
 
def currentNode ()
 
def currentNodeHasUnknownType ()
 
def currentPlug ()
 
def getNodePath ()
 
def getNodesVisited ()
 
def getPlugPath ()
 
def getPlugsVisited ()
 
def isDone ()
 
def iter ()
 
def iternext ()
 
def next ()
 
def previousPlug ()
 
def prune ()
 
def reset ()
 
def resetFilter ()
 
def resetTo ()
 
def rootNode ()
 
def rootPlug ()
 

Static Public Member Functions

def __new__ ()
 

Static Public Attributes

int kBreadthFirst = 1
 
int kConnectedTo = 1
 
int kDependsOn = 0
 
int kDepthFirst = 0
 
int kDownstream = 0
 
int kEvaluationGraph = 2
 
int kNodeLevel = 0
 
int kPlugLevel = 1
 
int kUpstream = 1
 

Properties

 currentDirection = property(...)
 
 currentFilter = property(...)
 
 currentLevel = property(...)
 
 currentRelationship = property(...)
 
 currentTraversal = property(...)
 
 nodeDepth = property(...)
 
 pruningOnFilter = property(...)
 
 traversingOverWorldSpaceDependents = property(...)
 

Detailed 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), level of detail (Node level or Plug
level) and relationship (dependency, DG connection, eval graph) 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.

Constructor & Destructor Documentation

def OpenMaya.MItDependencyGraph.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMaya.MItDependencyGraph.__iter__ ( )
Implement iter(self).
def OpenMaya.MItDependencyGraph.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMaya.MItDependencyGraph.__next__ ( )
Implement next(self).
def OpenMaya.MItDependencyGraph.currentNode ( )
currentNode() -> MObject

Retrieves the current node of the iteration.  Results in a null object on
failure or if the node is of a unrecognized type.
def OpenMaya.MItDependencyGraph.currentNodeHasUnknownType ( )
currentNodeHasUnknownType() -> Bool

Indicates whether or not the current node has an unrecognised
type.  This is useful if an unexpected failure is encountered
in the next() or currentNode() methods.
def OpenMaya.MItDependencyGraph.currentPlug ( )
currentPlug() -> MPlug

Retrieves the current plug of the iteration.  Results in a null
plug on failure.
def OpenMaya.MItDependencyGraph.getNodePath ( )
getNodePath() -> MObjectArray

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.
def OpenMaya.MItDependencyGraph.getNodesVisited ( )
getNodesVisited() -> MObjectArray

Retrieves all nodes visited during the iteration.
State of the provided array is undefined if this method fails.
def OpenMaya.MItDependencyGraph.getPlugPath ( )
getPlugPath() -> MPlugArray

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.
def OpenMaya.MItDependencyGraph.getPlugsVisited ( )
getPlugsVisited() -> MPlugArray

Retrieves all plugs visited during the iteration.
State of the provided array is undefined if this method fails.
def OpenMaya.MItDependencyGraph.isDone ( )
isDone() -> Bool

Indicates whether or not all nodes or plugs have been iterated over
in accordance with the direction, traversal, level, relationship and filter.
If a valid filter is set, the iterator only visits those nodes that match
the filter.
def OpenMaya.MItDependencyGraph.iter ( )
iter() -> self

Initializes the iterator object for pythonic iteration.
def OpenMaya.MItDependencyGraph.iternext ( )
iternext() -> self

Used in pythonic iteration to move the iterator
def OpenMaya.MItDependencyGraph.next ( )
next() -> self

Iterates to the next node or plug in accordance with the
direction, traversal, level, relationship 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.
def OpenMaya.MItDependencyGraph.previousPlug ( )
previousPlug() -> MPlug

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.
def OpenMaya.MItDependencyGraph.prune ( )
prune() -> self

Prunes the search path at the current plug.  Iterator will not
visit any of the plugs connected to the pruned plug.
def OpenMaya.MItDependencyGraph.reset ( )
reset() -> self

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 an
exception is thrown.
def OpenMaya.MItDependencyGraph.resetFilter ( )
resetFilter() -> self

Resets the node or plug filter to default, MFn.kInvalid
(filter disabled).  Disables pruning on the filter (default).
Resets the iterator.
def OpenMaya.MItDependencyGraph.resetTo ( )
resetTo(rootObject, filter = MFn.kInvalid, direction = MItDependencyGraph.kDownstream, traversal = MItDependencyGraph.kDepthFirst, level = MItDependencyGraph.kNodeLevel, relationship = MItDependencyGraph.kDependsOn) -> self
resetTo(rootPlug, filter = MFn.kInvalid, direction = MItDependencyGraph.kDownstream, traversal = MItDependencyGraph.kDepthFirst, level = MItDependencyGraph.kNodeLevel, relationship = MItDependencyGraph.kDependsOn) -> self
resetTo(infoObject, rootObject OR rootPlug, direction = MItDependencyGraph.kDownstream, traversal = MItDependencyGraph.kDepthFirst, level = MItDependencyGraph.kNodeLevel, relationship = MItDependencyGraph.kDependsOn) -> self


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 an exception is thrown.


   rootObject (MObject) - Root node to begin the next traversal.
   rootPlug (MPlug) - Root plug to to begin the next traversal.
   infoObject (MIteratorType) - Iterator object having info on filter or filterlist.
   filter (MFn.Type) - Function set type, defaults to MFn.kInvalid
   direction (MItDependencyGraph.Direction) - Primary direction of iteration, defaults to MItDependencyGraph.kDownstream
   traversal (MItDependencyGraph.Traversal) - Order of traversal, defaults to MItDependencyGraph.kDepthFirst
   level (MItDependencyGraph.Level) - Level of detail of the iteration, defaults to MItDependencyGraph.kNodeLevel
   relationship (MItDependencyGraph.Relationship) - Relationship mode of the iteration, defaults to MItDependencyGraph.kDependsOn
def OpenMaya.MItDependencyGraph.rootNode ( )
rootNode() -> MObject

Retrieves the root node of the iteration.
def OpenMaya.MItDependencyGraph.rootPlug ( )
rootPlug() -> MPlug

Retrieves the root plug of the iteration.

Property Documentation

OpenMaya.MItDependencyGraph.currentDirection = property(...)
static
 Direction of the iteration through the graph (MItDependencyGraph.Direction).
OpenMaya.MItDependencyGraph.currentFilter = property(...)
static
 Current node type filter (MFn.Type) .
OpenMaya.MItDependencyGraph.currentLevel = property(...)
static
 Level of the iteration through the graph (MItDependencyGraph.Level).
OpenMaya.MItDependencyGraph.currentRelationship = property(...)
static
 Relationship mode of the iteration through the graph (MItDependencyGraph.Relationship).
OpenMaya.MItDependencyGraph.currentTraversal = property(...)
static
 Traversal mode of the iteration through the graph (MItDependencyGraph.Traversal).
OpenMaya.MItDependencyGraph.nodeDepth = property(...)
static
 Depth of the iteration through the graph (int).
OpenMaya.MItDependencyGraph.pruningOnFilter = property(...)
static
 Whether or not the iteration path is pruned automatically at nodes or plugs which do not match the filter (Bool).
OpenMaya.MItDependencyGraph.traversingOverWorldSpaceDependents = property(...)
static
 Whether the iterator is set to traverse world-space attribute dependencies (Bool).