diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-01-20 18:52:20 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-01-20 19:09:56 +0300 |
commit | 661d363e13ff3c86b30d09333e5334146e5da79f (patch) | |
tree | 9819fb8cf5224f0b8aa76a216217cbfb4f8089db /source/blender/windowmanager/intern | |
parent | a5f19e3f7270b335d324c4fa5a9ca33e59376ef0 (diff) |
Fix T73162: Modal tools cant be mapped to MMB
Also rename struct members to 'launch_event', since it's more
descriptive and was called this in some places.
Diffstat (limited to 'source/blender/windowmanager/intern')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operator_utils.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c index 856c85d4554..44afa708136 100644 --- a/source/blender/windowmanager/intern/wm_operator_utils.c +++ b/source/blender/windowmanager/intern/wm_operator_utils.c @@ -148,6 +148,7 @@ static bool interactive_value_update(ValueInteraction *inter, * \{ */ struct ObCustomData_ForEditMode { + int launch_event; bool wait_for_input; bool is_active; bool is_first; @@ -211,6 +212,7 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e } struct ObCustomData_ForEditMode *cd = MEM_callocN(sizeof(*cd), __func__); + cd->launch_event = WM_userdef_event_type_from_keymap_type(event->type); cd->wait_for_input = RNA_boolean_get(op->ptr, "wait_for_input"); cd->is_active = !cd->wait_for_input; cd->is_first = true; @@ -239,6 +241,15 @@ static int op_generic_value_invoke(bContext *C, wmOperator *op, const wmEvent *e static int op_generic_value_modal(bContext *C, wmOperator *op, const wmEvent *event) { struct ObCustomData_ForEditMode *cd = op->customdata; + + /* Special case, check if we release the event that activated this operator. */ + if ((event->type == cd->launch_event) && (event->val == KM_RELEASE)) { + if (cd->wait_for_input == false) { + op_generic_value_exit(op); + return OPERATOR_FINISHED; + } + } + switch (event->type) { case MOUSEMOVE: case LEFTCTRLKEY: |