Fix #127175: KeyingSets: Always show 'Available' option in Insert Keyframe Menu

Always show the 'Available' option in the keyframe menu, so that the
shown menu items are stable. This helps to keep hotkey assignments for
the menu items remain the same.

Note that this isn't a full guarantee yet, as the 'Active Keying Set'
option is also still conditionally added, depending on whether a
keying set was chosen or not. This will be addressed in another
commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/136952
This commit is contained in:
HeCorr
2025-05-16 15:12:51 +02:00
committed by Sybren A. Stüvel
parent 8bf73386f2
commit c4acb840ef

View File

@@ -350,21 +350,10 @@ class BUILTIN_KSI_Available(KeyingSetInfo):
bl_idname = ANIM_KS_AVAILABLE_ID
bl_label = "Available"
# poll - selected objects or selected object with animation data
def poll(self, context):
from bpy_extras import anim_utils
ob = context.active_object
if ob:
# TODO: this fails if one animation-less object is active, but many others are selected
adt = ob.animation_data
if not adt:
return False
cbag = anim_utils.action_get_channelbag_for_slot(adt.action, adt.action_slot)
if not cbag:
return False
return bool(cbag.fcurves)
else:
return bool(context.selected_objects)
# Skip checking for available channels to prevent hotkeys from
# getting mixed up in the Insert Keyframe Menu (see #127175).
return bool(context.selected_objects)
# iterator - use callback for selected bones/objects
iterator = keyingsets_utils.RKS_ITER_selected_item