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:
authorLukas Tönne <lukas.toenne@gmail.com>2018-08-12 14:52:49 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2018-08-12 14:52:49 +0300
commitdc2d841b7c50565302af2986d62ddbd29c332acd (patch)
tree324f234e56fde77fb80dfdef0c7c21f01968f71b /source/blender/windowmanager/intern/wm_keymap.c
parent27b28e437d974ebbafa234205941c07aa0ab546c (diff)
parent4b6fa4d897a0bb3252b16383492b526d2cef3920 (diff)
Merge branch 'blender2.8' into hair_guideshair_guides
Diffstat (limited to 'source/blender/windowmanager/intern/wm_keymap.c')
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index a95ccf36fdb..6815ff4413a 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -526,6 +526,25 @@ wmKeyMapItem *WM_keymap_add_tool(wmKeyMap *keymap, const char *idname, int type,
return kmi;
}
+/** Useful for mapping numbers to an enum. */
+void WM_keymap_add_context_enum_set_items(
+ wmKeyMap *keymap, const EnumPropertyItem *items, const char *data_path,
+ int type_start, int val, int modifier, int keymodifier)
+{
+ for (int i = 0, type_offset = 0; items[i].identifier; i++) {
+ if (items[i].identifier[0] == '\0') {
+ continue;
+ }
+ wmKeyMapItem *kmi = WM_keymap_add_item(
+ keymap, "WM_OT_context_set_enum",
+ type_start + type_offset, val, modifier, keymodifier);
+ RNA_string_set(kmi->ptr, "data_path", data_path);
+ RNA_string_set(kmi->ptr, "value", items[i].identifier);
+ type_offset += 1;
+ }
+}
+
+
bool WM_keymap_remove_item(wmKeyMap *keymap, wmKeyMapItem *kmi)
{
if (BLI_findindex(&keymap->items, kmi) != -1) {