summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 1ae28617f9..3eebb73cdb 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1174,6 +1174,16 @@ void EditorNode::_dialog_action(String p_file) {
int scene_idx = (current_option == FILE_SAVE_SCENE || current_option == FILE_SAVE_AS_SCENE) ? -1 : tab_closing;
if (file->get_mode() == EditorFileDialog::MODE_SAVE_FILE) {
+ bool same_open_scene = false;
+ for (int i = 0; i < editor_data.get_edited_scene_count(); i++) {
+ if (editor_data.get_scene_path(i) == p_file && i != scene_idx)
+ same_open_scene = true;
+ }
+
+ if (same_open_scene) {
+ show_warning(TTR("Can't overwrite scene that is still open!"));
+ return;
+ }
_save_default_environment();
_save_scene_with_preview(p_file, scene_idx);