Thursday, April 26, 2012

Ideas For Using Multiply Divide Node For Data Storage

Here are a couple ideas about data storage on an animator control.

I definitely would like to be able to use the Maya api to write some cool nodes, but for the time being
I found that using Multiply divide nodes inputs to get scene information rather than for computations worked pretty
well.(also check out blendTwoAttr, using setAttr input i think these can have an unlimited number of inputs)

For example suppose we wanted to know when we select one animator control (controlA) to also select a completely different node (controlB) when we type a script command.

One way would be to give controlA the name of controlB, and have that stored on controlA, but what happens if we renamed controlB, do we then have to go in and rename the attribute on controlA.

An idea is to have some attribute on controlB we don't need to use and have it connected to the input of a hidden node (example multiply divide input1X) then have controlA connected to another plug of this hidden node (example multiply divide input2X). Finally we add an attribute on to controlA whose name we keep fixed in our scripts and is connected to the same hidden node (example multiply divide input1Y).

In our script we write how to read the hidden node and get information using the fixed attribute name on controlA.

Now when we select controlA we can automatically have our script select controlB (regardless of controlB's name) because
it is connected to a known attribute on controlA. We could even create a new control controlC and just plug it into the plug controlB was using, and now when we run script we'll get controlC selected without giving controlA any names directly.

Here are a couple of pictures for ideas of using these principles in IK to FK matching and Space switching.

Hope they are helpful.


Inspired by Jason Schleifer's Animator Friendly Rigging (jasonschleifer dot com)