diff --git a/resources/profiles/PrusaResearch.ini b/resources/profiles/PrusaResearch.ini index ba8e55ad4..a28405921 100644 --- a/resources/profiles/PrusaResearch.ini +++ b/resources/profiles/PrusaResearch.ini @@ -1030,3 +1030,8 @@ max_print_height = 210 start_gcode = M115 U3.1.1-RC5 ; tell printer latest fw version\nM201 X1000 Y1000 Z200 E5000 ; sets maximum accelerations, mm/sec^2\nM203 X200 Y200 Z12 E120 ; sets maximum feedrates, mm/sec\nM204 S1250 T1250 ; sets acceleration (S) and retract acceleration (T)\nM205 X10 Y10 Z0.4 E2.5 ; sets the jerk limits, mm/sec\nM205 S0 T0 ; sets the minimum extruding and travel feed rate, mm/sec\nM83 ; extruder relative mode\nM104 S[first_layer_temperature] ; set extruder temp\nM140 S[first_layer_bed_temperature] ; set bed temp\nM190 S[first_layer_bed_temperature] ; wait for bed temp\nM109 S[first_layer_temperature] ; wait for extruder temp\nG28 W ; home all without mesh bed level\nG80 ; mesh bed leveling\nG1 Y-3.0 F1000.0 ; go outside print area\nG92 E0.0\nG1 X60.0 E9.0 F1000.0 ; intro line\nG1 X100.0 E12.5 F1000.0 ; intro line\nG92 E0.0\nM221 S{if layer_height==0.05}100{else}95{endif} printer_model = MK3 default_print_profile = 0.15mm OPTIMAL 0.6 nozzle MK3 + +# The obsolete presets will be removed when upgrading from the legacy configuration structure (up to Slic3r 1.39.2) to 1.40.0 and newer. +[obsolete_presets] +print="0.05mm DETAIL 0.25 nozzle";"0.05mm DETAIL MK3";"0.05mm DETAIL";"0.20mm NORMAL MK3";"0.35mm FAST MK3" +filament="ColorFabb Brass Bronze 1.75mm";"ColorFabb HT 1.75mm";"ColorFabb nGen 1.75mm";"ColorFabb Woodfil 1.75mm";"ColorFabb XT 1.75mm";"ColorFabb XT-CF20 1.75mm";"E3D PC-ABS 1.75mm";"Fillamentum ABS 1.75mm";"Fillamentum ASA 1.75mm";"Generic ABS 1.75mm";"Generic PET 1.75mm";"Generic PLA 1.75mm";"Prusa ABS 1.75mm";"Prusa HIPS 1.75mm";"Prusa PET 1.75mm";"Prusa PLA 1.75mm";"Taulman Bridge 1.75mm";"Taulman T-Glase 1.75mm" diff --git a/xs/src/slic3r/GUI/PresetBundle.cpp b/xs/src/slic3r/GUI/PresetBundle.cpp index 84fa3a92f..ef48eb6d4 100644 --- a/xs/src/slic3r/GUI/PresetBundle.cpp +++ b/xs/src/slic3r/GUI/PresetBundle.cpp @@ -104,6 +104,9 @@ void PresetBundle::reset(bool delete_files) this->printers .reset(delete_files); this->filament_presets.clear(); this->filament_presets.emplace_back(this->filaments.get_selected_preset().name); + this->obsolete_presets.prints.clear(); + this->obsolete_presets.filaments.clear(); + this->obsolete_presets.printers.clear(); } void PresetBundle::setup_directories() @@ -224,7 +227,10 @@ std::vector PresetBundle::merge_presets(PresetBundle &&other) std::vector duplicate_prints = this->prints .merge_presets(std::move(other.prints), this->vendors); std::vector duplicate_filaments = this->filaments.merge_presets(std::move(other.filaments), this->vendors); std::vector duplicate_printers = this->printers .merge_presets(std::move(other.printers), this->vendors); - append(duplicate_prints, std::move(duplicate_filaments)); + append(this->obsolete_presets.prints, std::move(other.obsolete_presets.prints)); + append(this->obsolete_presets.filaments, std::move(other.obsolete_presets.filaments)); + append(this->obsolete_presets.printers, std::move(other.obsolete_presets.printers)); + append(duplicate_prints, std::move(duplicate_filaments)); append(duplicate_prints, std::move(duplicate_printers)); return duplicate_prints; } @@ -365,6 +371,7 @@ DynamicPrintConfig PresetBundle::full_config() const } else { // Retrieve filament presets and build a single config object for them. // First collect the filament configurations based on the user selection of this->filament_presets. + // Here this->filaments.find_preset() and this->filaments.first_visible() return the edited copy of the preset if active. std::vector filament_configs; for (const std::string &filament_preset_name : this->filament_presets) filament_configs.emplace_back(&this->filaments.find_preset(filament_preset_name, true)->config); @@ -760,6 +767,7 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla flatten_configbundle_hierarchy(tree); // 2) Parse the property_tree, extract the active preset names and the profiles, save them into local config files. + // Parse the obsolete preset names, to be deleted when upgrading from the old configuration structure. std::vector loaded_prints; std::vector loaded_filaments; std::vector loaded_printers; @@ -799,6 +807,20 @@ size_t PresetBundle::load_configbundle(const std::string &path, unsigned int fla active_printer = kvp.second.data(); } } + } else if (section.first == "obsolete_presets") { + // Parse the names of obsolete presets. These presets will be deleted from user's + // profile directory on installation of this vendor preset. + for (auto &kvp : section.second) { + std::vector *dst = nullptr; + if (kvp.first == "print") + dst = &this->obsolete_presets.prints; + else if (kvp.first == "filament") + dst = &this->obsolete_presets.filaments; + else if (kvp.first == "printer") + dst = &this->obsolete_presets.printers; + if (dst) + unescape_strings_cstyle(kvp.second.data(), *dst); + } } else if (section.first == "settings") { // Load the settings. for (auto &kvp : section.second) { diff --git a/xs/src/slic3r/GUI/PresetBundle.hpp b/xs/src/slic3r/GUI/PresetBundle.hpp index 9f2afbead..a5c5682f9 100644 --- a/xs/src/slic3r/GUI/PresetBundle.hpp +++ b/xs/src/slic3r/GUI/PresetBundle.hpp @@ -54,6 +54,13 @@ public: // and the system profiles will point to the VendorProfile instances owned by PresetBundle::vendors. std::set vendors; + struct ObsoletePresets { + std::vector prints; + std::vector filaments; + std::vector printers; + }; + ObsoletePresets obsolete_presets; + bool has_defauls_only() const { return prints.size() <= 1 && filaments.size() <= 1 && printers.size() <= 1; }