diff options
author | Jacques Lucke <mail@jlucke.com> | 2018-10-16 12:48:12 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2018-10-16 12:48:12 +0300 |
commit | eba1b0487c8e24c13b1b8c134710a6c65875100c (patch) | |
tree | a107af8182f7dd039e0df358d4d31a1ecc4cf53e | |
parent | 09cd651bb7e59044cbcd0664e8b1064cb37734ed (diff) |
Event System: don't invoke operator that should only be executed
Problem was that the event was not `NULL` even though the `context` is `WM_OP_EXEC_*`.
I noticed this problem when dropping .blend files into Blender.
Instead of only executing `WM_OT_open_mainfile`, it was invoked (opening a file selector).
The `wm_operator_invoke`, which also executes operators, always invokes operators when `event != NULL`. So setting `event` to `NULL` tells `wm_operator_invoke` not to invoke but to execute the operator.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D3799
-rw-r--r-- | source/blender/windowmanager/intern/wm_event_system.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 9007b941057..955713c90f1 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -1467,9 +1467,21 @@ static int wm_operator_call_internal( break; } } + else { + switch (context) { + case WM_OP_EXEC_DEFAULT: + case WM_OP_EXEC_REGION_WIN: + case WM_OP_EXEC_REGION_PREVIEW: + case WM_OP_EXEC_REGION_CHANNELS: + case WM_OP_EXEC_AREA: + case WM_OP_EXEC_SCREEN: + event = NULL; + default: + break; + } + } switch (context) { - case WM_OP_EXEC_REGION_WIN: case WM_OP_INVOKE_REGION_WIN: case WM_OP_EXEC_REGION_CHANNELS: |