From bf981ae049e136e76c021123d858386b405d3dd2 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 20 Jul 2021 10:18:59 +0200 Subject: [PATCH] Temporary workaround for compatibility with older Slicer: To the "physical_printer" added "preset_name" option as a duplicate of the "preset_names" but like one string. Note: It will works just for printer preset names without ";" (see #5503) --- src/libslic3r/Preset.cpp | 10 ++++++++++ src/libslic3r/PrintConfig.cpp | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 97457d63b..c9fef0a40 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -1418,6 +1418,7 @@ const std::vector& PhysicalPrinter::printer_options() static std::vector s_opts; if (s_opts.empty()) { s_opts = { + "preset_name", // temporary option to compatibility with older Slicer "preset_names", "printer_technology", "host_type", @@ -1481,6 +1482,15 @@ void PhysicalPrinter::update_preset_names_in_config() values.clear(); for (auto preset : preset_names) values.push_back(preset); + + // temporary workaround for compatibility with older Slicer + { + std::string name; + for (auto el : preset_names) + name += el + ";"; + name.pop_back(); + config.set_key_value("preset_name", new ConfigOptionString(name)); + } } } diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 3c554012d..3c5ff3859 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -317,6 +317,12 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionStrings()); + // temporary workaround for compatibility with older Slicer + { + def = this->add("preset_name", coString); + def->set_default_value(new ConfigOptionString()); + } + def = this->add("printhost_authorization_type", coEnum); def->label = L("Authorization Type"); // def->tooltip = L("");