Adds (AMS) filament sync options: Only sync color / sync all (#12169)

This PR adds a new filament sync mode setting for device-based filament synchronization.
Users can now choose between syncing both filament preset + color (current behavior) or syncing color only, so calibrated local filament profiles are preserved while still updating slot colors from the printer.
It also includes small UI improvements for the new preference entry and sync status messaging.

<img width="665" height="671" alt="image" src="https://github.com/user-attachments/assets/23980846-0113-48ab-84aa-adf5cdab8ab6" />
This commit is contained in:
Argo
2026-02-10 02:12:30 +01:00
committed by GitHub
parent cae1567726
commit ffc8a3e307
6 changed files with 106 additions and 16 deletions

View File

@@ -3464,8 +3464,9 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
}
MergeFilamentInfo merge_info;
std::vector<std::pair<DynamicPrintConfig *,std::string>> unknowns;
auto enable_append = wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams");
auto n = wxGetApp().preset_bundle->sync_ams_list(unknowns, !sync_result.direct_sync, sync_result.sync_maps, enable_append, merge_info);
auto enable_append = wxGetApp().app_config->get_bool("enable_append_color_by_sync_ams");
auto sync_color_only = wxGetApp().app_config->get("sync_ams_filament_mode") == "1";
auto n = wxGetApp().preset_bundle->sync_ams_list(unknowns, !sync_result.direct_sync, sync_result.sync_maps, enable_append, merge_info, sync_color_only);
wxString detail;
for (auto & uk : unknowns) {
auto tray_name = uk.first->opt_string("tray_name", 0u);
@@ -3497,9 +3498,11 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
_L("Sync filaments with AMS"), wxOK);
dlg.ShowModal();
}
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "on_filament_count_change";
wxGetApp().plater()->on_filament_count_change(n);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "finish on_filament_count_change";
if (!sync_color_only) {
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "on_filament_count_change";
wxGetApp().plater()->on_filament_count_change(n);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "finish on_filament_count_change";
}
for (auto& c : p->combos_filament)
c->update();
// Expand filament list
@@ -3523,14 +3526,23 @@ void Sidebar::sync_ams_list(bool is_from_big_sync_btn)
}
Layout();
// Perform preset selection and list update first — these may rebuild combo widgets,
// which clears any badge state. Badges must be set AFTER these calls to persist.
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
update_dynamic_filament_list();
// For full sync, preset selection/list update may rebuild combo widgets.
// For color-only, keep current presets untouched and refresh colors only.
if (!sync_color_only) {
wxGetApp().get_tab(Preset::TYPE_FILAMENT)->select_preset(wxGetApp().preset_bundle->filament_presets[0]);
wxGetApp().preset_bundle->export_selections(*wxGetApp().app_config);
update_dynamic_filament_list();
} else {
wxGetApp().plater()->update_filament_colors_in_full_config();
for (auto &c : p->combos_filament)
c->update();
obj_list()->update_filament_colors();
update_dynamic_filament_list();
}
auto badge_combox_filament = [](PlaterPresetComboBox *c) {
auto tip = _L("Filament type and color information have been synchronized, but slot information is not included.");
auto badge_combox_filament = [sync_color_only](PlaterPresetComboBox *c) {
auto tip = sync_color_only ? _L("Only filament color information has been synchronized from printer.") :
_L("Filament type and color information have been synchronized, but slot information is not included.");
c->SetToolTip(tip);
c->ShowBadge(true);
};