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
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user