Problem with BAKE function?

reference files

Skeleton: www.rpi.edu/~thambj/skeleton.blend
Arm : www.rpi.edu/~thambj/fingers.blend

In the linked files, I have created an IK animation (mostly following the tutorial on blender.org). In both cases, when I BAKE the animation, it gets screwed up (both the constrained animation and the unconstrained Quaternion IPO baked animation). In the file with the full skeleton, this is very obvious (the arms bend the wrong way). In the file with just the hand (its not parented to the mesh), the fingers get pretty crooked after being baked.

Could someone more experienced please tell me if this is expected behavior or if there is indeed a bug in the bake function? If this is a bug, I think I might fix it or at least post it to the buglist at blender.org

Thanks,
Jonathan Thambidurai

it has happened to me too, I haven’t played with it lately to see if I could narrow down the cause

Yeah, I think there’s something flakey with bake now, at least it didn’t do what I expected. I baked some actions last night and some of the bones were getting scaled for no reason that I could determine, others were just put into the wrong position. Also, actions in the NLA influenced the results. I’m not sure whether this is right or wrong and can see reasons why you’d want it to work that way or not work that way.

This was the first time I tried baking something though, other than some playing around a long time ago. So, I can’t compare how baking works now vs how it used to work.

I think I fixed the bug. Baking my previously posted files now works correctly. Here is the patch to editaction.c:

WRONG --www.rpi.edu/~thambj/bake-fix.patch—WRONG

SEE BELOW POST FOR CORRECT FIX

Testing (on IK animations where BAKE didn’t work previously) would be appreciated. I should probably post this to one of the Blender.org dev lists.

–Jonathan Thambidurai

If you could give me a compiled win32-exe then I could test it…
Sorry for being a noob when it comes to building blender from the sources. :slight_smile:

I posted this to the bf-committers list at blender.org. My previous patch was wrong. The new one is www.rpi.edu/~thambj/bake-fix2.patch


Baking an IK animation into Quaternion IPOs does not work consistently. Here are two examples of the buggy bake function:

www.rpi.edu/~thambj/fingers.blend
www.rpi.edu/~thambj/skeleton.blend

To see the problem, load up the file, change to the action view and bake the action. Observe that both the baked animation and the originalIK-constraint animation are wrong.

Attached is a patch to editaction.c that remedies this problem. If you run (patched) Blender now and bake the aforementioned animations, you will see that the Quaternion-IPO’s and original action are now correct.

Sometimes, if you switch between playing the baked and non-baked animations, the original (non-baked) one becomes incorrect. To fix this, change to pose-mode for the armature, select all bones, and clear their locations and rotations. The animation should then be correct.

As mentioned before, the patch is attached. I have also posted it at www.rpi.edu/~thambj/bake-fix2.patch

I would like this to be committed to the main tree, as there have been several posts at Elysiun.com about funky baked animations. Please tell me what, if anything, must be changed for this to be committed.

–Jonathan Thambidurai

It´s slightly off-topic, but I have a question that is kinda related: What kinds of keys are generated in the baked animation?
The context of my question is that exporter scripts that want to export skeletal animation have to analyze the ipos. And there it is important to know the types of curves that an ipo has (loc, rot, size,…), as well as their order in the array of curves that is visible to the exporter script (by ipo.getCurves()).

When you bake an IK-constrained animation, quaternion and location curves are generated for each bone in the armature. I’m not sure about the order of the curves, but guessing from the code in editaction.c, its quat_x, quat_y, quat_z, quat_w, loc_x, loc_y, loc_z.

Just want to let people know that my above fix was committed to CVS yesterday morning, so if you want correct baked animations, either apply the above patch to the 2.32 source or use the CVS version.

–Jonathan Thambidurai