[Bf-blender-cvs] [258e30f] master: Fix T39886: Transformed parents of Rigid Bodies cause problems with Bake To Keyframes

Sergej Reich noreply at git.blender.org
Fri Apr 25 08:22:28 CEST 2014


Commit: 258e30f2c7d2926ba5b206322ceb6876747d354d
Author: Sergej Reich
Date:   Fri Apr 25 05:26:48 2014 +0200
https://developer.blender.org/rB258e30f2c7d2926ba5b206322ceb6876747d354d

Fix T39886: Transformed parents of Rigid Bodies cause problems with Bake To Keyframes

Need to convert transforms to parent space for objects with parents.

===================================================================

M	release/scripts/startup/bl_operators/rigidbody.py

===================================================================

diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index f9461c85..9a3aae5 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -143,6 +143,9 @@ class BakeToKeyframes(Operator):
                 scene.frame_set(f)
                 for j, obj in enumerate(objects):
                     mat = bake[i][j]
+                    # convert world space transform to parent space, so parented objects don't get offset after baking
+                    if (obj.parent):
+                        mat = obj.matrix_parent_inverse.inverted() * obj.parent.matrix_world.inverted() * mat
 
                     obj.location = mat.to_translation()




More information about the Bf-blender-cvs mailing list