diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2020-04-06 14:37:51 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2020-04-06 14:39:46 +0300 |
commit | ded7af53b4f2fed41069dd52a9854fe1e904cad1 (patch) | |
tree | 22f76989818006adf1bb214b0f54ea41fa558acd /release/scripts/modules/bpy_extras | |
parent | c03e5e78308c13e2d4a7d06fef84070f5044738f (diff) |
Fix T74889 Baking to current action doesn't work properly
Before this commit, baking an action would only insert keys that are
necessary (i.e. using `INSERTKEY_NEEDED`). When baking to the current
Action, if there are no constraints that influence the final animation,
there are no additional keys necessary. This makes it appear as if
nothing happened. However, when baking to a new Action every additional
frame is necessary and thus a key is added for every frame.
@mont29 and I agreed that this behaviour is confusing, so this commit
changes the behaviour such that baking to the current action and to a
new action result in the same baked animation (that is, keyed on every
frame).
Diffstat (limited to 'release/scripts/modules/bpy_extras')
-rw-r--r-- | release/scripts/modules/bpy_extras/anim_utils.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/release/scripts/modules/bpy_extras/anim_utils.py b/release/scripts/modules/bpy_extras/anim_utils.py index c67134ac3f6..7de919f489e 100644 --- a/release/scripts/modules/bpy_extras/anim_utils.py +++ b/release/scripts/modules/bpy_extras/anim_utils.py @@ -216,8 +216,6 @@ def bake_action_iter( pose_info = [] obj_info = [] - options = {'INSERTKEY_NEEDED'} - # ------------------------------------------------------------------------- # Collect transformations @@ -281,7 +279,7 @@ def bake_action_iter( for (f, matrix, bbones) in pose_info: pbone.matrix_basis = matrix[name].copy() - pbone.keyframe_insert("location", index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert("location", index=-1, frame=f, group=name) rotation_mode = pbone.rotation_mode if rotation_mode == 'QUATERNION': @@ -293,9 +291,9 @@ def bake_action_iter( del quat else: quat_prev = pbone.rotation_quaternion.copy() - pbone.keyframe_insert("rotation_quaternion", index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert("rotation_quaternion", index=-1, frame=f, group=name) elif rotation_mode == 'AXIS_ANGLE': - pbone.keyframe_insert("rotation_axis_angle", index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert("rotation_axis_angle", index=-1, frame=f, group=name) else: # euler, XYZ, ZXY etc if euler_prev is not None: euler = pbone.rotation_euler.copy() @@ -305,9 +303,9 @@ def bake_action_iter( del euler else: euler_prev = pbone.rotation_euler.copy() - pbone.keyframe_insert("rotation_euler", index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert("rotation_euler", index=-1, frame=f, group=name) - pbone.keyframe_insert("scale", index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert("scale", index=-1, frame=f, group=name) # Bendy Bones if pbone.bone.bbone_segments > 1: @@ -315,7 +313,7 @@ def bake_action_iter( for bb_prop in BBONE_PROPS: # update this property with value from bbone_shape, then key it setattr(pbone, bb_prop, bbone_shape[bb_prop]) - pbone.keyframe_insert(bb_prop, index=-1, frame=f, group=name, options=options) + pbone.keyframe_insert(bb_prop, index=-1, frame=f, group=name) # object. TODO. multiple objects if do_object: @@ -331,7 +329,7 @@ def bake_action_iter( name = "Action Bake" # XXX: placeholder obj.matrix_basis = matrix - obj.keyframe_insert("location", index=-1, frame=f, group=name, options=options) + obj.keyframe_insert("location", index=-1, frame=f, group=name) rotation_mode = obj.rotation_mode if rotation_mode == 'QUATERNION': @@ -344,9 +342,9 @@ def bake_action_iter( print ("quat_prev", quat_prev) else: quat_prev = obj.rotation_quaternion.copy() - obj.keyframe_insert("rotation_quaternion", index=-1, frame=f, group=name, options=options) + obj.keyframe_insert("rotation_quaternion", index=-1, frame=f, group=name) elif rotation_mode == 'AXIS_ANGLE': - obj.keyframe_insert("rotation_axis_angle", index=-1, frame=f, group=name, options=options) + obj.keyframe_insert("rotation_axis_angle", index=-1, frame=f, group=name) else: # euler, XYZ, ZXY etc if euler_prev is not None: euler = obj.rotation_euler.copy() @@ -356,9 +354,9 @@ def bake_action_iter( del euler else: euler_prev = obj.rotation_euler.copy() - obj.keyframe_insert("rotation_euler", index=-1, frame=f, group=name, options=options) + obj.keyframe_insert("rotation_euler", index=-1, frame=f, group=name) - obj.keyframe_insert("scale", index=-1, frame=f, group=name, options=options) + obj.keyframe_insert("scale", index=-1, frame=f, group=name) if do_parents_clear: obj.parent = None |