Fix T100879: Bake Action fails with "Nothing to Bake"

When applying the "Bake Action" operator in pose mode
it could throw an error saying "Nothing to Bake"
even though bones are selected

That is because the code was looking for a selected armature
But in Pose Mode, clicking into empty space to de-select would also
deselect the armature.
Then box selecting would not make the armature selected again

Reviewed by: Sybren A. Stüvel
Differential Revision: https://developer.blender.org/D16593
This commit is contained in:
Christoph Lendenfeld 2022-11-30 16:57:21 +01:00
parent b7d27ce914
commit 5c1cc79cf4
Notes: blender-bot 2023-02-14 05:04:52 +01:00
Referenced by issue #102882, Geometry nodes: Crash for cycle links in node group when try to find viewer node
Referenced by issue #100879, Bake Action fails with "Nothing to Bake" if the Armature node isn't selected,
4 changed files with 11 additions and 6 deletions

@ -1 +1 @@
Subproject commit ef57e2c2c65933a68811d58b40ed62b775e9b4b0
Subproject commit 4a581c54af9b92cb670d750951b9382160f10f3e

@ -1 +1 @@
Subproject commit bde68da02fde93968dc11b52d42060ac3b81ed37
Subproject commit 0b0052bd53ad8249ed07dfb87705c338af698bde

@ -1 +1 @@
Subproject commit e6179b3b112298e131bbd0faf648bf0d392b6cdd
Subproject commit 96143b1a8b037ea3c81f065f557025db9fe1ace3

View File

@ -252,9 +252,14 @@ class NLA_OT_bake(Operator):
do_pose = 'POSE' in self.bake_types
do_object = 'OBJECT' in self.bake_types
objects = context.selected_editable_objects
if do_pose and not do_object:
objects = [obj for obj in objects if obj.pose is not None]
if do_pose and self.only_selected:
pose_bones = context.selected_pose_bones or []
armatures = {pose_bone.id_data for pose_bone in pose_bones}
objects = list(armatures)
else:
objects = context.selected_editable_objects
if do_pose and not do_object:
objects = [obj for obj in objects if obj.pose is not None]
object_action_pairs = (
[(obj, getattr(obj.animation_data, "action", None)) for obj in objects]