diff options
author | Campbell Barton <campbell@blender.org> | 2022-03-09 05:01:05 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-03-09 05:02:29 +0300 |
commit | e55f4657f7b7ae8ac915eefd633d08ae56bb3574 (patch) | |
tree | 81fcde613bef9faa6d05612815ca423f6cae8c78 /source/blender/editors | |
parent | 21462565632b876ac4eadf2bd30573f2fda70c76 (diff) |
Fix T89560: Keymap editor no longer shows keying set dropdown
Include built-in keying sets when ANIM_keying_sets_enum_itemf is called
without a context to allow binding keys to built-in keying sets.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 6fcdd21bad8..dcf8835c911 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -715,55 +715,54 @@ const EnumPropertyItem *ANIM_keying_sets_enum_itemf(bContext *C, PropertyRNA *UNUSED(prop), bool *r_free) { - Scene *scene = CTX_data_scene(C); KeyingSet *ks; EnumPropertyItem *item = NULL, item_tmp = {0}; int totitem = 0; int i = 0; - if (C == NULL) { - return DummyRNA_DEFAULT_items; - } + if (C != NULL) { + Scene *scene = CTX_data_scene(C); + /* active Keying Set + * - only include entry if it exists + */ + if (scene->active_keyingset) { + /* active Keying Set */ + item_tmp.identifier = "__ACTIVE__"; + item_tmp.name = "Active Keying Set"; + item_tmp.value = i; + RNA_enum_item_add(&item, &totitem, &item_tmp); - /* active Keying Set - * - only include entry if it exists - */ - if (scene->active_keyingset) { - /* active Keying Set */ - item_tmp.identifier = "__ACTIVE__"; - item_tmp.name = "Active Keying Set"; - item_tmp.value = i; - RNA_enum_item_add(&item, &totitem, &item_tmp); - - /* separator */ - RNA_enum_item_add_separator(&item, &totitem); - } + /* separator */ + RNA_enum_item_add_separator(&item, &totitem); + } - i++; + i++; - /* user-defined Keying Sets - * - these are listed in the order in which they were defined for the active scene - */ - if (scene->keyingsets.first) { - for (ks = scene->keyingsets.first; ks; ks = ks->next, i++) { - if (ANIM_keyingset_context_ok_poll(C, ks)) { - item_tmp.identifier = ks->idname; - item_tmp.name = ks->name; - item_tmp.description = ks->description; - item_tmp.value = i; - RNA_enum_item_add(&item, &totitem, &item_tmp); + /* user-defined Keying Sets + * - these are listed in the order in which they were defined for the active scene + */ + if (scene->keyingsets.first) { + for (ks = scene->keyingsets.first; ks; ks = ks->next, i++) { + if (ANIM_keyingset_context_ok_poll(C, ks)) { + item_tmp.identifier = ks->idname; + item_tmp.name = ks->name; + item_tmp.description = ks->description; + item_tmp.value = i; + RNA_enum_item_add(&item, &totitem, &item_tmp); + } } - } - /* separator */ - RNA_enum_item_add_separator(&item, &totitem); + /* separator */ + RNA_enum_item_add_separator(&item, &totitem); + } } /* builtin Keying Sets */ i = -1; for (ks = builtin_keyingsets.first; ks; ks = ks->next, i--) { - /* only show KeyingSet if context is suitable */ - if (ANIM_keyingset_context_ok_poll(C, ks)) { + /* Only show #KeyingSet if context is suitable or if there is no context which is needed + * to support key-bindings to be assigned since key bindings are not context aware. */ + if ((C == NULL) || ANIM_keyingset_context_ok_poll(C, ks)) { item_tmp.identifier = ks->idname; item_tmp.name = ks->name; item_tmp.description = ks->description; |