Skip to content

Commit

Permalink
Don't refresh mirrors for development builds in editor export templat…
Browse files Browse the repository at this point in the history
…e 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.
  • Loading branch information
Calinou committed Mar 7, 2024
1 parent bfdac95 commit 4f52c49
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions editor/export/export_template_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand All @@ -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));

Expand Down

0 comments on commit 4f52c49

Please sign in to comment.