Fix keymap loading multiple times
authorCampbell Barton <ideasman42@gmail.com>
Mon, 19 Nov 2018 02:07:57 +0000 (13:07 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 19 Nov 2018 02:11:33 +0000 (13:11 +1100)
Blender defaults data-file was loading it's own key-map
with a capital 'B', the preset would load it again w/ a lowercase name.

Use lowercase key-map names.

release/scripts/presets/keyconfig/keymap_data/blender_default.py
source/blender/windowmanager/intern/wm.c

index 18ee81977aacbd7f26c143a51426ebbf8c30d498..bcda35dee5983bd109db9c3294fe97fc21ad5545 100644 (file)
@@ -5901,9 +5901,3 @@ def generate_keymaps(params=None):
 # Command to lint:
 #
 #    pylint release/scripts/presets/keyconfig/keymap_data/blender_default.py --disable=C0111,C0301,C0302,R0902,R0903,R0913
-
-
-if __name__ == "__main__":
-    from bpy_extras.keyconfig_utils import keyconfig_import_from_data
-    keyconfig_import_from_data("blender", generate_keymaps())
-    keyconfig_import_from_data("blender_27", generate_keymaps(Params(legacy=True)))
index 29a1252cf4b590be544650842011a9c1ccb843f0..06ae1e498b7aad51b9385fd72910ec8b1674f607 100644 (file)
@@ -239,12 +239,16 @@ void WM_keyconfig_init(bContext *C)
        wmWindowManager *wm = CTX_wm_manager(C);
 
        /* create standard key configs */
-       if (!wm->defaultconf)
-               wm->defaultconf = WM_keyconfig_new(wm, "Blender", false);
-       if (!wm->addonconf)
-               wm->addonconf = WM_keyconfig_new(wm, "Blender Addon", false);
-       if (!wm->userconf)
-               wm->userconf = WM_keyconfig_new(wm, "Blender User", false);
+       if (wm->defaultconf == NULL) {
+               /* Keep lowercase to match the preset filename. */
+               wm->defaultconf = WM_keyconfig_new(wm, "blender", false);
+       }
+       if (wm->addonconf == NULL) {
+               wm->addonconf = WM_keyconfig_new(wm, "blender addon", false);
+       }
+       if (wm->userconf == NULL) {
+               wm->userconf = WM_keyconfig_new(wm, "blender user", false);
+       }
 
        /* initialize only after python init is done, for keymaps that
         * use python operators */