Ensure more export errors are reported to users
Also fixes the timing issue when exporting all presets at the same time, where the error report would try to appear while the progress dialog was still visible.
This commit is contained in:
parent
2f73a059ce
commit
773b4d7764
9 changed files with 195 additions and 104 deletions
|
|
@ -1109,37 +1109,40 @@ void ProjectExportDialog::_export_all_dialog_action(const String &p_str) {
|
|||
}
|
||||
|
||||
void ProjectExportDialog::_export_all(bool p_debug) {
|
||||
String export_target = p_debug ? TTR("Debug") : TTR("Release");
|
||||
EditorProgress ep("exportall", TTR("Exporting All") + " " + export_target, EditorExport::get_singleton()->get_export_preset_count(), true);
|
||||
|
||||
exporting = true;
|
||||
|
||||
bool show_dialog = false;
|
||||
result_dialog_log->clear();
|
||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
|
||||
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
|
||||
if (preset.is_null()) {
|
||||
exporting = false;
|
||||
ERR_FAIL_MSG("Failed to start the export: one of the presets is invalid.");
|
||||
}
|
||||
|
||||
Ref<EditorExportPlatform> platform = preset->get_platform();
|
||||
if (platform.is_null()) {
|
||||
exporting = false;
|
||||
ERR_FAIL_MSG("Failed to start the export: one of the presets has no valid platform.");
|
||||
}
|
||||
{ // Scope for the editor progress, we must free it before showing the dialog at the end.
|
||||
String export_target = p_debug ? TTR("Debug") : TTR("Release");
|
||||
EditorProgress ep("exportall", TTR("Exporting All") + " " + export_target, EditorExport::get_singleton()->get_export_preset_count(), true);
|
||||
|
||||
ep.step(preset->get_name(), i);
|
||||
result_dialog_log->clear();
|
||||
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
|
||||
Ref<EditorExportPreset> preset = EditorExport::get_singleton()->get_export_preset(i);
|
||||
if (preset.is_null()) {
|
||||
exporting = false;
|
||||
ERR_FAIL_MSG("Failed to start the export: one of the presets is invalid.");
|
||||
}
|
||||
|
||||
platform->clear_messages();
|
||||
Error err = platform->export_project(preset, p_debug, preset->get_export_path(), 0);
|
||||
if (err == ERR_SKIP) {
|
||||
exporting = false;
|
||||
return;
|
||||
Ref<EditorExportPlatform> platform = preset->get_platform();
|
||||
if (platform.is_null()) {
|
||||
exporting = false;
|
||||
ERR_FAIL_MSG("Failed to start the export: one of the presets has no valid platform.");
|
||||
}
|
||||
|
||||
ep.step(preset->get_name(), i);
|
||||
|
||||
platform->clear_messages();
|
||||
Error err = platform->export_project(preset, p_debug, preset->get_export_path(), 0);
|
||||
if (err == ERR_SKIP) {
|
||||
exporting = false;
|
||||
return;
|
||||
}
|
||||
bool has_messages = platform->fill_log_messages(result_dialog_log, err);
|
||||
show_dialog = show_dialog || has_messages;
|
||||
}
|
||||
bool has_messages = platform->fill_log_messages(result_dialog_log, err);
|
||||
show_dialog = show_dialog || has_messages;
|
||||
}
|
||||
|
||||
if (show_dialog) {
|
||||
result_dialog->popup_centered_ratio(0.5);
|
||||
}
|
||||
|
|
@ -1148,7 +1151,6 @@ void ProjectExportDialog::_export_all(bool p_debug) {
|
|||
}
|
||||
|
||||
void ProjectExportDialog::_bind_methods() {
|
||||
ClassDB::bind_method("_export_all", &ProjectExportDialog::_export_all);
|
||||
ClassDB::bind_method("set_export_path", &ProjectExportDialog::set_export_path);
|
||||
ClassDB::bind_method("get_export_path", &ProjectExportDialog::get_export_path);
|
||||
ClassDB::bind_method("get_current_preset", &ProjectExportDialog::get_current_preset);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue