Friday, July 12, 2013

Tip organize rig scene using Maya Api Custom Node

Hi There,

I ran into an issue when I was building a custom auto rig how to find all the nodes created when there were various options for how to build it. I used regular groups in the past with string names (ex: quickly setting poses with eval strings), I used making lists of all the scene joints and saving the names in a MEL script, but what happens if I want to rename scene things but still make duplicate chains, or removing stuff, or adding a different rig ...

Now i'm starting to explore a multi string node that can take in connections so names on the scene can change while our script can use the same names.

Here's a node i wrote that basically does no computations but allows user to add as many string attributes as needed.

NameNode.cpp NameNode.cpp

Then those string attributes can be connected to scene rig objects. (Note to add attribute to node need to go in attribute editor with node selected and click add item. There is also AEnewNonNumericMultiAddNewItem( nameNode , nameAttr ) to add attribute, the setAttr -s wasnt working for some reason.


Hope you find the code helpful.


Cheers
-Nate

Inspired by Rob Bateman (learned about the setArray for making lots of attributes, learned about writing a node in Maya SimpleNode.cpp )
Inspired by Brian Ewert (learned about making string attribute)
Inspired by David Hunt (first learned about modular rigging from his GDC online talk)
Inspired by Autodesk online tutorial examples: interpShader.cpp, cgfxShaderNode.cpp