Fixed conversion of installed presets from PrusaSlicer 2.1.1 to 2.2.0

This commit is contained in:
bubnikv 2020-03-14 20:18:31 +01:00
parent a3ded8fa95
commit 7f3ac39757
3 changed files with 33 additions and 20 deletions

View file

@ -289,17 +289,7 @@ std::string PresetBundle::load_system_presets()
this->reset(false);
}
this->prints .update_map_system_profile_renamed();
this->sla_prints .update_map_system_profile_renamed();
this->filaments .update_map_system_profile_renamed();
this->sla_materials.update_map_system_profile_renamed();
this->printers .update_map_system_profile_renamed();
this->prints .update_map_alias_to_profile_name();
this->sla_prints .update_map_alias_to_profile_name();
this->filaments .update_map_alias_to_profile_name();
this->sla_materials.update_map_alias_to_profile_name();
this->update_system_maps();
return errors_cummulative;
}
@ -324,6 +314,20 @@ std::vector<std::string> PresetBundle::merge_presets(PresetBundle &&other)
return duplicate_prints;
}
void PresetBundle::update_system_maps()
{
this->prints .update_map_system_profile_renamed();
this->sla_prints .update_map_system_profile_renamed();
this->filaments .update_map_system_profile_renamed();
this->sla_materials.update_map_system_profile_renamed();
this->printers .update_map_system_profile_renamed();
this->prints .update_map_alias_to_profile_name();
this->sla_prints .update_map_alias_to_profile_name();
this->filaments .update_map_alias_to_profile_name();
this->sla_materials.update_map_alias_to_profile_name();
}
static inline std::string remove_ini_suffix(const std::string &name)
{
std::string out = name;
@ -337,9 +341,9 @@ static inline std::string remove_ini_suffix(const std::string &name)
// If the "vendor" section is missing, enable all models and variants of the particular vendor.
void PresetBundle::load_installed_printers(const AppConfig &config)
{
for (auto &preset : printers) {
this->update_system_maps();
for (auto &preset : printers)
preset.set_visible_from_appconfig(config);
}
}
const std::string& PresetBundle::get_preset_name_by_alias( const Preset::Type& preset_type, const std::string& alias) const
@ -367,7 +371,7 @@ void PresetBundle::load_installed_filaments(AppConfig &config)
if (printer.is_visible && printer.printer_technology() == ptFFF) {
const PresetWithVendorProfile printer_with_vendor_profile = printers.get_preset_with_vendor_profile(printer);
for (const Preset &filament : filaments)
if (is_compatible_with_printer(filaments.get_preset_with_vendor_profile(filament), printer_with_vendor_profile))
if (filament.is_system && is_compatible_with_printer(filaments.get_preset_with_vendor_profile(filament), printer_with_vendor_profile))
compatible_filaments.insert(&filament);
}
// and mark these filaments as installed, therefore this code will not be executed at the next start of the application.
@ -390,7 +394,7 @@ void PresetBundle::load_installed_sla_materials(AppConfig &config)
if (printer.is_visible && printer.printer_technology() == ptSLA) {
const PresetWithVendorProfile printer_with_vendor_profile = printers.get_preset_with_vendor_profile(printer);
for (const Preset &material : sla_materials)
if (is_compatible_with_printer(sla_materials.get_preset_with_vendor_profile(material), printer_with_vendor_profile))
if (material.is_system && is_compatible_with_printer(sla_materials.get_preset_with_vendor_profile(material), printer_with_vendor_profile))
comp_sla_materials.insert(&material);
}
// and mark these SLA materials as installed, therefore this code will not be executed at the next start of the application.