Ported test_skirt_brim from upstream Slic3r, thanks @lordofhyphens

This commit is contained in:
bubnikv 2019-10-15 16:31:20 +02:00
parent c99e7cb0df
commit 1964ac2e89
8 changed files with 308 additions and 32 deletions
src/libslic3r

View file

@ -29,7 +29,7 @@ PrintConfigDef::PrintConfigDef()
this->init_common_params();
assign_printer_technology_to_unknown(this->options, ptAny);
this->init_fff_params();
this->init_extruder_retract_keys();
this->init_extruder_option_keys();
assign_printer_technology_to_unknown(this->options, ptFFF);
this->init_sla_params();
assign_printer_technology_to_unknown(this->options, ptSLA);
@ -2270,8 +2270,17 @@ void PrintConfigDef::init_fff_params()
}
}
void PrintConfigDef::init_extruder_retract_keys()
void PrintConfigDef::init_extruder_option_keys()
{
// ConfigOptionFloats, ConfigOptionPercents, ConfigOptionBools, ConfigOptionStrings
m_extruder_option_keys = {
"nozzle_diameter", "min_layer_height", "max_layer_height", "extruder_offset",
"retract_length", "retract_lift", "retract_lift_above", "retract_lift_below", "retract_speed", "deretract_speed",
"retract_before_wipe", "retract_restart_extra", "retract_before_travel", "wipe",
"retract_layer_change", "retract_length_toolchange", "retract_restart_extra_toolchange", "extruder_colour",
"default_filament_profile"
};
m_extruder_retract_keys = {
"deretract_speed",
"retract_before_travel",
@ -2938,6 +2947,20 @@ void DynamicPrintConfig::normalize()
}
}
void DynamicPrintConfig::set_num_extruders(unsigned int num_extruders)
{
const auto &defaults = FullPrintConfig::defaults();
for (const std::string &key : print_config_def.extruder_option_keys()) {
if (key == "default_filament_profile")
continue;
auto *opt = this->option(key, false);
assert(opt != nullptr);
assert(opt->is_vector());
if (opt != nullptr && opt->is_vector())
static_cast<ConfigOptionVectorBase*>(opt)->resize(num_extruders, defaults.option(key));
}
}
std::string DynamicPrintConfig::validate()
{
// Full print config is initialized from the defaults.