diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 807d84dcc51..9e322228884 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1316,12 +1316,13 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap, if (kmi->flag & KMI_INACTIVE) { continue; } + if (!STREQ(kmi->idname, opname)) { + continue; + } bool kmi_match = false; - - if (STREQ(kmi->idname, opname)) { - if (properties) { - /* example of debugging keymaps */ + if (properties) { + /* example of debugging keymaps */ #if 0 if (kmi->ptr) { if (STREQ("MESH_OT_rip_move", opname)) { @@ -1333,54 +1334,53 @@ static wmKeyMapItem *wm_keymap_item_find_in_keymap(wmKeyMap *keymap, } #endif - if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) { - kmi_match = true; - } - /* Debug only, helps spotting mismatches between menu entries and shortcuts! */ - else if (G.debug & G_DEBUG_WM) { - if (is_strict && kmi->ptr) { - wmOperatorType *ot = WM_operatortype_find(opname, true); - if (ot) { - /* make a copy of the properties and set unset ones to their default values. */ - PointerRNA opptr; - IDProperty *properties_default = IDP_CopyProperty(kmi->ptr->data); + if (kmi->ptr && IDP_EqualsProperties_ex(properties, kmi->ptr->data, is_strict)) { + kmi_match = true; + } + /* Debug only, helps spotting mismatches between menu entries and shortcuts! */ + else if (G.debug & G_DEBUG_WM) { + if (is_strict && kmi->ptr) { + wmOperatorType *ot = WM_operatortype_find(opname, true); + if (ot) { + /* make a copy of the properties and set unset ones to their default values. */ + PointerRNA opptr; + IDProperty *properties_default = IDP_CopyProperty(kmi->ptr->data); - RNA_pointer_create(NULL, ot->srna, properties_default, &opptr); - WM_operator_properties_default(&opptr, true); + RNA_pointer_create(NULL, ot->srna, properties_default, &opptr); + WM_operator_properties_default(&opptr, true); - if (IDP_EqualsProperties_ex(properties, properties_default, is_strict)) { - char kmi_str[128]; - WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str)); - /* NOTE: given properties could come from other things than menu entry. */ - printf( - "%s: Some set values in menu entry match default op values, " - "this might not be desired!\n", - opname); - printf("\tkm: '%s', kmi: '%s'\n", keymap->idname, kmi_str); + if (IDP_EqualsProperties_ex(properties, properties_default, is_strict)) { + char kmi_str[128]; + WM_keymap_item_to_string(kmi, false, kmi_str, sizeof(kmi_str)); + /* NOTE: given properties could come from other things than menu entry. */ + printf( + "%s: Some set values in menu entry match default op values, " + "this might not be desired!\n", + opname); + printf("\tkm: '%s', kmi: '%s'\n", keymap->idname, kmi_str); #ifndef NDEBUG # ifdef WITH_PYTHON - printf("OPERATOR\n"); - IDP_print(properties); - printf("KEYMAP\n"); - IDP_print(kmi->ptr->data); + printf("OPERATOR\n"); + IDP_print(properties); + printf("KEYMAP\n"); + IDP_print(kmi->ptr->data); # endif #endif - printf("\n"); - } - - IDP_FreeProperty(properties_default); + printf("\n"); } + + IDP_FreeProperty(properties_default); } } } - else { - kmi_match = true; - } + } + else { + kmi_match = true; + } - if (kmi_match) { - if ((params == NULL) || params->filter_fn(keymap, kmi, params->user_data)) { - return kmi; - } + if (kmi_match) { + if ((params == NULL) || params->filter_fn(keymap, kmi, params->user_data)) { + return kmi; } } }