diff options
Diffstat (limited to 'release/scripts/startup/bl_operators/anim.py')
-rw-r--r-- | release/scripts/startup/bl_operators/anim.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py index 380c1257a3d..0632f9bc3ca 100644 --- a/release/scripts/startup/bl_operators/anim.py +++ b/release/scripts/startup/bl_operators/anim.py @@ -198,7 +198,7 @@ class ANIM_OT_keying_set_export(Operator): class BakeAction(Operator): - """Bake object/pose loc/scale/rotation animation to a new action""" + """Bake all selected objects loc/scale/rotation animation to an action""" bl_idname = "nla.bake" bl_label = "Bake Action" bl_options = {'REGISTER', 'UNDO'} @@ -222,7 +222,7 @@ class BakeAction(Operator): default=1, ) only_selected = BoolProperty( - name="Only Selected", + name="Only Selected Bones", description="Only key selected bones (Pose baking only)", default=True, ) @@ -259,18 +259,16 @@ class BakeAction(Operator): def execute(self, context): from bpy_extras import anim_utils + objects = context.selected_editable_objects + object_action_pairs = ( + [(obj, getattr(obj.animation_data, "action", None)) for obj in objects] + if self.use_current_action else + [(obj, None) for obj in objects] + ) - obj = context.object - action = None - if self.use_current_action: - if obj.animation_data: - action = obj.animation_data.action - - action = anim_utils.bake_action( - obj, - self.frame_start, - self.frame_end, - frame_step=self.step, + actions = anim_utils.bake_action_objects( + object_action_pairs, + frames=range(self.frame_start, self.frame_end + 1, self.step), only_selected=self.only_selected, do_pose='POSE' in self.bake_types, do_object='OBJECT' in self.bake_types, @@ -278,10 +276,9 @@ class BakeAction(Operator): do_constraint_clear=self.clear_constraints, do_parents_clear=self.clear_parents, do_clean=True, - action=action, ) - if action is None: + if not any(actions): self.report({'INFO'}, "Nothing to bake") return {'CANCELLED'} |