diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-10-25 13:05:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-10-25 13:47:16 +0300 |
commit | 7137d89daaaea948c9018b3719e453e67803b32d (patch) | |
tree | f752b627de42348f91c6efa69401937b9afbf80f /source/blender/blenloader | |
parent | 892c3891ed0b3228f556b57047f5789777f4a6f4 (diff) |
Preferences: remove keymap items created with invalid data path
Before T65397 was fixed, invalid "(null)" data paths were being created.
Remove these keymap items from preferences.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/versioning_userdef.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index d2192f1e22a..8328893f524 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -35,6 +35,7 @@ #include "BKE_addon.h" #include "BKE_colorband.h" #include "BKE_main.h" +#include "BKE_idprop.h" #include "BKE_keyconfig.h" #include "BLO_readfile.h" /* Own include. */ @@ -198,6 +199,18 @@ static void do_version_select_mouse(UserDef *userdef, wmKeyMapItem *kmi) } } +static bool keymap_item_has_invalid_wm_context_data_path(wmKeyMapItem *kmi, + void *UNUSED(user_data)) +{ + if (STRPREFIX(kmi->idname, "WM_OT_context_") && kmi->properties) { + IDProperty *idprop = IDP_GetPropertyFromGroup(kmi->properties, "data_path"); + if (idprop && (idprop->type == IDP_STRING) && STRPREFIX(idprop->data.pointer, "(null)")) { + return true; + } + } + return false; +} + /* patching UserDef struct and Themes */ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) { @@ -637,6 +650,16 @@ void BLO_version_defaults_userpref_blend(Main *bmain, UserDef *userdef) } } + if (!USER_VERSION_ATLEAST(281, 16)) { + BKE_keyconfig_pref_filter_items(userdef, + &((struct wmKeyConfigFilterItemParams){ + .check_item = true, + .check_diff_item_add = true, + }), + keymap_item_has_invalid_wm_context_data_path, + NULL); + } + /** * Include next version bump. */ |