From 2056e8b0283a05fd83f1f9e6439a8c79ca7ecc45 Mon Sep 17 00:00:00 2001 From: SaracenOne Date: Sun, 2 Jan 2022 07:50:53 +0000 Subject: [PATCH] Prevent saving branches in foreign scenes --- editor/scene_tree_dock.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9f2dd986ec6..922214fdfe0 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -948,6 +948,18 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } + if (tocopy->get_owner() != scene) { + accept->set_text(TTR("Can't sSavave a branch which is a child of an already instantiated scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + + if (scene->get_scene_inherited_state().is_valid() && scene->get_scene_inherited_state()->find_node_by_path(scene->get_path_to(tocopy)) >= 0) { + accept->set_text(TTR("Can't save a branch which is part of an inherited scene.\nTo save this branch into its own scene, open the original scene, right click on this branch, and select \"Save Branch as Scene\".")); + accept->popup_centered(); + break; + } + new_scene_from_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); List extensions;