Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

Fix SceneTree editor node drag and drop reordering

Benjamin Saez96c48dd26eab
diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp
index f5e3021295b..7f2d3a04739 100644
--- a/editor/docks/scene_tree_dock.cpp
+++ b/editor/docks/scene_tree_dock.cpp
@@ -3877,8 +3877,12 @@ void SceneTreeDock::_normalize_drop(Node *&to_node, int &to_pos, int p_type) {
to_node = to_node->get_parent();
} else if (p_type == 2) {
- // Drop as first child, among others.
+ // Drop as first visible child, among others.
to_pos = 0;
+ int sibling_count = to_node->get_child_count();
+ while (to_pos < sibling_count && !_is_node_visible(to_node->get_child(to_pos, false))) {
+ to_pos++;
+ }
}
}