Fix key-maps being handled twice when reloading scripts

This commit is contained in:
Campbell Barton 2023-08-31 12:04:28 +10:00
parent 4a42f2b07c
commit 1ffc0a9e64
2 changed files with 8 additions and 18 deletions

View File

@ -179,8 +179,12 @@ typedef struct wmWindowManager {
/** Active dragged items. */
ListBase drags;
/** Known key configurations. */
/**
* Known key configurations.
* This includes all the #wmKeyConfig members (`defaultconf`, `addonconf`, etc).
*/
ListBase keyconfigs;
/** Default configuration. */
struct wmKeyConfig *defaultconf;
/** Addon configuration. */

View File

@ -1846,26 +1846,12 @@ void WM_keyconfig_update(wmWindowManager *wm)
}
if (wm_keymap_update_flag & WM_KEYMAP_UPDATE_OPERATORTYPE) {
/* an operatortype has been removed, this won't happen often
* but when it does we have to check _every_ keymap item */
ListBase *keymaps_lb[] = {
&U.user_keymaps,
&wm->userconf->keymaps,
&wm->defaultconf->keymaps,
&wm->addonconf->keymaps,
nullptr,
};
int i;
for (i = 0; keymaps_lb[i]; i++) {
wm_keymap_item_properties_update_ot_from_list(keymaps_lb[i]);
}
/* One or more operator-types have been removed, this won't happen often
* but when it does we have to check _every_ key-map item. */
wm_keymap_item_properties_update_ot_from_list(&U.user_keymaps);
LISTBASE_FOREACH (wmKeyConfig *, kc, &wm->keyconfigs) {
wm_keymap_item_properties_update_ot_from_list(&kc->keymaps);
}
wm_keymap_update_flag &= ~WM_KEYMAP_UPDATE_OPERATORTYPE;
}