[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58012] trunk/blender/release/scripts: fix [#35977] Bake Action doesn't work properly

Campbell Barton ideasman42 at gmail.com
Fri Jul 5 01:52:02 CEST 2013


Revision: 58012
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58012
Author:   campbellbarton
Date:     2013-07-04 23:52:02 +0000 (Thu, 04 Jul 2013)
Log Message:
-----------
fix [#35977] Bake Action doesn't work properly

there are cases where you want to use visual-keying but not remove constraints, also it wasnt obvious that clearing constraints used a different method of keyframing.
So split these into 2 options.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
    trunk/blender/release/scripts/startup/bl_operators/anim.py

Modified: trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py	2013-07-04 23:17:00 UTC (rev 58011)
+++ trunk/blender/release/scripts/modules/bpy_extras/anim_utils.py	2013-07-04 23:52:02 UTC (rev 58012)
@@ -31,6 +31,7 @@
                 only_selected=False,
                 do_pose=True,
                 do_object=True,
+                do_visual_keying=True,
                 do_constraint_clear=False,
                 do_parents_clear=False,
                 do_clean=False,
@@ -53,7 +54,9 @@
     :type do_pose: bool
     :arg do_object: Bake objects.
     :type do_object: bool
-    :arg do_constraint_clear: Remove constraints (and do 'visual keying').
+    :arg do_visual_keying: Use the final transformations for baking ('visual keying')
+    :type do_visual_keying: bool
+    :arg do_constraint_clear: Remove constraints after baking.
     :type do_constraint_clear: bool
     :arg do_parents_clear: Unparent after baking objects.
     :type do_parents_clear: bool
@@ -83,14 +86,14 @@
     if do_parents_clear:
         def obj_frame_info(obj, do_visual_keying):
             parent = obj.parent
-            matrix = obj.matrix_local if do_visual_keying else obj.matrix_basis
+            matrix = obj.matrix_local if do_visual_keying else obj.matrix_local
             if parent:
                 return parent.matrix_world * 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_basis.copy()
+            return obj.matrix_local.copy() if do_visual_keying else obj.matrix_local.copy()
 
     # -------------------------------------------------------------------------
     # Setup the Context
@@ -118,10 +121,11 @@
 
     for f in frame_range:
         scene.frame_set(f)
+        scene.update()
         if do_pose:
-            pose_info.append(pose_frame_info(obj, do_constraint_clear))
+            pose_info.append(pose_frame_info(obj, do_visual_keying))
         if do_object:
-            obj_info.append(obj_frame_info(obj, do_constraint_clear))
+            obj_info.append(obj_frame_info(obj, do_visual_keying))
 
     # -------------------------------------------------------------------------
     # Create action

Modified: trunk/blender/release/scripts/startup/bl_operators/anim.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/anim.py	2013-07-04 23:17:00 UTC (rev 58011)
+++ trunk/blender/release/scripts/startup/bl_operators/anim.py	2013-07-04 23:52:02 UTC (rev 58012)
@@ -190,6 +190,11 @@
             description="Only key selected object/bones",
             default=True,
             )
+    visual_keying = BoolProperty(
+            name="Visual Keying",
+            description="Keyframe from the final transformations (with constraints applied)",
+            default=False,
+            )
     clear_constraints = BoolProperty(
             name="Clear Constraints",
             description="Remove all constraints from keyed object/bones, and do 'visual' keying",
@@ -220,6 +225,7 @@
                                         only_selected=self.only_selected,
                                         do_pose='POSE' in self.bake_types,
                                         do_object='OBJECT' in self.bake_types,
+                                        do_visual_keying=self.visual_keying,
                                         do_constraint_clear=self.clear_constraints,
                                         do_parents_clear=self.clear_parents,
                                         do_clean=True,




More information about the Bf-blender-cvs mailing list