From f53a220a7255af6328b0683d1ce8a6671d87976a Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Wed, 27 Nov 2024 22:29:42 +0100 Subject: [PATCH] Fix physics picking when hovering an embedded window When the mouse is hovering an embedded window, it is still considered within the main viewport. Previously in this case physics picking was executed, as if no embedded window was there. This PR introduces an additional check to exclude these cases. --- scene/main/viewport.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index dd3ae1ad3c..373af20d35 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -682,8 +682,9 @@ void Viewport::_process_picking() { if (Object::cast_to(this) && Input::get_singleton()->get_mouse_mode() == Input::MOUSE_MODE_CAPTURED) { return; } - if (!gui.mouse_in_viewport) { - // Clear picking events if mouse has left viewport. + if (!gui.mouse_in_viewport || gui.subwindow_over) { + // Clear picking events if the mouse has left the viewport or is over an embedded window. + // These are locations, that are expected to not trigger physics picking. physics_picking_events.clear(); return; }