PDA

View Full Version : Keyframed animation to attribute


hellspawned
05-04-2010, 02:41 PM
I have set up a humanoid and made a decent walk cycle for it. Now, the thing i wanna do is to turn this keyframed animation into a numeric control in the attribute window, like a blendshape, where 0 means frame 1, and 1 means frame 25.

I remember us doing this with a walkcycle back in school, but the animation course was short, some details (like this one) didn't really stick.

hellspawned
05-04-2010, 03:27 PM
Setting driven keys is all well and good, but its a damn hassle to do that for the twenty-odd manipulators my walk cycle utilizes. I can't remember how, but our teacher showed us how to make a really simple, quick transition from keyframed animation to controller-driven animation

Darksuit
05-04-2010, 03:31 PM
Sounds like your talking about set driven keys.

Darksuit
05-04-2010, 09:27 PM
Just off the cuff, the two basic ways are using SDK (Set Driven Keys, which are prety quick to setup) and using the Actor Manager via the Trax Editor. You can control Multiple Controls at the same time with the SDK. You can also adjust your curve tangents. This is the typical way I will setup the animation on a tank tred if I want to be really anal about it (something like 2 SDK manipulating 100+ objects at once with pre and post Inifinite Loops). Since it gives me the cleanest and offers the most control over a given animation sequence.

if your looking to save out an animation you can use the Trax editor. Creates a set of attributes in the channel box that will be stored out in the trax editor. These can be saved out as clips then pulled back in, blended, mixed and matched. It takes a little bit to set it up, but works well if setup correctly. The Trax editor has not changed for the most part since Jason wrote the Original Documentation for Maya 4.0

isoparmB
05-12-2010, 05:53 PM
I have set up a humanoid and made a decent walk cycle for it. Now, the thing i wanna do is to turn this keyframed animation into a numeric control in the attribute window, like a blendshape, where 0 means frame 1, and 1 means frame 25.

I remember us doing this with a walkcycle back in school, but the animation course was short, some details (like this one) didn't really stick.

First off, I would suggest an attribute without a ceiling limit, so as when you have a number greater than 1 it will return the remainder as an input.

You could do what you want to achieve in trax if you had a fully rigged character (and even if you only had joints), which will allow you a great amount of flexibility in reanimating it, but if you were sure that your animation performance wouldn't change and that you wanted to package your character as a standard filler character with generic animation, here's what you do.

Have at least one controller for your character, could be a curve. Create a float attribute called .walk with a min value of 0. Next, create another attribute on another node (not on your curve controller, I'll tell you why later). Could be on an empty group in your hierarchy that no one ever selects. Call it .controlWalk .

Next, create an expression: this is assuming you use the names in the expression for your objects, your animation is 25 frames long, and the first frame of your animation exactly matches the last frame of your animation:


controlGrp.controlWalk = ((controlCurve.walk % 1) * 24) + 1;

Now, a little digression about animation curves that you'll need to know.

There are two main types of animation curves. There's what I call the T nodes, and the U nodes. T nodes are animCurveTU, animCurveTA, and animCurveTL (there is an animCurveTT, but you won't need that for this), and they're equivalent U nodes in UU, UA, and UL (and UT).

It's very simple. T anim curves have an input attribute. If nothing is connected to this attribute, it gets it's input value from the current time generated from the time1 node (yes, time is a node in maya). If SOMETHING is connected, it get's it's input from that connected attribute instead of time. TA stands for Time Angular, meaning rotations or anything that accepts rotation values, TL stands for Time Linear, which is for attributes which deal with distance such as translation, and TU stands for Time Unitless, for attributes such as scale or whatever else.

In short, T anim curves are what get created every time you key an attribute.

Then there are the U anim curves. Everything that was said about T curves is true, EXCEPT that they don't have an implicit connection to time1. They are the anim curves that expect an attribute connection to their input channel, and their animation is driven by that. These are the set-driven-keyframes. I don't know what U stands for. Probably Unit. :P

Now the interesting thing is you can set up a SDK-like setup with a fully animated character if you connect all it's animCurveTL, animCurveTA, and animCurveTU animation curves to an attribute, like the one we created on the hidden group.

The drawback is it will be very slow if you select that group itself because of all the animation curves connected to it, hence the reason why we will connect it to a group that will never be selected in the first place.

Now, run these mel commands:

string $list[] = `ls -et animCurveTU -et animCurveTA -et animCurveTL`;
string $item;

for ($item in $list) {
connectAttr -f controlGrp.controlWalk ($item + ".input");
}

This will connect all T animation curves to your custom repeating attribute, and you'll have a character that's animated in a cycle by 1 attribute. This is assuming that you had a 25 frame animation cycle, you can change the expression accordingly.

CGTalk Moderation
05-12-2010, 05:53 PM
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.