浏览代码

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.
Markus Sauermann 9 月之前
父节点
当前提交
f53a220a72
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      scene/main/viewport.cpp

+ 3 - 2
scene/main/viewport.cpp

@@ -682,8 +682,9 @@ void Viewport::_process_picking() {
 	if (Object::cast_to<Window>(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;
 	}