Fix T38157: Rigid body, crazy f-curves after bake to keyframes
authorJoshua Leung <aligorith@gmail.com>
Fri, 17 Jan 2014 12:38:20 +0000 (01:38 +1300)
committerJoshua Leung <aligorith@gmail.com>
Fri, 17 Jan 2014 12:38:40 +0000 (01:38 +1300)
A logic error meant that the wrong "previous rotation" values were being used
when decomposing the rigidbody results back to transform channels. Instead of
using the previous values for the object in question, it was actually using
the rotation value of the previous object that was evaluated.

release/scripts/startup/bl_operators/rigidbody.py

index 979cc01c0add047cd8ba59d958f39e694745cefe..b151efb45ee6f5e89724fbe44ebf82361ea6c9cf 100644 (file)
@@ -138,7 +138,6 @@ class BakeToKeyframes(Operator):
             # apply transformations as keyframes
             for i, f in enumerate(frames_step):
                 scene.frame_set(f)
-                obj_prev = objects[0]
                 for j, obj in enumerate(objects):
                     mat = bake[i][j]
 
@@ -153,9 +152,8 @@ class BakeToKeyframes(Operator):
                         obj.rotation_axis_angle = (aa[1], ) + aa[0][:]
                     else:  # euler
                         # make sure euler rotation is compatible to previous frame
-                        obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler)
-
-                    obj_prev = obj
+                                               # NOTE: assume that on first frame, the starting rotation is appropriate
+                        obj.rotation_euler = mat.to_euler(rot_mode, obj.rotation_euler)
 
                 bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot', confirm_success=False)