Fix bake action visual-keying option

Disabling did nothing
This commit is contained in:
Campbell Barton
2015-02-17 07:16:59 +11:00
parent 00a3c9afc8
commit 652b2b656a

View File

@@ -74,7 +74,7 @@ def bake_action(frame_start,
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Helper Functions and vars # Helper Functions and vars
def pose_frame_info(obj, do_visual_keying): def pose_frame_info(obj):
matrix = {} matrix = {}
for name, pbone in obj.pose.bones.items(): for name, pbone in obj.pose.bones.items():
if do_visual_keying: if do_visual_keying:
@@ -85,16 +85,29 @@ def bake_action(frame_start,
return matrix return matrix
if do_parents_clear: if do_parents_clear:
def obj_frame_info(obj, do_visual_keying): if do_visual_keying:
return obj.matrix_world.copy() if do_visual_keying else obj.matrix_world.copy() def obj_frame_info(obj):
return obj.matrix_world.copy()
else:
def obj_frame_info(obj):
parent = obj.parent
matrix = obj.matrix_basis
if parent:
return parent.matrix_world * matrix
else:
return matrix.copy()
else: else:
def obj_frame_info(obj, do_visual_keying): if do_visual_keying:
parent = obj.parent def obj_frame_info(obj):
matrix = obj.matrix_world if do_visual_keying else obj.matrix_world parent = obj.parent
if parent: matrix = obj.matrix_world
return parent.matrix_world.inverted_safe() * matrix if parent:
else: return parent.matrix_world.inverted_safe() * matrix
return matrix.copy() else:
return matrix.copy()
else:
def obj_frame_info(obj):
return obj.matrix_basis.copy()
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Setup the Context # Setup the Context
@@ -124,9 +137,9 @@ def bake_action(frame_start,
scene.frame_set(f) scene.frame_set(f)
scene.update() scene.update()
if do_pose: if do_pose:
pose_info.append(pose_frame_info(obj, do_visual_keying)) pose_info.append(pose_frame_info(obj))
if do_object: if do_object:
obj_info.append(obj_frame_info(obj, do_visual_keying)) obj_info.append(obj_frame_info(obj))
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Create action # Create action