Fix [#33424] Inadequate bake action.

bake_action tries to make kind of a 'visual keying'... On one side, this is rather stupid when you keep constraints (in this case, keying actual loc/rot/scale transforms, i.e. matrix_basis, is enough, doing more would lead to unexpected behavior with some constraints). On the other one, making a good visual keying of bones is *really* tricky, so now using the new object's convert_space() func to compute that (when the user chooses to remove the constraints).

Incidentally, this greatly simplifies the code of bake_action!
This commit is contained in:
Bastien Montagne
2012-12-28 13:34:19 +00:00
parent 921750149b
commit c587c985e8
2 changed files with 69 additions and 127 deletions

View File

@@ -187,17 +187,20 @@ class BakeAction(Operator):
)
only_selected = BoolProperty(
name="Only Selected",
description="Only key selected object/bones",
default=True,
)
clear_constraints = BoolProperty(
name="Clear Constraints",
description="Remove all constraints from keyed object/bones, and do 'visual' keying",
default=False,
)
bake_types = EnumProperty(
name="Bake Data",
description="Which data's transformations to bake",
options={'ENUM_FLAG'},
items=(('POSE', "Pose", ""),
('OBJECT', "Object", ""),
items=(('POSE', "Pose", "Bake bones transformations"),
('OBJECT', "Object", "Bake object transformations"),
),
default={'POSE'},
)
@@ -208,12 +211,12 @@ class BakeAction(Operator):
action = anim_utils.bake_action(self.frame_start,
self.frame_end,
self.step,
self.only_selected,
'POSE' in self.bake_types,
'OBJECT' in self.bake_types,
self.clear_constraints,
True,
frame_step=self.step,
only_selected=self.only_selected,
do_pose='POSE' in self.bake_types,
do_object='OBJECT' in self.bake_types,
do_constraint_clear=self.clear_constraints,
do_clean=True,
)
if action is None: