[Bf-blender-cvs] [652b2b6] master: Fix bake action visual-keying option

Campbell Barton noreply at git.blender.org
Mon Feb 16 21:20:45 CET 2015


Commit: 652b2b656acd014287ec2e914515192ce9ff06ce
Author: Campbell Barton
Date:   Tue Feb 17 07:16:59 2015 +1100
Branches: master
https://developer.blender.org/rB652b2b656acd014287ec2e914515192ce9ff06ce

Fix bake action visual-keying option

Disabling did nothing

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

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 8905f32..4ee5e68 100644
--- a/release/scripts/modules/bpy_extras/anim_utils.py
+++ b/release/scripts/modules/bpy_extras/anim_utils.py
@@ -74,7 +74,7 @@ def bake_action(frame_start,
     # -------------------------------------------------------------------------
     # Helper Functions and vars
 
-    def pose_frame_info(obj, do_visual_keying):
+    def pose_frame_info(obj):
         matrix = {}
         for name, pbone in obj.pose.bones.items():
             if do_visual_keying:
@@ -85,16 +85,29 @@ def bake_action(frame_start,
         return matrix
 
     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()
+        if do_visual_keying:
+            def obj_frame_info(obj):
+                return obj.matrix_world.copy()
+        else:
+            def obj_frame_info(obj):
+                parent = obj.parent
+                matrix = obj.matrix_basis
+                if parent:
+                    return parent.matrix_world * matrix
+                else:
+                    return matrix.copy()
     else:
-        def obj_frame_info(obj, do_visual_keying):
-            parent = obj.parent
-            matrix = obj.matrix_world if do_visual_keying else obj.matrix_world
-            if parent:
-                return parent.matrix_world.inverted_safe() * matrix
-            else:
-                return matrix.copy()
+        if do_visual_keying:
+            def obj_frame_info(obj):
+                parent = obj.parent
+                matrix = obj.matrix_world
+                if parent:
+                    return parent.matrix_world.inverted_safe() * matrix
+                else:
+                    return matrix.copy()
+        else:
+            def obj_frame_info(obj):
+                return obj.matrix_basis.copy()
 
     # -------------------------------------------------------------------------
     # Setup the Context
@@ -124,9 +137,9 @@ def bake_action(frame_start,
         scene.frame_set(f)
         scene.update()
         if do_pose:
-            pose_info.append(pose_frame_info(obj, do_visual_keying))
+            pose_info.append(pose_frame_info(obj))
         if do_object:
-            obj_info.append(obj_frame_info(obj, do_visual_keying))
+            obj_info.append(obj_frame_info(obj))
 
     # -------------------------------------------------------------------------
     # Create action




More information about the Bf-blender-cvs mailing list