
hohehohe2's OpenMaya tutorial
kotamuraa@yahoo.co.jp
5. DAG hierarchy
(Skip this chapter if you already know)
DAG:Directed Acyclic Graph
Maya has 2 graphs. DAG and dependency graph(DG).
In this chapter I will describe about DAG.
I think It is better to accept DAG as it is, rather than thinking
"why"
when you study it.
DAG is a graph like this. It stands for Directed Acyclic
Graph. It is not
a Maya specific word, but is a term of graph theory (a field
of mathematics. (??)
I don't know about it)
Try searching Directed Acyclic Graph with google image search,
and you'll get
thousands of pictures like this.
In DAG, Multiple nodes can attach to other multiple nodes.
But it cannot have a loop. The next one is not a DAG.
DAG in Maya
Maya uses DAG for parent-child relations and for
groups.
Create a primitive (either nurbs
or polygon) then open the Hypergraph,
You will see a graph like below. Here, One nurbsSphere is created.
(you cannot the see the arrow tip).
If you can't see nurbsSphereShape1 node,
select Graph - Scene Hierarchy
select Options - Display - Shape Nodes
and Options - Display - Invisible Nodes
in the menu of the Hypergraph.
Create two more primitives, group all of them,
and look at the Hypergraph again.
Their are two types of DAG nodes in the graph.
One is a node representing shape data (or geometry) such as nurbsSurface,
nurbsCurve, mesh, light, these are called shape nodes. The other
is a node representing
transformation such as translation, rotation, scaling, this is
called a transform node.
In most cases, the lower class nodes (i.e. nodes where arrows
come from other nodes
but not go towards other node) are shape nodes, and the others
are transform nodes.
In the above graph, thin line boxes are shape nodes, and
thick line boxes are transform nodes.
(The underworld nodes are exceptions. See below.)
If there are only shape nodes, It would be very inconvenient
since you can't translate,
rotate, scale the nodes. So every Maya's scene object has a transform
node.
(?: There may be exceptions.)
So why are there two types?
Isn't it enough if there are translation, rotation, scaling attributes
in shape nodes?
The answer is, you separate shapes and transforms
to make instances. (?: maybe)
If there are two types, transform and shape, you can (Maya can)
express instances
in DAG hierarchy.
Look at the previous graph again.
Maya creates a scene objects per every pair of shape and
transform (?:really), you can
express instances if you one shape node has multiple transform
nodes.
As I mentioned before, thick line boxes are transform nodes.
There's one more thing to be described regarding DAG.
Usually shapes cannot have a child node. But there are cases a
shape is defined in
another shape's parameter space (U, V). Curve on surface, for instance.
The shape
defined in the coordinates of another shape's coordinate is called
an underworld
node and it is expressed like below in DAG.
(HELP)In the API manual, I see
Underworld nodes may be defined on the shapes as long as the shape
have
some parameter space.
kind of things, But I can't find any API functions that creates
an underworld node.
Also in the manual an example of a node having multiple nodes
as a child.
I do not understand it, so I cannot tell anything about it.
DAG path
DAG path indicates where a nodes is in the DAG hierarchy.
This is used to identify a node in the scene.
DAG path is like a windows path, which indicates where a folder
is
in your hard disk.
Windows use "\" to separate folder, Maya uses "|" to separate
nodes.
"->" is used between a regular node and an underworld node.
Let me give you some examples,
I don't think much explanation is needed. Node that there are
multiple paths
if there are instances.
There is another notation to specify an underworld node.
Writes only after
"->" and not before. (Not true)
I don't think this is important. (?)
Like windows folder, you can give the same name to two or
more nodes as long as
it is not in the same hierarchy. For example there are two "nurbsSphere1"
nodes.
Here if you write only "nurbsSphere1", Maya doesn't know which
of them you mean,
but if you write,
group1|nurbsSphere1
Maya can understand it is
|gourp3|group2|group1|nurbsSphere1
not
|group3|nurbsSphere1
A path like "group1|nurbsSphere1" is legal in Maya. This is called
"a partial path name" whereas a path such as
"|gourp3|group2|group1|nurbsSphere1" is called a "full path name".
If you select
|gourp3|group2|group1|nurbsSphere1
and in MEL, execute
ls -sl //returns a path of the object currently
selected
a partial path name
group1|nurbsSphere1
is returned.
Throughout MEL and API, it seems like a partial path name is more
often used than a full
path name. It may be more efficient. (??)
Prev Contents Next
Maya is a registered
trademark of Autodesk
Copyright ©
2003, Koichi Tamura. All Rights Reserved.