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
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/blender/makesrna/intern/rna_wm_api.c
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/blender/makesrna/intern/rna_wm_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c17
1 files changed, 13 insertions, 4 deletions
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);