| Item | Quantity | Price | |
|---|---|---|---|
| Your cart is empty. Check out our collection of 3d models! | |||
Prices in:
Clear Cart
Some really crap notes i wrote years ago, some stuff is slightly in accurate, but i've learned a lot since then... http://www.robthebloke.org/mayaapi/MayaApi1_1.htm
Dependency Node == a node that has attributes that can depend on another. All nodes are dependency nodes (including dag nodes). A good example would be a material.
DAG Node == a transform or a shape. These are things that physically exist within the scene. They can be parented, but not in a cyclic way, i.e.
joint1 -> joint2 -> joint1
would be illegal.
A Dag path is the path to an object, for instance:
joint1->joint2->joint3
would be the path to joint3. A dag node may have one or more dag paths to it, for example:
transform1->mesh1
transform2->mesh1
transform3->transform4->transform5->mesh1
There would be a single mesh node (i.e. one dependency node for it), but there are three paths to the mesh, given by the long names: (these are perfectly valid to use in mel!)
|transform1|mesh1
|transform2|mesh1
|transform3|transform4|transform5|mesh1
You can construct a dag path from MObjects if you want, i.e. (in psuedo code, but hopefully you'll see what i mean)
MDagPath p;
p.push("transform1");
p.push("mesh1");
MFnDagNode is just a fuction set to ease access to a dag node. So, lets say i was to do something like this:
MObject o = getMobjectFromSomewhereFor("mesh1");
MFnDagNode fn(o);
now, the function set has been initialised by an MObject to mesh1. But, MObject is basically just a direct pointer to the mesh. If i tried to get the world space matrix from that mesh, how does the API know which instance of mesh1 to return? The answer is that it doesn't, so it just fails and returns the local space matrix.
So, instead we can initialise the function set with a dag path, i.e.
MDagPath p;
p.push("transform1");
p.push("mesh1");
MFnDagNode fn(p);
now the function set knows which instance we are talking about, and can give us back some world space data. Uhm, if that makes sense up to now, then cool, that's more or less all you need to know about....
but, one last thing that can happen, but is extremely rare (the GUI doesn't let you do it, you have to do this with mel or the API)....
It makes a lot of sense with the shape nodes, but the same can also apply to transforms, i.e:
|joint1
|joint2|joint1
|joint3|joint2|joint1
|joint5|joint1
the above paths to joint1 are all valid, which is why if you did this:
MFnDagNode fn( joint1 );
you get the funcs:
fn.parentCount();
fn.parent( instance_num );
uhm. hope that makes sense. In reality instanced transforms are extremely rare - infact i've never seen a Maya file with them unless i purposefully created one.
thanks man, I read it tonight, but I've got to spend tomorrow figuring out what it means!!
I've really been hacking my way through this, so I thought it would be much better (and I can stop bothering you guys!) if I actually understood what was going on.
Here's what I know:
DAG is directed acyclic graph, basically a tree structure that allows multiple parents. This is whole thing that Maya works with, the entire scene is stored in this DAG.
Each "thing" that a non Mayan would think is an object (like a sphere) is actually two things; a transform structure that describes the location in the world and a mesh structure that describes the size of the object and the number of triangles etc etc.
It seems that the transform is generally the parent node of the mesh node. Is that correct?
So I guess my confusion comes down to what is a DagNode vs a DagPath? I suppose a camera and a sphere should be pretty much the same in Maya's DAG, but I seem to have a whole different way to get attributes of a camera vs a mesh. Can you give me a one line description of MFnDagNode, MDependencyNode, and MFnDagPath and how they are related? The class descriptors didn't help my understanding much, and Rob the Bloke's website has great examples, but I still don't really understand what each of these structures is actually storing/their relationship to each other.
Maybe you have a good tutorial link that explains this already?
Thanks!
Dave