From 4f52c49006d963415962a9b0613c9f14994cde70 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 7 Mar 2024 01:16:30 +0100 Subject: [PATCH] Don't refresh mirrors for development builds in editor export template manager Export template downloads are only available for official (pre)-releases, not development builds. This prevents an error popup from displaying every time you open the export template manager on a development build. UI elements that are non-functional in development builds are now disabled as well. --- editor/export/export_template_manager.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index c3e48820b2b..3738521491f 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -639,7 +639,9 @@ void ExportTemplateManager::_open_template_folder(const String &p_version) { void ExportTemplateManager::popup_manager() { _update_template_status(); - _refresh_mirrors(); + if (downloads_available) { + _refresh_mirrors(); + } popup_centered(Size2(720, 280) * EDSCALE); } @@ -897,7 +899,11 @@ ExportTemplateManager::ExportTemplateManager() { current_missing_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); current_missing_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT); - current_missing_label->set_text(TTR("Export templates are missing. Download them or install from a file.")); + if (downloads_available) { + current_missing_label->set_text(TTR("Export templates are missing. Download them or install from a file.")); + } else { + current_missing_label->set_text(TTR("Export templates are missing. Install them from a file.")); + } current_hb->add_child(current_missing_label); // Status: Current version is installed. @@ -950,8 +956,13 @@ ExportTemplateManager::ExportTemplateManager() { mirrors_list = memnew(OptionButton); mirrors_list->set_custom_minimum_size(Size2(280, 0) * EDSCALE); + if (downloads_available) { + mirrors_list->add_item(TTR("Best available mirror"), 0); + } else { + mirrors_list->add_item(TTR("(no templates for development builds)"), 0); + mirrors_list->set_disabled(true); + } download_install_hb->add_child(mirrors_list); - mirrors_list->add_item(TTR("Best available mirror"), 0); request_mirrors = memnew(HTTPRequest); mirrors_list->add_child(request_mirrors); @@ -960,6 +971,7 @@ ExportTemplateManager::ExportTemplateManager() { mirror_options_button = memnew(MenuButton); mirror_options_button->get_popup()->add_item(TTR("Open in Web Browser"), VISIT_WEB_MIRROR); mirror_options_button->get_popup()->add_item(TTR("Copy Mirror URL"), COPY_MIRROR_URL); + mirror_options_button->set_disabled(!downloads_available); download_install_hb->add_child(mirror_options_button); mirror_options_button->get_popup()->connect("id_pressed", callable_mp(this, &ExportTemplateManager::_mirror_options_button_cbk));