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

Public Member Functions

def __init__ ()
 
def __iter__ ()
 
def __next__ ()
 
def currentItem ()
 
def depth ()
 
def fullPathName ()
 
def getAllPaths ()
 
def getPath ()
 
def instanceCount ()
 
def isDone ()
 
def isInstanced ()
 
def iter ()
 
def iternext ()
 
def next ()
 
def partialPathName ()
 
def prune ()
 
def reset ()
 
def root ()
 
def traversalType ()
 

Static Public Member Functions

def __new__ ()
 

Static Public Attributes

int kBreadthFirst = 2
 
int kDepthFirst = 1
 
int kInvalidType = 0
 

Properties

 traverseUnderWorld = property(...)
 

Detailed Description

DAG Iterator.

Use the DAG iterator to traverse the DAG either depth first or breadth
first, visiting each node and, if desired, retrieving the node (as an
MObject).  The DAG iterator provides a basic filtering capability, so
that DAG node retrieval can be limited to a  specific type (MFn.Type)
of node.  With filtering enabled the iterator checks to see if the node
is compatible with the type of Function Set specified by the filter.
See MFn.Type for a list of all valid Function set types.

Since each object, if retrieved, is returned as an MObject, the
MObject.hasFn() method can be used to further check for compatible
function set types since an MObjects may be compatible with more than
one function set).

Any compatible Function Set can be attached to the retrieved object to
query or or edit it.  Often you will want to use the DAG node Function
Set (MFnDagNode), which is compatible with all DAG objects, to perform
basic queries on each node as the iterator traverses the DAG.

The iterator also provides the capability to reset the root of the
iteration, the type of traversal, and the filter.

Additionally, the iterator can be queried for the root, mode and type
of traversal, and to determine if the the traversal has been completed.

Constructor & Destructor Documentation

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

Member Function Documentation

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

Retrieves DAG node to which the iterator points.
def OpenMaya.MItDag.depth ( )
depth() -> integer

Returns the height or depth of the current node in the DAG relative to the
root node.  The root node has a depth of zero.
def OpenMaya.MItDag.fullPathName ( )
fullPathName() -> MString

Return a string representing the full path from the root of the dag to this object.
def OpenMaya.MItDag.getAllPaths ( )
getAllPaths() -> MDagPathArray

Determines all DAG Paths to current item in the iteration.
def OpenMaya.MItDag.getPath ( )
getPath() -> MDagPath

Determines a DAG Path to the current item in the iteration.
def OpenMaya.MItDag.instanceCount ( )
instanceCount(total) -> Integer

Determines the number of times the current item (DAG node) in the iteration
is instanced.

If total is False the number of direct instances is returned, which
is the same as the node's parent count.

If total is True the total number of instances is returned, including
indirect instances resulting from instancing higher up the DAG hierarchy
(i.e. one or more of the node's ancestors also has multiple instances).
def OpenMaya.MItDag.isDone ( )
isDone() -> Bool

Indicates end of iteration path.
def OpenMaya.MItDag.isInstanced ( )
isInstanced(indirect = True) -> Bool

Determines whether the current item (DAG node) in the iteration is directly
or indirectly instanced.

If indirect instance flag is False, the result is True if and only if the
Node itself is multiply instanced (node.parentCount > 1).

If the indirect flag is True, the result is True if and only if the Node
itself is multiply instanced (node.parentCount > 1) or if the Node is not
multiply instanced, but it has a directly instanced parent
(node.parentCount()=1 and parent.parentCount >1).

* indirect (Bool) -Indirect instance flag, defaults to True.
def OpenMaya.MItDag.iter ( )
iter() -> self

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

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

Moves to the next node matching the filter in the graph.
def OpenMaya.MItDag.partialPathName ( )
partialPathName() -> MString

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

Prunes iteration tree at current node.
def OpenMaya.MItDag.reset ( )
reset() -> self
reset(rootObject, traversalType = MItDag.kDepthFirst, filterType = MFn.kInvalid) -> self
reset(rootPath, traversalType = MItDag.kDepthFirst, filterType = MFn.kInvalid) -> self
reset(dagInfoObject, rootObject OR rootPath, traversalType = MItDag.kDepthFirst) -> self


Resets the iterator.
When used without parameters, the iterator is reset to the previous traversal setting.
If a dagInfoObject is used, then the type of the provided rootObject or rootPath must
match dagInfoObject.objectType.

   rootObject (MObject) - Root node to begin the next traversal.
   rootPath (MDagPath) - Root path to to begin the next traversal. Useful with instances.
   dagInfoObject (MIteratorType) - Iterator object having info on filter or filterlist.
   traversalType (MItDag.TraversalType) - Enumerated type that determines the direction of the traversal, defaults to kDepthFirst.
   filterType (MFn.Type) - Function set type, defaults to MFn.kInvalid
def OpenMaya.MItDag.root ( )
root() -> MObject

Returns the root (start node) of the current traversal.
The constructor sets the root of traversal to the world node.
The root can be changed by the reset() method.
def OpenMaya.MItDag.traversalType ( )
traversalType() -> MItDag.TraversalType

Returns the direction of the traversal.

Property Documentation

OpenMaya.MItDag.traverseUnderWorld = property(...)
static
 Specifies whether underworld traversal is turned on (Bool).