Transforms with multiple shapes

 
 
 

A transform node can have any number of transform nodes as children. In general, a transform node can only have a single shape node as a child, and when viewing the DAG through an interactive window this will always be the case. However when examining the DAG through the API you will find that transforms may have multiple shape nodes as children. This happens when the original shape under the transform has been modified by the dependency graph. To maintain the transformations on the result of the dependency graph, the result is placed under the same transform as the original node. The new node would have the same DAG transforms applied as the original, but would be modified in some way (for example, its CVs could have been moved). When this happens, only the final product is visible in an interactive window, and the original nodes are historical.

|Transform1|Shape1 is the original historical object while |Transform1|Shape1a is the actual object visible in any interactive window. |Transform1|Shape1 is also called an intermediate object.This is important later when working with the dependency graph.

WarningIf you use the MDagPath::extendToShape() method on a path whose last node is a transform that contains multiple shapes, the first child shape node will be the node that is added onto the end of the path. If this is not the desired node, it is recommended that you not use the extendToShape() method. Instead, use the MDagPath::child() and MDagPath::childCount() methods to help examine and access the desired shape node.

Additionally, there is an MDagPath::extendToShapeDirectlyBelow(unsigned int index) method that can be used to extend to the correct child shape.

The Underworld

The "underworld" is a name given to the parameter space of a shape node, such as the UV space of a NURBS surface. Nodes and whole subgraphs of nodes may be defined in this underworld space.

For example, the transform and shape nodes that define a curve on a NURBS surface. The control points defining the curve are in the UV space of the surface. The paths that uniquely identify the nodes of an underworld are rooted inside the shape node which defines the parameter space of the underworld. The first node of an underworld path is the first node that is defined in the parameter space of the containing shape. Most likely this first node is a transform node.

Underworld paths are specified in Maya like regular paths, using the "|" character to separate the node names in the path. The extra nomenclature is the use of the "->" characters to specify the transition between the shape node and the root node of the underworld path.

For example, the complete specification of a path to a curve on surface node of a NURBS surface could be listed as |SurfaceTransform|NURBSSurface->UnderworldTransform|CurvesShape. Underworlds may be recursively defined on the shapes in the underworld as long as the shapes have some parameter space which defines them.

The MDagPath contains methods for accessing the different paths from a shape down through its underworld. The methods MDagPath::pathCount() method returns the total number of paths represented by the given MDagPath instance. In the above curve on surface example, if the MDagPath instance represents the path down to the curve shape in the underworld, the pathCount would be 2. The MDagPath::getPath() method returns a path, either in the underworld or in the 3D space. Path 0 always specifies the 3D path. Path 1 specifies the path in the underworld directly inside the shape at the end of path 0. Path 2 specifies the path in the underworld inside the shape at the end of path 1, and so forth.