[Bf-committers] Updated (working!) patch for NLA Action Baking

Roland Hess rolandh at reed-witting.com
Thu Dec 29 15:10:39 CET 2005


This monster patch adds Action Baking capabilities to NLA. With an 
armature and action strip selected, and the mouse hovering over the 
action in NLA, pressing SHIFT-B brings up the Bake menu, to which 
there are three options.

The first, Bake Object to Action, creates a new action and appends it 
to NLA that attempts to recreate object-level motion (due to 
keyframing, constraints, parenting, etc.) at the bone level. When it 
creates the Action, it also unlinks object IPOs and parenting (still 
working on removing object-level constraints). The net effect is that 
you now have an action that duplicates the motion of the armature as 
a whole.

The second, Bake NLA Action, creates a new action and appends it to 
NLA that attempts to burn all NLA actions into a single action strip. 
This could be helpful if you have created a complex character 
animation you would like to tweak and sweeten, but it consists of 
multiple walkcycles and numerous other strips. Baking into a single 
strip allows to you to work with the animation along a single 

The third, Bake All to Action, first performs Bake Object to Action, 
then Bake NLA to Action, creating in the end a single action strip 
that contains keyframing information for your entire character 
animation. More extensive notes on shortcomings/possible expansion 
can be found in the patch tracker.

I would NOT call this patch finished, but it has almost reached the 
limits of my c programming capabilities. I worked on this as a way to 
help Orange with it's action baking needs, and am hoping that a 
better programmer up the chain here can perhaps do some optimizations 
on the code. In particular, the function that generates a list of 
keyframes to sample from the NLA seems to be spectacularly 
inefficient, but it's the only way I can think of to do it. Also, it 
would be better to only set keys on pose channels that already have a 
key on that frame. I'm not sure if it's possible, but when baking, 
you want to shoot for the fewest relevant keys.

Three notes:

1. When I started working on this, I thought I was working on a clean 
checkout of bf-blender, but was not. So, this patch also contains the 
MatchMoving feature I've developed. Orangers (and others) might find 
it useful.

2. To make the NLA strip for Object-level motion blend properly in 
NLA, I had to add a new NLA blend type: Multiply. Try it out.

3. I don't know what the hell I'm doing. Most of the coding I've done 
here is C&P from other parts of the Blender sources. New functions 
have been placed next to the ones I was cribbing from. If questions 
arise as to "why did you put that function in that file" or "why did 
you make function x non-static instead of just..." they can most 
likely be answered by the fact that I didn't know how to do it any 
other way. Suggestions/rewrites are welcome.
Roland Hess - harkyman

More information about the Bf-committers mailing list