Prevent the surface upgrade tool from running during export

Also add an explicit way to trigger the tool manually
at user's will.
This commit is contained in:
Yuri Sizov
2023-11-20 14:44:38 +01:00
parent 80de898d72
commit fdaee9ee89
6 changed files with 88 additions and 18 deletions

View File

@@ -1076,11 +1076,13 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
EditorSettings::get_singleton()->set_project_metadata("export_options", "default_filename", default_filename);
Ref<EditorExportPreset> current = get_current_preset();
ERR_FAIL_COND(current.is_null());
ERR_FAIL_COND_MSG(current.is_null(), "Failed to start the export: current preset is invalid.");
Ref<EditorExportPlatform> platform = current->get_platform();
ERR_FAIL_COND(platform.is_null());
ERR_FAIL_COND_MSG(platform.is_null(), "Failed to start the export: current preset has no valid platform.");
current->set_export_path(p_path);
exporting = true;
platform->clear_messages();
Error err = platform->export_project(current, export_debug->is_pressed(), current->get_export_path(), 0);
result_dialog_log->clear();
@@ -1089,6 +1091,8 @@ void ProjectExportDialog::_export_project_to_path(const String &p_path) {
result_dialog->popup_centered_ratio(0.5);
}
}
exporting = false;
}
void ProjectExportDialog::_export_all_dialog() {
@@ -1108,19 +1112,29 @@ 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);
ERR_FAIL_COND(preset.is_null());
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();
ERR_FAIL_COND(platform.is_null());
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);
@@ -1129,6 +1143,8 @@ void ProjectExportDialog::_export_all(bool p_debug) {
if (show_dialog) {
result_dialog->popup_centered_ratio(0.5);
}
exporting = false;
}
void ProjectExportDialog::_bind_methods() {