Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbubnikv <bubnikv@gmail.com>2019-05-15 18:15:52 +0300
committerbubnikv <bubnikv@gmail.com>2019-05-15 18:15:52 +0300
commit79fe6b9db3d0d93f51685a82c0e14d52b32d8899 (patch)
tree65f4ee5587a5b8bd801bacb509409130918061cd /src/slic3r/GUI/PresetBundle.cpp
parentf029ed8fe19413fb241c11cdde8ed09bea0eaca5 (diff)
Fix of switching the default print / filament / sla print / sla material
profiles after switching the technology from FFF to SLA and vice versa. The solution is to keep the print / filament / sla print / sla material settings undefined until the particular technology is activated for the first time. Then the settings name persists indefinitely even if all the printes for that particular printer technology are deleted.
Diffstat (limited to 'src/slic3r/GUI/PresetBundle.cpp')
-rw-r--r--src/slic3r/GUI/PresetBundle.cpp57
1 files changed, 23 insertions, 34 deletions
diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp
index 16744aaa9..e92311cfe 100644
--- a/src/slic3r/GUI/PresetBundle.cpp
+++ b/src/slic3r/GUI/PresetBundle.cpp
@@ -344,40 +344,29 @@ void PresetBundle::load_selections(const AppConfig &config, const std::string &p
const Preset *initial_printer = printers.find_preset(initial_printer_profile_name);
const Preset *preferred_printer = printers.find_by_model_id(preferred_model_id);
-
- if (preferred_printer != nullptr && (initial_printer == nullptr || !initial_printer->is_visible)) {
- printers.select_preset_by_name(preferred_printer->name, true);
- } else {
- printers.select_preset_by_name(initial_printer_profile_name, true);
- }
-
- PrinterTechnology printer_technology = printers.get_selected_preset().printer_technology();
- if (printer_technology == ptFFF) {
- prints.select_preset_by_name_strict(initial_print_profile_name);
- filaments.select_preset_by_name_strict(initial_filament_profile_name);
- sla_prints.select_preset_by_name(initial_sla_material_profile_name, true);
- sla_materials.select_preset_by_name(initial_sla_material_profile_name, true);
- } else {
- prints.select_preset_by_name(initial_print_profile_name, true);
- filaments.select_preset_by_name(initial_filament_profile_name, true);
- sla_prints.select_preset_by_name_strict(initial_sla_material_profile_name);
- sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
- }
-
- if (printers.get_selected_preset().printer_technology() == ptFFF) {
- // Load the names of the other filament profiles selected for a multi-material printer.
- auto *nozzle_diameter = dynamic_cast<const ConfigOptionFloats*>(printers.get_selected_preset().config.option("nozzle_diameter"));
- size_t num_extruders = nozzle_diameter->values.size();
- this->filament_presets = { initial_filament_profile_name };
- for (unsigned int i = 1; i < (unsigned int)num_extruders; ++i) {
- char name[64];
- sprintf(name, "filament_%d", i);
- if (!config.has("presets", name))
- break;
- this->filament_presets.emplace_back(remove_ini_suffix(config.get("presets", name)));
- }
- // Do not define the missing filaments, so that the update_compatible() will use the preferred filaments.
- this->filament_presets.resize(num_extruders, "");
+ printers.select_preset_by_name(
+ (preferred_printer != nullptr && (initial_printer == nullptr || !initial_printer->is_visible)) ?
+ preferred_printer->name :
+ initial_printer_profile_name,
+ true);
+
+ // Selects the profile, leaves it to -1 if the initial profile name is empty or if it was not found.
+ prints.select_preset_by_name_strict(initial_print_profile_name);
+ filaments.select_preset_by_name_strict(initial_filament_profile_name);
+ sla_prints.select_preset_by_name_strict(initial_sla_print_profile_name);
+ sla_materials.select_preset_by_name_strict(initial_sla_material_profile_name);
+
+ // Load the names of the other filament profiles selected for a multi-material printer.
+ // Load it even if the current printer technology is SLA.
+ // The possibly excessive filament names will be later removed with this->update_multi_material_filament_presets()
+ // once the FFF technology gets selected.
+ this->filament_presets = { filaments.get_selected_preset_name() };
+ for (unsigned int i = 1; i < 1000; ++ i) {
+ char name[64];
+ sprintf(name, "filament_%d", i);
+ if (! config.has("presets", name))
+ break;
+ this->filament_presets.emplace_back(remove_ini_suffix(config.get("presets", name)));
}
// Update visibility of presets based on their compatibility with the active printer.