Fix T38157: Rigid body, crazy f-curves after bake to keyframes
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.
This commit is contained in:
parent
929fb8324b
commit
4c89a658be
Notes:
blender-bot
2023-02-14 11:21:40 +01:00
Referenced by issue #38157, Rigid body, crazy f-curves after bake to keyframes. Referenced by issue #38157, Rigid body, crazy f-curves after bake to keyframes.
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue