mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
Merge branch 'main' into feature/orca_network_refactor
This commit is contained in:
@@ -2115,6 +2115,15 @@ void PresetBundle::export_selections(AppConfig &config)
|
||||
auto printer_name = printers.get_selected_preset_name();
|
||||
config.set("presets", PRESET_PRINTER_NAME, printer_name);
|
||||
|
||||
// Don't persist settings for the built-in "Default Printer" placeholder —
|
||||
// it's only the initial state before a real printer is loaded/selected.
|
||||
// Also clean up any stale entry that other code paths (e.g. bed type change)
|
||||
// may have created for "Default Printer".
|
||||
if (printer_name == "Default Printer") {
|
||||
config.clear_printer_settings("Default Printer");
|
||||
return;
|
||||
}
|
||||
|
||||
config.clear_printer_settings(printer_name);
|
||||
config.set_printer_setting(printer_name, PRESET_PRINTER_NAME, printer_name);
|
||||
config.set_printer_setting(printer_name, PRESET_PRINT_NAME, prints.get_selected_preset_name());
|
||||
|
||||
@@ -147,7 +147,7 @@ void uiAmsPercentHumidityDryPopup::UpdateContents()
|
||||
// table grid
|
||||
const wxString& humidity_str = wxString::Format("%d%%", m_humidity_percent);
|
||||
m_humidity_label->SetLabel(humidity_str);
|
||||
const wxString& temp_str = wxString::Format(u8"%d\u2103" /* °C */, (int)std::round(m_current_temperature));
|
||||
const wxString& temp_str = wxString::Format(wxString::FromUTF8(u8"%d\u2103" /* °C */), (int)std::round(m_current_temperature));
|
||||
m_temperature_label->SetLabel(temp_str);
|
||||
|
||||
if (m_left_dry_time > 0)
|
||||
|
||||
@@ -838,14 +838,67 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
||||
// Not switch filament
|
||||
//get_first_added_material_preset(AppConfig::SECTION_FILAMENTS, first_added_filament);
|
||||
|
||||
// For each @System filament, check if a vendor-specific override exists
|
||||
// in the loaded profiles. If so, replace the @System variant with the
|
||||
// override (e.g. replace "Generic ABS @System" with BBL "Generic ABS").
|
||||
// When printers from the default bundle are also selected, keep @System
|
||||
// too since those printers need it.
|
||||
static const std::string system_suffix = " @System";
|
||||
auto it_default = enabled_vendors.find(PresetBundle::ORCA_DEFAULT_BUNDLE);
|
||||
bool has_default_bundle_printer = it_default != enabled_vendors.end() && !it_default->second.empty();
|
||||
bool has_filament_profiles = m_ProfileJson.contains("filament");
|
||||
|
||||
// Check if any non-default vendor has selected printers
|
||||
bool has_vendor_printer = false;
|
||||
for (const auto& [vendor, models] : enabled_vendors) {
|
||||
if (vendor != PresetBundle::ORCA_DEFAULT_BUNDLE && !models.empty()) {
|
||||
has_vendor_printer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> supplemented_filaments;
|
||||
for (const auto& [name, value] : enabled_filaments) {
|
||||
if (name.size() > system_suffix.size() &&
|
||||
name.compare(name.size() - system_suffix.size(), system_suffix.size(), system_suffix) == 0) {
|
||||
std::string short_name = name.substr(0, name.size() - system_suffix.size());
|
||||
if (has_vendor_printer && has_filament_profiles && m_ProfileJson["filament"].contains(short_name)) {
|
||||
supplemented_filaments[short_name] = value;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Replacing @System filament: '" << name << "' -> '" << short_name << "'";
|
||||
if (has_default_bundle_printer) {
|
||||
supplemented_filaments[name] = value;
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " Also keeping '" << name << "' for default bundle printers";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
supplemented_filaments[name] = value;
|
||||
}
|
||||
|
||||
//update the app_config
|
||||
app_config->set_section(AppConfig::SECTION_FILAMENTS, enabled_filaments);
|
||||
app_config->set_section(AppConfig::SECTION_FILAMENTS, supplemented_filaments);
|
||||
app_config->set_vendors(m_appconfig_new);
|
||||
|
||||
if (check_unsaved_preset_changes)
|
||||
preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::Enable,
|
||||
{preferred_model, preferred_variant, first_added_filament, std::string()});
|
||||
|
||||
// If the active filament is not in the wizard-selected filaments, switch to the first
|
||||
// compatible wizard-selected filament. This handles the first-run case where load_presets
|
||||
// falls back to "Generic PLA" even though the user selected a different filament.
|
||||
bool active_filament_selected = supplemented_filaments.empty()
|
||||
|| supplemented_filaments.count(preset_bundle->filament_presets.front()) > 0;
|
||||
if (!active_filament_selected) {
|
||||
for (const auto& [filament_name, _] : supplemented_filaments) {
|
||||
const Preset* preset = preset_bundle->filaments.find_preset(filament_name);
|
||||
if (preset && preset->is_visible && preset->is_compatible) {
|
||||
preset_bundle->filaments.select_preset_by_name(filament_name, true);
|
||||
preset_bundle->filament_presets.front() = preset_bundle->filaments.get_selected_preset_name();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the selections from the compatibilty.
|
||||
preset_bundle->export_selections(*app_config);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user