# MFnDagNode

## Base Class

MFnDependencyNode

## Constants

Name | Type | Description
--- | --- | ---
kNextPos | int | Used by addChild() to indicate the next empty position in the list.

## Static Methods

None.

## Constructors

Signature | Parameters | Description
--- | --- | ---
MFnDagNode() |  | Default constructor. Returns a new MFnDagNode function set with no Maya object attached.
MFnDagNode(object) | object - MObject | Returns a new MFnDagNode function set, attached to the specified Maya object.
MFnDagNode(path) | path - MDagPath | Returns a new MFnDagNode function set, attached to the object at the end of the specified DAG path.

## Object Methods

Signature | Parameters | Returns | Description
--- | --- | --- | ---
addChild(node, index=kNextPos, keepExistingParents=False) | node - MObject index - int keepExistingParents - bool | Reference to self. | Parent's node under this node, making it the index'th child and moving other children down to make room, if necessary. If index is kNextPos then it is added to the end of the list of children. If keepExistingParents is False the child node will be removed from its existing parents, otherwise they will be retained.
child(index) | index - int | MObject | Returns the node's index'th child.
childCount() |  | int | Returns the number of nodes which are parented under this one.
create(type, name=None, parent=MObject.kNullObj) | type - string or MTypeId name - string parent - MObject | MObject | Creates a new DAG node of the specified type, with the given name. type may be either a type name or a type ID. If no name is given then a unique name will be generated by combining the type name with an integer. If a parent is given then the new node will be parented under it and the functionset will be attached to the newly-created node. The newly-created node will be returned. If no parent is given and the new node is a transform, it will be parented under the world and the functionset will be attached to the newly-created transform. The newly-created transform will bereturned. If no parent is given and the new node is not a transform then a transform node will be created under the world, the new node will be parented under it, and the functionset will be attached to the transform. The transform will be returned.
dagPath() |  | MDagPath | Returns the DAG path to which this function set is attached. Raises a TypeError if the function set is not attached to a path (e.g. it was initialized with an MObject).
dagRoot() |  | MObject | Returns the root node of the first path leading to this node.
duplicate(instance=False, instanceLeaf=False) | instance - bool instanceLeaf - bool | MObject | Duplicates the DAG hierarchy rooted at the current node. The copy will have the same parent, if any, as the original node. If instance is false then a true copy will be made, otherwise a new node will be created which instances the child nodes of the original node. If instance is false then instanceLeaf is ignored. If instance is true and instanceLeaf is false then the child nodes of the original node are instanced. If instanceLeaf is true, then the results are similar to a copy, but the leaf level objects are instanced. Returns the new node at the top of the duplicated hierarchy.
fullPathName() |  | string | Returns the full path of the attached object, from the root of the DAG on down.
getAllPaths() |  | MDagPathArray | Returns all of the DAG paths which lead to the object to which this function set is attached.
getPath() |  | MDagPath | Returns the DAG path to which this function set is attached. If the function set is attached to an MObject rather tha a DAG path then the first path to the object will be returned.
hasChild(node) | node - MObject | bool | Returns True if node is a child of this node.
hasParent(node) | node - MObject | bool | Returns True if node is a parent of this node.
instanceCount(indirect) | indirect - bool | int | Returns the number of instances for this node. If indirect is True then the instancing of ancestor nodes further up the DAG path is included, otherwise only the immediate instancing of this node is counted.
isChildOf(node) | node - MObject | bool | Alias for hasParent().
isInstanced(indirect=True) | indirect - bool | bool | Returns True if this node is instanced (i.e. has multiple parents). If indirect is True then the instancing of ancestor nodes further up the DAG path is included, otherwise not.
isInstancedAttribute(attr) | attr - MObject | bool | Returns True if attr is an instanced attribute of this node.
isParentOf(node) | node - MObject | bool | Alias for hasChild().
parent(index) | index - int | MObject | Returns the node's index'th parent.
parentCount() |  | int | Returns the number of different nodes under which this one is parented.
partialPathName() |  | string | Returns the minimum path necessary to uniquely identify the attached object.
removeChild(node) | node - MObject | Reference to self. | Removes node as a child of this node.
removeChildAt(index) | index - int | Reference to self. | Removes the index'th child from this node.
setObject(object) | object - MObject | Reference to self. | Attaches the function set to the specified object.
setObject(path) | object - MDagPath | Reference to self. | Attaches the function set to the specified DAG path.
transformationMatrix() |  | MMatrix | Returns the object space transformation matrix for this DAG node. In general, only transform nodes have matrices associated with them. Nodes such as shapes (geometry nodes) do not have transform matrices. The identity matrix will be returned if this node does not have a transformation matrix.

## Object Attributes

Name | Type | Access | Description
--- | --- | --- | ---
boundingBox | MBoundingBox | R |
inModel | bool | R |
inUnderWorld | bool | R |
isInstanceable | bool | RW |
isIntermediateObject | bool | RW |
objectColor | int | RW |
useObjectColor | bool | RW |

## Sequence Support

None.

## Number Support

None.

## Comparison Support

None.

© 2011 Autodesk, Inc. All rights reserved.