Fix #117798: "Nothing to Bake" when pose object is not selected

Use `context.pose_object` when baking a pose, on on top of the objects
in `context.selected_editable_objects`. When in pose mode, it's expected
that the pose of the active will be baked, regardless of whether the
pose object is selected itself.

Pull Request: https://projects.blender.org/blender/blender/pulls/119317
This commit is contained in:
Sybren A. Stüvel
2024-03-11 17:11:14 +01:00
parent 4d0936c7d7
commit 5531a191e8

View File

@@ -289,6 +289,11 @@ class NLA_OT_bake(Operator):
else:
objects = context.selected_editable_objects
if bake_options.do_pose and not bake_options.do_object:
pose_object = getattr(context, 'pose_object', None)
if pose_object and pose_object not in objects:
# The active object might not be selected, but it is the one in pose mode.
# It can be assumed this pose needs baking.
objects.append(context.pose_object)
objects = [obj for obj in objects if obj.pose is not None]
object_action_pairs = (