0
$\begingroup$

I'm trying to write a script that bakes constraints to bones. However if I select a bone via script the bpy.ops.nla.bake() operations won't run, it just returns "Nothing to bake" in the system console.

If I select a bone via the view port and then run bpy.ops.nla.bake() the bake operations works.

Both of these tests are being run in POSE mode.

  • Am I doing this wrong?
  • Is there something fundamentally different under the hood in mouse click selection?
  • Perhaps this is a bug?

To repro, create a two bone armature. (Optionally a constraint also) If anyone can help with this that would be great :)

import bpy

obj = bpy.context.object
m_bone = obj.data.bones['Bone.001']

m_bone.select = True
obj.data.bones.active = m_bone

bpy.ops.nla.bake(frame_start=0, frame_end=10, step=1, only_selected=True,
                    visual_keying=True, clear_constraints=True, clear_parents=False,
                    use_current_action=True, bake_types={'POSE'})
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.