summaryrefslogtreecommitdiffstats
path: root/scene/main
diff options
context:
space:
mode:
authorMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2024-11-15 09:28:57 +0100
committerMarkus Sauermann <6299227+Sauermann@users.noreply.github.com>2024-11-19 23:06:41 +0100
commit117158d2718d11c5026f4e2791c7784b4815d0aa (patch)
tree6dcd7b008e4359c29baad7e03ffef4a5b2935363 /scene/main
parent673f396677654220d7e1d5b6fb5ed3b50126b4e6 (diff)
downloadredot-engine-117158d2718d11c5026f4e2791c7784b4815d0aa.tar.gz
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.
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/viewport.cpp8
1 files changed, 8 insertions, 0 deletions
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;
+ }
}
}