[Bf-blender-cvs] [2d4980e] master: Fix T42510: bake animation wrong result.

Bastien Montagne noreply at git.blender.org
Tue Feb 3 15:48:40 CET 2015


Commit: 2d4980e68ebbff4cd78f71abb42e767b0d9a1247
Author: Bastien Montagne
Date:   Tue Feb 3 15:41:34 2015 +0100
Branches: master
https://developer.blender.org/rB2d4980e68ebbff4cd78f71abb42e767b0d9a1247

Fix T42510: bake animation wrong result.

Caused by own rBfb7ff31315a1c9 - not surprising code using Object.matrix_local
in other contexts than mere Object parenting fails, since it was using a broken
implementation before...

Note that whole NLA_OT_Bake op would need some love, it is quite brittle in many aspects.

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

M	release/scripts/modules/bpy_extras/anim_utils.py

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

diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py
index d87c207..8905f32 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -25,6 +25,7 @@ __all__ = (
 import bpy
 
 
+# XXX visual keying is actually always considered as True in this code...
 def bake_action(frame_start,
                 frame_end,
                 frame_step=1,
@@ -85,15 +86,15 @@ def bake_action(frame_start,
 
     if do_parents_clear:
         def obj_frame_info(obj, do_visual_keying):
+            return obj.matrix_world.copy() if do_visual_keying else obj.matrix_world.copy()
+    else:
+        def obj_frame_info(obj, do_visual_keying):
             parent = obj.parent
-            matrix = obj.matrix_local if do_visual_keying else obj.matrix_local
+            matrix = obj.matrix_world if do_visual_keying else obj.matrix_world
             if parent:
-                return parent.matrix_world * matrix
+                return parent.matrix_world.inverted_safe() * matrix
             else:
                 return matrix.copy()
-    else:
-        def obj_frame_info(obj, do_visual_keying):
-            return obj.matrix_local.copy() if do_visual_keying else obj.matrix_local.copy()
 
     # -------------------------------------------------------------------------
     # Setup the Context




More information about the Bf-blender-cvs mailing list