diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 12 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 7 | ||||
-rw-r--r-- | editor/script_create_dialog.cpp | 6 |
3 files changed, 25 insertions, 0 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 353dce5b20..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); @@ -1548,6 +1558,8 @@ void EditorNode::_edit_current() { editor_plugin_screen->edit(current_obj); } + } else { + editor_plugin_screen->edit(current_obj); } Vector<EditorPlugin *> sub_plugins = editor_data.get_subeditors(current_obj); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 18de2a6221..5f2841d2c0 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1816,6 +1816,13 @@ void SceneTreeDock::_new_scene_from(String p_file) { return; } + if (EditorNode::get_singleton()->is_scene_open(p_file)) { + accept->get_ok()->set_text(TTR("OK")); + accept->set_text(TTR("Can't overwrite scene that is still open!")); + accept->popup_centered_minsize(); + return; + } + Node *base = selection.front()->get(); Map<Node *, Node *> reown; diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 24c4ba4cb7..6f5046616d 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -443,6 +443,12 @@ void ScriptCreateDialog::_path_changed(const String &p_path) { return; } + if (p.get_file().get_basename() == "") { + _msg_path_valid(false, TTR("Filename is empty")); + _update_dialog(); + return; + } + /* All checks passed */ is_path_valid = true; |