[Bf-blender-cvs] [6973e26] master: Fix T44036: Add option to bake into current action instead of creating a new one.

Bastien Montagne noreply at git.blender.org
Tue May 26 15:34:08 CEST 2015


Commit: 6973e26bf92ed927e20c3ae986dc01f7d287a84a
Author: Bastien Montagne
Date:   Tue May 26 15:30:34 2015 +0200
Branches: master
https://developer.blender.org/rB6973e26bf92ed927e20c3ae986dc01f7d287a84a

Fix T44036: Add option to bake into current action instead of creating a new one.

This is needed when you want to bake only part of an armature's bones, since they
all share a single action, otherwise you'd lose non-baked bones' animation...

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

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

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

diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 1b3e719..ed7423f 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -210,6 +210,12 @@ class BakeAction(Operator):
             description="Bake animation onto the object then clear parents (objects only)",
             default=False,
             )
+    use_current_action = BoolProperty(
+            name="Overwrite Current Action",
+            description="Bake animation into current action, instead of creating a new one "
+                        "(useful for baking only part of bones in an armature)",
+            default=False,
+            )
     bake_types = EnumProperty(
             name="Bake Data",
             description="Which data's transformations to bake",
@@ -224,6 +230,12 @@ class BakeAction(Operator):
 
         from bpy_extras import anim_utils
 
+        action = None
+        if self.use_current_action:
+            obj = bpy.context.object
+            if obj.animation_data:
+                action = obj.animation_data.action
+
         action = anim_utils.bake_action(self.frame_start,
                                         self.frame_end,
                                         frame_step=self.step,
@@ -234,6 +246,7 @@ class BakeAction(Operator):
                                         do_constraint_clear=self.clear_constraints,
                                         do_parents_clear=self.clear_parents,
                                         do_clean=True,
+                                        action=action,
                                         )
 
         if action is None:




More information about the Bf-blender-cvs mailing list