Skip to content

armgit / godot

Public Imported from GitHub
0

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

Stop node editing when reloading the scene

kobewi1fe7307b1e85
diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp
index bc3f5f7bdab..58fd698114c 100644
--- a/editor/editor_data.cpp
+++ b/editor/editor_data.cpp
@@ -37,6 +37,7 @@
#include "core/object/callable_mp.h"
#include "core/object/class_db.h"
#include "core/os/time.h"
+#include "editor/docks/scene_tree_dock.h"
#include "editor/editor_node.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/inspector/editor_context_menu_plugin.h"
@@ -795,6 +796,9 @@ bool EditorData::reload_scene_from_memory(int p_idx, bool p_mark_unsaved) {
}
}
+ // Make sure no editor is editing a node when the scene is freed.
+ EditorNode::get_singleton()->hide_unused_editors(SceneTreeDock::get_singleton());
+
new_scene->set_scene_file_path(edited_scene[p_idx].root->get_scene_file_path());
Node *old_root = edited_scene[p_idx].root;
EditorNode::get_singleton()->set_edited_scene(new_scene);