Object and node paths in Maya?


Hi there,

I come from Max and MAXScript environment and learning MEL/Maya recently, so, it may be obvious to some of you but I struggle in object/node navigation scheme in Maya/MEL.

For example: here’s what I’d do in Max in order to create a sphere, call it “MySphere” and then assign a, let’s say, point cache modifier.:

tmpSph = sphere name:"MySphere"
addModifier tmpSph Point_Cache()

and then I can browse through the pathnames in order to access the point cache and change its attributes:


etc… etc…

How can I browse through pathnames in MEL similar way? Let’s say I want to change some attributes on a node that is assigned to an object? How do I access such a node? What is the hierarchy scheme in MEL?

Thanks a lot in advance! :thumbsup:


There’s no hierarchy of that sort in Maya, it’s all based upon the dependency graph (DG) nodes. So maya is a bit trickier to navigate in that sense…

create a poly cube select it, and then goto the window->hypergraph: connections menu item. In max you’d see one object, $Box01. In Maya you’ll see it’s split into 3,

pCube1: the transform
polyCube1: the poly creator
pCubeShape1: the cached mesh result to be rendered

If you select a face on the mesh then delete it, you’ll see that the DG gets an additional deleteComponents node. The idea is that the mesh data is passed (as an attribute connection) down through the DG to the end result, and modified along the way. Unlike max, it’s not a linear stack, but a graph. (though with referencing you can almost duplicate some of the flexibility of maya). In maya you can still go and select the input nodes and modify their params as needed.

The mesh node has an input attr, “inMesh”, on which you can use the listConnections command to find out it’s inputs (and recurse to find all inputs to those inputs etc).

Anyhow, select the mesh, and select the edit->delete by type->history. This will remove all of the input nodes to the mesh, and leave you with a single object. Basically this is maya’s equivalent of “convert to editable poly”.

Anyhow, select the mesh and goto the create deformers menu (hit F2 if you can’t see it), and create a nonLinearDeformer->bend. Erm, you might notice that the DG now looks a little bit more complex than the max modifier stack…

Anyhow, if you apply a few of those to the mesh, then right click on it and select from the menu Inputs->All Inputs, you will see the nearest thing to the max modifier stack (and you can use middle mouse button to drag the deformers to change their order - implemented via the reorderDeformers mel command).

And so to your original question, you can’t really create custom meshes directly in mel in the same way as a SimpleObject script plugin (you can, but it’s not recommended), but there are some commands that generate the basic network for polyCube’s etc. The name of the command is normally the same as the poly creator node type it creates, eg polyCube, polySphere etc. The same is also true of all the deformers (eg, blendShape, cluster etc). So, to put it all together, so something like this:

 // create the cube
 string $polyThings[] = `polyCube`;
 // just to demo what gets returned... 
 string $transform = $polyThings[0];
  string $creator = $polyThings[1];
 // if you want the mesh node, use listRelatives -c $transform
 // just going to modify the poly Creator slightly.... 
 setAttr ($creator + ".subdivisionsHeight") 15;
 // apply the deformer to the selected object
 select -r $transform;
 nonLinear -type bend -curvature 0.9;

If you are not sure what a node in the hypergraph is, then execute the following mel:

nodeType "nameOfNode";

You can then look it up in the node & attr reference in the mel help. That will give you the list of attributes you can set via the setAttr mel command (and getAttr if you need to get the data). Some commands will support the edit flag to modify params (eg, polyCube -edit), but you can set ALL data via setAttr, so most people just use that…


Thank you very much, Robert Bateman, I appretiate it.

Now I’m more into investigating the MEL structure.

Anyways, does anyone feel that Maya has the worst user reference files compared to Max/XSI etc…? The MEL command list is useful, however, where can I get syntax help etc.?



You can find all these in: Using Maya/General/MEL and Expressions.
It’s true that the help system is not the best in the world, but I use the search option a lot and usually find what I need in a few seconds…



Thanks, I’ll give it a try :wink:

no. It's the other way around. Maya has by far the best docs of the three. The only problem with maya is that it takes quite a bit longer to learn what it is that you are searching for. In general though, normally youd say:

Q. I need to know about X
  1. Use the GUI to do X
    2. Look in hypergraph and find out what nodes are involved
    3. Look at the node & attr reference docs for those nodes to find the important attrs
    4. Look for a mel command of the same name as the node. (in the mel command reference).
Sometimes you can't do 4, because the operation only exists as a node. More or less everything you want can be found in the developer resources at the bottom left of the main maya help page....   If you can't find what you need, you can [i]always[/i] use the following mel commands to do [i]everything[/i] in maya:

getAttr, setAttr, addAttr, listAttr, ls, nodeType, listConnections, connectAttr, disconnectAttr, createNode, delete, parent, deleteAttr, file, listRelatives.

Other commands that are useful are:

scriptJob, optionVar, eval, source, xform, system

Every other mel command is either just a bonus (eg polyCube), or a GUI thing (window, button etc).

[mel intro](http://www.robthebloke.org/mel/index.html)


I do agreed with Robert. Maya’s Doc is by far one of the Best.
I alway’s get a breakdown when i have to look in the Max Reference


Hehe, I’ll give my 2 cents too then! :slight_smile:

My biggest complain about the maya help, is that there should be some way to have it built around the interface.

If I remember well, in max for example, if you wanted to know what “new scene” in the menu “file” is doing. You just open the help, go in the file topic, and then read what they say about new scene…

In maya everything is done around each tasks/sub tasks (rendering, dynamics,…) wich can be nice, but most of the time I don’t find what I need through the menus… but only with the search option (wich is great! hopefully)

But hey, it’s not a big thing anyway, just have to get used to it :slight_smile:

ps: I’m talking about the maya help in general, not just the mel and devkit part.


Maybe it’s that I’m used to Max’s help, maybe it’s that I dislike HTML helps, but I really do find Max’s help system/navigation far superior to Maya’s. It’s just an opinion, but for me, this is quite an important fact.


What class does Class_ID(938560,0) represent? And what are the parameters found in it’s ParamBlock? And how do those parameters affect my data?

Having a better navigation system to the max docs is all well and good, but when those docs do not actually contain any of the information you need, it’s all a bit moot.

Maya does at least document everything…


I didn’t want to turn this into an argument :slight_smile: It’s just my own personal experience/preference and as such is quite irrelevant to anyone else :wink:

As for the class problem, I have never faced it, so, no idea here, unfortunately :sad:


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.