Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_template_search_menu.c
| Show First 20 Lines • Show All 344 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (wmEventHandler *, handler_base, handlers[handler_index]) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (handler_base->type != WM_HANDLER_TYPE_KEYMAP) { | if (handler_base->type != WM_HANDLER_TYPE_KEYMAP) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (handler_base->poll == NULL || handler_base->poll(region, win->eventstate)) { | if (handler_base->poll == NULL || handler_base->poll(region, win->eventstate)) { | ||||
| wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base; | wmEventHandler_Keymap *handler = (wmEventHandler_Keymap *)handler_base; | ||||
| wmKeyMap *keymap = WM_event_get_keymap_from_handler(wm, handler); | wmEventHandler_KeymapResult km_result; | ||||
| WM_event_get_keymaps_from_handler(wm, handler, &km_result); | |||||
| for (int km_index = 0; km_index < km_result.keymaps_len; km_index++) { | |||||
| wmKeyMap *keymap = km_result.keymaps[km_index]; | |||||
| if (keymap && WM_keymap_poll(C, keymap)) { | if (keymap && WM_keymap_poll(C, keymap)) { | ||||
| LISTBASE_FOREACH (wmKeyMapItem *, kmi, &keymap->items) { | LISTBASE_FOREACH (wmKeyMapItem *, kmi, &keymap->items) { | ||||
| if (kmi->flag & KMI_INACTIVE) { | if (kmi->flag & KMI_INACTIVE) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (STR_ELEM(kmi->idname, "WM_OT_call_menu", "WM_OT_call_menu_pie")) { | if (STR_ELEM(kmi->idname, "WM_OT_call_menu", "WM_OT_call_menu_pie")) { | ||||
| char menu_idname[MAX_NAME]; | char menu_idname[MAX_NAME]; | ||||
| RNA_string_get(kmi->ptr, "name", menu_idname); | RNA_string_get(kmi->ptr, "name", menu_idname); | ||||
| MenuType *mt = WM_menutype_find(menu_idname, false); | MenuType *mt = WM_menutype_find(menu_idname, false); | ||||
| if (mt && BLI_gset_add(menu_tagged, mt)) { | if (mt && BLI_gset_add(menu_tagged, mt)) { | ||||
| /* Unlikely, but possible this will be included twice. */ | /* Unlikely, but possible this will be included twice. */ | ||||
| BLI_linklist_prepend(menuid_stack_p, mt); | BLI_linklist_prepend(menuid_stack_p, mt); | ||||
| void **kmi_p; | void **kmi_p; | ||||
| if (!BLI_ghash_ensure_p(menu_to_kmi, mt, &kmi_p)) { | if (!BLI_ghash_ensure_p(menu_to_kmi, mt, &kmi_p)) { | ||||
| *kmi_p = kmi; | *kmi_p = kmi; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | |||||
| /** | /** | ||||
| * Display all operators (last). Developer-only convenience feature. | * Display all operators (last). Developer-only convenience feature. | ||||
| */ | */ | ||||
| static void menu_items_from_all_operators(bContext *C, struct MenuSearch_Data *data) | static void menu_items_from_all_operators(bContext *C, struct MenuSearch_Data *data) | ||||
| { | { | ||||
| /* Add to temporary list so we can sort them separately. */ | /* Add to temporary list so we can sort them separately. */ | ||||
| ListBase operator_items = {NULL, NULL}; | ListBase operator_items = {NULL, NULL}; | ||||
| ▲ Show 20 Lines • Show All 790 Lines • Show Last 20 Lines | |||||