Fix #28310: import of key configuration with modal keymap not working.
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Sep 2011 13:22:26 +0000 (13:22 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 8 Sep 2011 13:22:26 +0000 (13:22 +0000)
source/blender/windowmanager/intern/wm_keymap.c

index 0e94ad72d350ea2d22898be8bd37022df3d418a3..854fa688ea4d9b108da23f340f4764abe3a6071d 100644 (file)
@@ -47,6 +47,7 @@
 #include "BKE_blender.h"
 #include "BKE_context.h"
 #include "BKE_idprop.h"
+#include "BKE_global.h"
 #include "BKE_library.h"
 #include "BKE_main.h"
 #include "BKE_screen.h"
@@ -680,6 +681,17 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, EnumPrope
        wmKeyMap *km= WM_keymap_find(keyconf, idname, 0, 0);
        km->flag |= KEYMAP_MODAL;
        km->modal_items= items;
+
+       if(!items) {
+               /* init modal items from default config */
+               wmWindowManager *wm = G.main->wm.first;
+               wmKeyMap *defaultkm= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0);
+
+               if(defaultkm) {
+                       km->modal_items = defaultkm->modal_items;
+                       km->poll = defaultkm->poll;
+               }
+       }
        
        return km;
 }