diff options
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 15 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 9 |
3 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index 6504cf8914b..f2eaa9d075f 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -116,6 +116,7 @@ extern const EnumPropertyItem rna_enum_motionpath_bake_location_items[]; extern const EnumPropertyItem rna_enum_event_value_items[]; extern const EnumPropertyItem rna_enum_event_type_items[]; +extern const EnumPropertyItem rna_enum_event_type_mask_items[]; extern const EnumPropertyItem rna_enum_operator_return_items[]; extern const EnumPropertyItem rna_enum_operator_property_tags[]; diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 77a10e6dbbc..77b9d639fa7 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -406,6 +406,21 @@ const EnumPropertyItem rna_enum_keymap_propvalue_items[] = { {0, NULL, 0, NULL, NULL} }; + +/* Mask event types used in keymap items. */ +const EnumPropertyItem rna_enum_event_type_mask_items[] = { + {EVT_TYPE_MASK_KEYBOARD_MODIFIER, "KEYBOARD_MODIFIER", 0, "Keyboard Modifier", ""}, + {EVT_TYPE_MASK_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""}, + {EVT_TYPE_MASK_MOUSE_WHEEL, "MOUSE_WHEEL", 0, "Mouse Wheel", ""}, + {EVT_TYPE_MASK_MOUSE_GESTURE, "MOUSE_GESTURE", 0, "Mouse Gesture", ""}, + {EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""}, + {EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""}, + {EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""}, + {EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""}, + {EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""}, + {0, NULL, 0, NULL, NULL} +}; + #if 0 static const EnumPropertyItem keymap_modifiers_items[] = { {KM_ANY, "ANY", 0, "Any", ""}, diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 92a396c22b9..f698f71ad24 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -44,6 +44,7 @@ #include "UI_interface.h" #include "wm_cursors.h" +#include "wm_event_types.h" #include "rna_internal.h" /* own include */ @@ -371,14 +372,15 @@ static PointerRNA rna_KeyConfig_find_item_from_operator( const char *idname, int opcontext, PointerRNA *properties, - bool is_hotkey, + int include_mask, int exclude_mask, PointerRNA *km_ptr) { char idname_bl[OP_MAX_TYPENAME]; WM_operator_bl_idname(idname_bl, idname); wmKeyMap *km = NULL; - wmKeyMapItem *kmi = WM_key_event_operator(C, idname_bl, opcontext, properties->data, (bool)is_hotkey, &km); + wmKeyMapItem *kmi = WM_key_event_operator( + C, idname_bl, opcontext, properties->data, include_mask, exclude_mask, &km); PointerRNA kmi_ptr; RNA_pointer_create(&wm->id, &RNA_KeyMap, km, km_ptr); RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &kmi_ptr); @@ -972,7 +974,8 @@ void RNA_api_keyconfigs(StructRNA *srna) RNA_def_property_enum_items(parm, rna_enum_operator_context_items); parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR); - RNA_def_boolean(func, "is_hotkey", 0, "Hotkey", "Event is not a modifier"); + RNA_def_enum_flag(func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", ""); + RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", ""); parm = RNA_def_pointer(func, "keymap", "KeyMap", "", ""); RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_OUTPUT); parm = RNA_def_pointer(func, "item", "KeyMapItem", "", ""); |