diff options
-rw-r--r-- | tools/editor/editor_file_dialog.cpp | 18 | ||||
-rw-r--r-- | tools/editor/editor_file_dialog.h | 4 | ||||
-rw-r--r-- | tools/editor/script_create_dialog.cpp | 1 |
3 files changed, 21 insertions, 2 deletions
diff --git a/tools/editor/editor_file_dialog.cpp b/tools/editor/editor_file_dialog.cpp index 5afc4a7192..97feaa80a5 100644 --- a/tools/editor/editor_file_dialog.cpp +++ b/tools/editor/editor_file_dialog.cpp @@ -380,7 +380,7 @@ void EditorFileDialog::_action_pressed() { } - if (dir_access->file_exists(f)) { + if (dir_access->file_exists(f) && !disable_overwrite_warning) { confirm_save->set_text(TTR("File Exists, Overwrite?")); confirm_save->popup_centered(Size2(200,80)); } else { @@ -1162,6 +1162,8 @@ void EditorFileDialog::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_display_mode","mode"),&EditorFileDialog::set_display_mode); ObjectTypeDB::bind_method(_MD("get_display_mode"),&EditorFileDialog::get_display_mode); ObjectTypeDB::bind_method(_MD("_thumbnail_result"),&EditorFileDialog::_thumbnail_result); + ObjectTypeDB::bind_method(_MD("set_disable_overwrite_warning","disable"),&EditorFileDialog::set_disable_overwrite_warning); + ObjectTypeDB::bind_method(_MD("is_overwrite_warning_disabled"),&EditorFileDialog::is_overwrite_warning_disabled); ObjectTypeDB::bind_method(_MD("_recent_selected"),&EditorFileDialog::_recent_selected); ObjectTypeDB::bind_method(_MD("_go_back"),&EditorFileDialog::_go_back); @@ -1235,12 +1237,23 @@ void EditorFileDialog::_save_to_recent() { } +void EditorFileDialog::set_disable_overwrite_warning(bool p_disable) { + + disable_overwrite_warning=p_disable; +} + +bool EditorFileDialog::is_overwrite_warning_disabled() const{ + + return disable_overwrite_warning; +} + + EditorFileDialog::EditorFileDialog() { show_hidden_files=default_show_hidden_files; display_mode=default_display_mode; local_history_pos=0; - + disable_overwrite_warning=false; VBoxContainer *vbc = memnew( VBoxContainer ); add_child(vbc); set_child_rect(vbc); @@ -1466,4 +1479,5 @@ EditorLineEditFileChooser::EditorLineEditFileChooser() { dialog->connect("dir_selected",this,"_chosen"); dialog->connect("files_selected",this,"_chosen"); + } diff --git a/tools/editor/editor_file_dialog.h b/tools/editor/editor_file_dialog.h index 5de33e2597..14683856c0 100644 --- a/tools/editor/editor_file_dialog.h +++ b/tools/editor/editor_file_dialog.h @@ -130,6 +130,7 @@ private: bool show_hidden_files; DisplayMode display_mode; + bool disable_overwrite_warning; bool invalidated; void update_dir(); @@ -216,6 +217,9 @@ public: void invalidate(); + void set_disable_overwrite_warning(bool p_disable); + bool is_overwrite_warning_disabled() const; + EditorFileDialog(); ~EditorFileDialog(); diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index e88d603b30..e93a40efbc 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -185,6 +185,7 @@ void ScriptCreateDialog::_built_in_pressed() { void ScriptCreateDialog::_browse_path() { file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_browse->set_disable_overwrite_warning(true); file_browse->clear_filters(); List<String> extensions; |