Fix factory-settings using stale preferences
authorCampbell Barton <ideasman42@gmail.com>
Wed, 21 Nov 2018 23:51:27 +0000 (10:51 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 21 Nov 2018 23:51:27 +0000 (10:51 +1100)
We need to reload defaults on factory startup because the defaults
now have preferences that may have changed.

source/blender/windowmanager/intern/wm_files.c

index 318147e8c250ba1520d931ed2787334013b4c059..6c86a67931b5621981dd88e3883c9065d8d039d5 100644 (file)
@@ -956,6 +956,17 @@ int wm_homefile_read(
 
        /* match the read WM with current WM */
        wm_window_match_do(C, &wmbase, &bmain->wm, &bmain->wm);
+
+       if (use_factory_settings) {
+               /*  Clear keymaps because the current default keymap may have been initialized from user preferences,
+                *  which have been reset. */
+               for (wmWindowManager *wm = bmain->wm.first; wm; wm = wm->id.next) {
+                       if (wm->defaultconf) {
+                               wm->defaultconf->flag &= ~KEYCONF_INIT_DEFAULT;
+                       }
+               }
+       }
+
        WM_check(C); /* opens window(s), checks keymaps */
 
        bmain->name[0] = '\0';