-Added ability to disable overwrite warning on file dialog, fixes #4545
This commit is contained in:
parent
00bc06b50b
commit
6e9e57beaa
@ -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");
|
||||
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user