[Bf-blender-cvs] [eba1b0487c8] blender2.8: Event System: don't invoke operator that should only be executed

Jacques Lucke noreply at git.blender.org
Tue Oct 16 11:49:23 CEST 2018


Commit: eba1b0487c8e24c13b1b8c134710a6c65875100c
Author: Jacques Lucke
Date:   Tue Oct 16 11:48:12 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBeba1b0487c8e24c13b1b8c134710a6c65875100c

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

===================================================================

M	source/blender/windowmanager/intern/wm_event_system.c

===================================================================

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:



More information about the Bf-blender-cvs mailing list