Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarshan Kadu <darsh7807@gmail.com>2017-09-10 15:41:40 +0300
committerDarshan Kadu <darsh7807@gmail.com>2017-09-10 15:41:40 +0300
commit6594fa1ce02809a275c9cd488fa0223d03d73571 (patch)
tree0bcd95846e1e3b09239126b40ef434ed3dc3a50d /release/scripts/startup/bl_operators/anim.py
parentf2017083a19e5c83aadc575625dce0642ffce6c5 (diff)
merged the master branchsoc-2017-vertex_paint
Diffstat (limited to 'release/scripts/startup/bl_operators/anim.py')
-rw-r--r--release/scripts/startup/bl_operators/anim.py49
1 files changed, 25 insertions, 24 deletions
diff --git a/release/scripts/startup/bl_operators/anim.py b/release/scripts/startup/bl_operators/anim.py
index 02fb05e29eb..0632f9bc3ca 100644
--- a/release/scripts/startup/bl_operators/anim.py
+++ b/release/scripts/startup/bl_operators/anim.py
@@ -137,6 +137,9 @@ class ANIM_OT_keying_set_export(Operator):
break
else:
self.report({'WARN'}, "Could not find scene using Compositor Node Tree - %s" % (ksp.id))
+ elif ksp.id.bl_rna.name == "Key":
+ # "keys" conflicts with a Python keyword, hence the simple solution won't work
+ id_bpy_path = "bpy.data.shape_keys[\"%s\"]" % (ksp.id.name)
else:
idtype_list = ksp.id.bl_rna.name.lower() + "s"
id_bpy_path = "bpy.data.%s[\"%s\"]" % (idtype_list, ksp.id.name)
@@ -195,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'}
@@ -219,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,
)
@@ -255,29 +258,27 @@ class BakeAction(Operator):
)
def execute(self, context):
-
from bpy_extras import anim_utils
-
- action = None
- if self.use_current_action:
- obj = 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,
- 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,
- action=action,
- )
-
- if action is None:
+ 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]
+ )
+
+ 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,
+ do_visual_keying=self.visual_keying,
+ do_constraint_clear=self.clear_constraints,
+ do_parents_clear=self.clear_parents,
+ do_clean=True,
+ )
+
+ if not any(actions):
self.report({'INFO'}, "Nothing to bake")
return {'CANCELLED'}