Fixes to make exporting more responsive.

-Process and drop input in step functions.
-Hide editor file dialog right after pressing ok
-Use actual editor file dialogs for project export.
This commit is contained in:
Juan Linietsky 2019-04-24 15:52:15 -03:00
parent e1d16e722e
commit faaecd6987
5 changed files with 21 additions and 18 deletions

View file

@ -233,8 +233,8 @@ void EditorFileDialog::_file_entered(const String &p_file) {
void EditorFileDialog::_save_confirm_pressed() {
String f = dir_access->get_current_dir().plus_file(file->get_text());
_save_to_recent();
emit_signal("file_selected", f);
hide();
emit_signal("file_selected", f);
}
void EditorFileDialog::_post_popup() {
@ -343,8 +343,8 @@ void EditorFileDialog::_action_pressed() {
if (files.size()) {
_save_to_recent();
emit_signal("files_selected", files);
hide();
emit_signal("files_selected", files);
}
return;
@ -354,8 +354,8 @@ void EditorFileDialog::_action_pressed() {
if ((mode == MODE_OPEN_ANY || mode == MODE_OPEN_FILE) && dir_access->file_exists(f)) {
_save_to_recent();
emit_signal("file_selected", f);
hide();
emit_signal("file_selected", f);
} else if (mode == MODE_OPEN_ANY || mode == MODE_OPEN_DIR) {
String path = dir_access->get_current_dir();
@ -374,8 +374,8 @@ void EditorFileDialog::_action_pressed() {
}
_save_to_recent();
emit_signal("dir_selected", path);
hide();
emit_signal("dir_selected", path);
}
if (mode == MODE_SAVE_FILE) {
@ -441,8 +441,8 @@ void EditorFileDialog::_action_pressed() {
} else {
_save_to_recent();
emit_signal("file_selected", f);
hide();
emit_signal("file_selected", f);
}
}
}

View file

@ -161,6 +161,7 @@ void ProgressDialog::_popup() {
main->set_margin(MARGIN_TOP, style->get_margin(MARGIN_TOP));
main->set_margin(MARGIN_BOTTOM, -style->get_margin(MARGIN_BOTTOM));
raise();
popup_centered(ms);
}
@ -219,6 +220,8 @@ bool ProgressDialog::task_step(const String &p_task, const String &p_state, int
last_progress_tick = OS::get_singleton()->get_ticks_usec();
if (cancel_hb->is_visible()) {
OS::get_singleton()->force_process_input();
} else {
OS::get_singleton()->process_and_drop_events();
}
Main::iteration(); // this will not work on a lot of platforms, so it's only meant for the editor
return cancelled;

View file

@ -931,7 +931,7 @@ void ProjectExportDialog::_export_project() {
Ref<EditorExportPlatform> platform = current->get_platform();
ERR_FAIL_COND(platform.is_null());
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
export_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
export_project->clear_filters();
List<String> extension_list = platform->get_binary_extensions(current);
@ -955,7 +955,7 @@ void ProjectExportDialog::_export_project() {
export_project->get_line_edit()->connect("text_entered", export_project, "_file_entered");
}
export_project->set_mode(FileDialog::MODE_SAVE_FILE);
export_project->set_mode(EditorFileDialog::MODE_SAVE_FILE);
export_project->popup_centered_ratio();
}
@ -1184,9 +1184,9 @@ ProjectExportDialog::ProjectExportDialog() {
patches_hb->add_child(patch_export);
patches_hb->add_spacer();
patch_dialog = memnew(FileDialog);
patch_dialog = memnew(EditorFileDialog);
patch_dialog->add_filter("*.pck ; Pack File");
patch_dialog->set_mode(FileDialog::MODE_OPEN_FILE);
patch_dialog->set_mode(EditorFileDialog::MODE_OPEN_FILE);
patch_dialog->connect("file_selected", this, "_patch_selected");
add_child(patch_dialog);
@ -1266,11 +1266,11 @@ ProjectExportDialog::ProjectExportDialog() {
export_all_button->connect("pressed", this, "_export_all_dialog");
export_all_button->set_disabled(true);
export_pck_zip = memnew(FileDialog);
export_pck_zip = memnew(EditorFileDialog);
export_pck_zip->add_filter("*.zip ; ZIP File");
export_pck_zip->add_filter("*.pck ; Godot Game Pack");
export_pck_zip->set_access(FileDialog::ACCESS_FILESYSTEM);
export_pck_zip->set_mode(FileDialog::MODE_SAVE_FILE);
export_pck_zip->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
export_pck_zip->set_mode(EditorFileDialog::MODE_SAVE_FILE);
add_child(export_pck_zip);
export_pck_zip->connect("file_selected", this, "_export_pck_zip_selected");
@ -1300,8 +1300,8 @@ ProjectExportDialog::ProjectExportDialog() {
export_templates_error->add_child(download_templates);
download_templates->connect("pressed", this, "_open_export_template_manager");
export_project = memnew(FileDialog);
export_project->set_access(FileDialog::ACCESS_FILESYSTEM);
export_project = memnew(EditorFileDialog);
export_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM);
add_child(export_project);
export_project->connect("file_selected", this, "_export_project_to_path");
export_project->get_line_edit()->connect("text_changed", this, "_validate_export_path");

View file

@ -90,7 +90,7 @@ private:
Tree *patches;
Button *patch_export;
int patch_index;
FileDialog *patch_dialog;
EditorFileDialog *patch_dialog;
ConfirmationDialog *patch_erase;
Button *export_button;
@ -139,8 +139,8 @@ private:
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
FileDialog *export_pck_zip;
FileDialog *export_project;
EditorFileDialog *export_pck_zip;
EditorFileDialog *export_project;
CheckBox *export_debug;
CheckBox *export_pck_zip_debug;

View file

@ -2485,7 +2485,7 @@ Error OS_Windows::execute(const String &p_path, const List<String> &p_arguments,
}
(*r_pipe) += buf;
if (p_pipe_mutex) {
p_pipe_mutex->lock();
p_pipe_mutex->unlock();
}
}