Bake Action Operator offsets keyframes from tweaked strip
Open, Needs TriagePublic

Description

Note: this is a bug report + a fix suggestion, I don't know how I would go about directly submitting the fix

Here is a quick-easy test example for this:

Win7

There's a bug in the Bake Action operator when using it in tweak mode with NLA strps.
When the strip is moved to a different location and you want to Overwrite the Current Action, the bake will not insert the keyframes relative to the strip's offset.


This image in order from top to bottom shows the current action in the NLA editor:

  1. Action in tweak mode
  2. Action's base keyframe locations
  3. Baked action's result
  4. Baked action in tweak mode

I don't know why the code is setup the way it is but an easy fix for this is to (only disable tweak mode and specify active animation.action if use_current_action is False).

"..\2.79\scripts\startup\bl_operators\anim.py"
"..\2.79\scripts\modules\bpy_extras\anim_utils.py"
Line #247
Simply change it from:

if action is None:
    action = bpy.data.actions.new("Action")

# Leave tweak mode before trying to modify the action (T48397)
if atd.use_tweak_mode:
    atd.use_tweak_mode = False

atd.action = action

to

if action is None:
    action = bpy.data.actions.new("Action")

    # Leave tweak mode before trying to modify the action (T48397)
    if atd.use_tweak_mode:
        atd.use_tweak_mode = False

    atd.action = action

This will:

  1. use the tweak mode action
  2. insert keyframes in the correct relative/offset positions.
  3. not force exit of tweak mode

Details

Type
Bug