Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-13 23:01:32 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-11-13 23:02:40 +0300
commit520f71b43a4b24fb7c59d5798657cb7afb552ecf (patch)
tree2c974e2fb8a50d68604a13bdbc3ad9e9c0ea9cb6 /source
parentf9145bded3d0049190a0a6af7ad661a1403e6ce2 (diff)
Fix tool keymaps not working properly after recent changes.
Not sure this is the best fix, but this should be working. Regardless it seems good to tag active tool keymaps as such.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_windowmanager_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c17
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c5
3 files changed, 18 insertions, 5 deletions
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index e13847f2473..e51933f5a22 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -345,6 +345,7 @@ enum {
KEYMAP_DIFF = (1 << 4), /* diff keymap for user preferences */
KEYMAP_USER_MODIFIED = (1 << 5), /* keymap has user modifications */
KEYMAP_UPDATE = (1 << 6),
+ KEYMAP_TOOL = (1 << 7), /* keymap for active tool system */
};
typedef struct wmKeyConfig {
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index f8a9b00c724..84bb339b4c5 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -283,14 +283,22 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA
RNA_POINTER_INVALIDATE(kmi_ptr);
}
-static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal)
+static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal, bool tool)
{
+ wmKeyMap *keymap;
+
if (modal == 0) {
- return WM_keymap_ensure(keyconf, idname, spaceid, regionid);
+ keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
}
else {
- return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
+ keymap = WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
+ }
+
+ if (keymap && tool) {
+ keymap->flag |= KEYMAP_TOOL;
}
+
+ return keymap;
}
static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
@@ -871,7 +879,8 @@ void RNA_api_keymaps(StructRNA *srna)
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- RNA_def_boolean(func, "modal", 0, "Modal", "");
+ RNA_def_boolean(func, "modal", 0, "Modal", "Keymap for modal operators");
+ RNA_def_boolean(func, "tool", 0, "Tool", "Keymap for active tools");
parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
RNA_def_function_return(func, parm);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 4032f47eec2..2685a1bfafd 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -267,7 +267,10 @@ wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, const char *idname, bool user
/* For default configuration, we need to keep keymap
* modal items and poll functions intact. */
for (wmKeyMap *km = keyconf->keymaps.first; km; km = km->next) {
- WM_keymap_clear(km);
+ /* Tool system keymaps are not part of preset, so don't clear. */
+ if (!(km->flag & KEYMAP_TOOL)) {
+ WM_keymap_clear(km);
+ }
}
}
else {