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