Export: Properly reload preset when opening dialog
Fixes #20119 where newly installed templates were not detected.
Also fix a bug with preset deletion where it would attempt to
edit an already removed preset. For this I made it so that
ItemList::deselect_all() also resets `current` to -1, as a manual
ItemList::deselect(idx) already does.
(cherry picked from commit 13239cd4cc
)
This commit is contained in:
parent
c68a465f47
commit
392d988228
|
@ -2045,10 +2045,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case SETTINGS_EXPORT_PREFERENCES: {
|
|
||||||
|
|
||||||
//project_export_settings->popup_centered_ratio();
|
|
||||||
} break;
|
|
||||||
case FILE_IMPORT_SUBSCENE: {
|
case FILE_IMPORT_SUBSCENE: {
|
||||||
|
|
||||||
//import_subscene->popup_centered_ratio();
|
//import_subscene->popup_centered_ratio();
|
||||||
|
|
|
@ -173,7 +173,6 @@ private:
|
||||||
SETTINGS_UPDATE_ALWAYS,
|
SETTINGS_UPDATE_ALWAYS,
|
||||||
SETTINGS_UPDATE_CHANGES,
|
SETTINGS_UPDATE_CHANGES,
|
||||||
SETTINGS_UPDATE_SPINNER_HIDE,
|
SETTINGS_UPDATE_SPINNER_HIDE,
|
||||||
SETTINGS_EXPORT_PREFERENCES,
|
|
||||||
SETTINGS_PREFERENCES,
|
SETTINGS_PREFERENCES,
|
||||||
SETTINGS_LAYOUT_SAVE,
|
SETTINGS_LAYOUT_SAVE,
|
||||||
SETTINGS_LAYOUT_DELETE,
|
SETTINGS_LAYOUT_DELETE,
|
||||||
|
|
|
@ -121,7 +121,6 @@ void ExportTemplateManager::_update_template_list() {
|
||||||
|
|
||||||
void ExportTemplateManager::_download_template(const String &p_version) {
|
void ExportTemplateManager::_download_template(const String &p_version) {
|
||||||
|
|
||||||
print_line("download " + p_version);
|
|
||||||
while (template_list->get_child_count()) {
|
while (template_list->get_child_count()) {
|
||||||
memdelete(template_list->get_child(0));
|
memdelete(template_list->get_child(0));
|
||||||
}
|
}
|
||||||
|
@ -350,7 +349,6 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
|
||||||
bool mirrors_found = false;
|
bool mirrors_found = false;
|
||||||
|
|
||||||
Dictionary d = r;
|
Dictionary d = r;
|
||||||
print_line(r);
|
|
||||||
if (d.has("mirrors")) {
|
if (d.has("mirrors")) {
|
||||||
Array mirrors = d["mirrors"];
|
Array mirrors = d["mirrors"];
|
||||||
for (int i = 0; i < mirrors.size(); i++) {
|
for (int i = 0; i < mirrors.size(); i++) {
|
||||||
|
@ -496,7 +494,6 @@ void ExportTemplateManager::_notification(int p_what) {
|
||||||
|
|
||||||
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
|
||||||
if (!is_visible_in_tree()) {
|
if (!is_visible_in_tree()) {
|
||||||
print_line("closed");
|
|
||||||
download_templates->cancel_request();
|
download_templates->cancel_request();
|
||||||
set_process(false);
|
set_process(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,9 @@ void ProjectExportDialog::popup_export() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_update_presets();
|
_update_presets();
|
||||||
|
if (presets->get_current() >= 0) {
|
||||||
|
_edit_preset(presets->get_current()); // triggers rescan for templates if newly installed
|
||||||
|
}
|
||||||
|
|
||||||
// Restore valid window bounds or pop up at default size.
|
// Restore valid window bounds or pop up at default size.
|
||||||
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) {
|
if (EditorSettings::get_singleton()->has_setting("interface/dialogs/export_bounds")) {
|
||||||
|
@ -141,7 +144,6 @@ void ProjectExportDialog::_update_presets() {
|
||||||
|
|
||||||
if (current_idx != -1) {
|
if (current_idx != -1) {
|
||||||
presets->select(current_idx);
|
presets->select(current_idx);
|
||||||
//_edit_preset(current_idx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updating = false;
|
updating = false;
|
||||||
|
@ -154,6 +156,7 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
||||||
name->set_editable(false);
|
name->set_editable(false);
|
||||||
runnable->set_disabled(true);
|
runnable->set_disabled(true);
|
||||||
parameters->edit(NULL);
|
parameters->edit(NULL);
|
||||||
|
presets->unselect_all();
|
||||||
delete_preset->set_disabled(true);
|
delete_preset->set_disabled(true);
|
||||||
sections->hide();
|
sections->hide();
|
||||||
patches->clear();
|
patches->clear();
|
||||||
|
@ -425,11 +428,9 @@ void ProjectExportDialog::_delete_preset() {
|
||||||
void ProjectExportDialog::_delete_preset_confirm() {
|
void ProjectExportDialog::_delete_preset_confirm() {
|
||||||
|
|
||||||
int idx = presets->get_current();
|
int idx = presets->get_current();
|
||||||
parameters->edit(NULL); //to avoid crash
|
|
||||||
_edit_preset(-1);
|
_edit_preset(-1);
|
||||||
EditorExport::get_singleton()->remove_export_preset(idx);
|
EditorExport::get_singleton()->remove_export_preset(idx);
|
||||||
_update_presets();
|
_update_presets();
|
||||||
_edit_preset(presets->get_current());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||||
|
|
|
@ -268,7 +268,7 @@ void ItemList::unselect_all() {
|
||||||
|
|
||||||
items[i].selected = false;
|
items[i].selected = false;
|
||||||
}
|
}
|
||||||
|
current = -1;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue