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:
authorsupermerill <merill@free.fr>2021-11-16 22:16:16 +0300
committersupermerill <merill@free.fr>2021-11-16 18:33:18 +0300
commitc680aff561646df54c961f2f017f4a79148544cd (patch)
tree8da914bcfc0b3ed7b03b6ef4b4af90c8fdf4d66a
parentf85b5992be0c011f72bfc6e6816739a7cc6645d1 (diff)
Print & printer custom variables are now scalar and not arrays.
-rw-r--r--src/libslic3r/PlaceholderParser.cpp38
-rw-r--r--src/libslic3r/Preset.cpp2
2 files changed, 29 insertions, 11 deletions
diff --git a/src/libslic3r/PlaceholderParser.cpp b/src/libslic3r/PlaceholderParser.cpp
index 660f45ee4..c077d6cd7 100644
--- a/src/libslic3r/PlaceholderParser.cpp
+++ b/src/libslic3r/PlaceholderParser.cpp
@@ -1496,6 +1496,9 @@ bool PlaceholderParser::evaluate_boolean_expression(const std::string &templ, co
void PlaceholderParser::append_custom_variables(std::map<std::string, std::vector<std::string>> name2var_array, int nb_extruders) {
+
+ bool is_array = nb_extruders > 0;
+ if (!is_array) nb_extruders = 1;
std::regex is_a_name("[a-zA-Z_]+");
for (const auto& entry : name2var_array) {
if (entry.first.empty())
@@ -1575,17 +1578,27 @@ void PlaceholderParser::append_custom_variables(std::map<std::string, std::vecto
log << "Parsing NUM custom variable '" << entry.first << "' : ";
for (auto s : double_values) log << ", " << s;
BOOST_LOG_TRIVIAL(trace) << log.str();
- ConfigOptionFloats* conf = new ConfigOptionFloats(double_values);
- conf->set_is_extruder_size(true);
- this->set(entry.first, conf);
+ if (is_array) {
+ ConfigOptionFloats* conf = new ConfigOptionFloats(double_values);
+ conf->set_is_extruder_size(true);
+ this->set(entry.first, conf);
+ } else {
+ ConfigOptionFloat* conf = new ConfigOptionFloat(double_values[0]);
+ this->set(entry.first, conf);
+ }
} else if (!is_not_bool) {
std::stringstream log;
log << "Parsing BOOL custom variable '" << entry.first << "' : ";
for (auto s : bool_values) log << ", " << s;
BOOST_LOG_TRIVIAL(trace) << log.str();
- ConfigOptionBools* conf = new ConfigOptionBools(bool_values);
- conf->set_is_extruder_size(true);
- this->set(entry.first, conf);
+ if (is_array) {
+ ConfigOptionBools* conf = new ConfigOptionBools(bool_values);
+ conf->set_is_extruder_size(true);
+ this->set(entry.first, conf);
+ } else {
+ ConfigOptionBool* conf = new ConfigOptionBool(bool_values[0]);
+ this->set(entry.first, conf);
+ }
} else {
for (std::string& s : string_values)
boost::replace_all(s, "\\n", "\n");
@@ -1593,9 +1606,14 @@ void PlaceholderParser::append_custom_variables(std::map<std::string, std::vecto
log << "Parsing STR custom variable '" << entry.first << "' : ";
for (auto s : string_values) log << ", " << s;
BOOST_LOG_TRIVIAL(trace) << log.str();
- ConfigOptionStrings* conf = new ConfigOptionStrings(string_values);
- conf->set_is_extruder_size(true);
- this->set(entry.first, conf);
+ if (is_array) {
+ ConfigOptionStrings* conf = new ConfigOptionStrings(string_values);
+ conf->set_is_extruder_size(true);
+ this->set(entry.first, conf);
+ } else {
+ ConfigOptionString* conf = new ConfigOptionString(string_values[0]);
+ this->set(entry.first, conf);
+ }
}
}
@@ -1623,7 +1641,7 @@ void PlaceholderParser::parse_custom_variables(const ConfigOptionString& custom_
}
}
- append_custom_variables(name2var_array, 1);
+ append_custom_variables(name2var_array, 0);
}
void PlaceholderParser::parse_custom_variables(const ConfigOptionStrings& filament_custom_variables)
diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp
index f79542964..caee17188 100644
--- a/src/libslic3r/Preset.cpp
+++ b/src/libslic3r/Preset.cpp
@@ -898,7 +898,7 @@ const std::vector<std::string>& Preset::sla_printer_options()
"min_initial_exposure_time", "max_initial_exposure_time",
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.
"print_host", "printhost_apikey", "printhost_cafile", "printhost_port",
- "printer_custom_variables",
+ "printer_notes",
"inherits",
"thumbnails",
"thumbnails_color",