From 117158d2718d11c5026f4e2791c7784b4815d0aa Mon Sep 17 00:00:00 2001 From: Markus Sauermann <6299227+Sauermann@users.noreply.github.com> Date: Fri, 15 Nov 2024 09:28:57 +0100 Subject: Introduce a `SubViewportContainer` config for drag-and-drop targets With the drag-and-drop rewrite, `SubViewportContainer` nodes were no longer available as drop-locations. This PR introduces a configuration option, that allows `SubViewportContainer` to be considered as drop-location, but disables the `Control` nodes inside its `SubViewport` children as drop-location. --- scene/main/viewport.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scene/main') diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index e70407f36e..9b27a28831 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -3062,6 +3062,14 @@ void Viewport::_update_mouse_over(Vector2 p_pos) { } v->_update_mouse_over(v->get_final_transform().affine_inverse().xform(pos)); } + + Viewport *section_root = get_section_root_viewport(); + if (section_root && c->is_consume_drag_and_drop_enabled()) { + // Evaluating `consume_drag_and_drop` and adjusting target_control needs to happen + // after `_update_mouse_over` in the SubViewports, because otherwise physics picking + // would not work inside SubViewports. + section_root->gui.target_control = over; + } } } -- cgit v1.2.3