Skip to content

armgit / godot

Public Imported from GitHub
0

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

Reselect the edited node after drop without scrolling to it.

AeioMuch11bf855da9b7
diff --git a/editor/docks/scene_tree_dock.cpp b/editor/docks/scene_tree_dock.cpp
index e88be3571ea..5140b1014a6 100644
--- a/editor/docks/scene_tree_dock.cpp
+++ b/editor/docks/scene_tree_dock.cpp
@@ -1876,8 +1876,11 @@ void SceneTreeDock::_notification(int p_what) {
Node *node_edited = Object::cast_to<Node>(InspectorDock::get_inspector_singleton()->get_edited_object());
if (node_edited) {
editor_selection->clear();
- editor_selection->add_node(node_edited);
- scene_tree->set_selected(node_edited);
+ const NodePath np = edited_scene->get_path_to(node_edited);
+ TreeItem *item = scene_tree->get_scene_tree()->get_item_with_metadata(np);
+ if (item) {
+ scene_tree->get_scene_tree()->set_selected(item);
+ }
}
} break;