From e0b0a2cdcfa87be770c64a66146cd6e5e01252c8 Mon Sep 17 00:00:00 2001 From: Vojtech Bubnik Date: Thu, 24 Sep 2020 20:32:52 +0200 Subject: [PATCH] Fix of previous commit. --- src/libslic3r/PrintObject.cpp | 10 ++++++---- xs/t/15_config.t | 6 +++--- xs/xsp/Config.xsp | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 7bf5734bb..6f26d8b9d 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -440,7 +440,7 @@ std::pair PrintObject::prepare using namespace FillAdaptive; auto [adaptive_line_spacing, support_line_spacing] = adaptive_fill_line_spacing(*this); - if (adaptive_line_spacing == 0. && support_line_spacing == 0. || this->layers().empty()) + if ((adaptive_line_spacing == 0. && support_line_spacing == 0.) || this->layers().empty()) return std::make_pair(OctreePtr(), OctreePtr()); indexed_triangle_set mesh = this->model_object()->raw_indexed_triangle_set(); @@ -1561,9 +1561,11 @@ static void apply_to_print_region_config(PrintRegionConfig &out, const DynamicPr std::string sextruder = "extruder"; auto *opt_extruder = in.opt(sextruder); if (opt_extruder) { - if (opt_extruder->value != 0) { - out.infill_extruder.value = opt_extruder->value; - out.perimeter_extruder.value = opt_extruder->value; + int extruder = opt_extruder->value; + if (extruder != 0) { + out.infill_extruder .value = extruder; + out.solid_infill_extruder.value = extruder; + out.perimeter_extruder .value = extruder; } } // 2) Copy the rest of the values. diff --git a/xs/t/15_config.t b/xs/t/15_config.t index 1f9fc939b..55b679101 100644 --- a/xs/t/15_config.t +++ b/xs/t/15_config.t @@ -219,7 +219,7 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintCo my $config = Slic3r::Config->new; $config->set('extruder', 2); $config->set('perimeter_extruder', 3); - $config->normalize; + $config->normalize_fdm; ok !$config->has('extruder'), 'extruder option is removed after normalize()'; is $config->get('infill_extruder'), 2, 'undefined extruder is populated with default extruder'; is $config->get('perimeter_extruder'), 3, 'defined extruder is not overwritten by default extruder'; @@ -228,7 +228,7 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintCo { my $config = Slic3r::Config->new; $config->set('infill_extruder', 2); - $config->normalize; + $config->normalize_fdm; is $config->get('solid_infill_extruder'), 2, 'undefined solid infill extruder is populated with infill extruder'; } @@ -236,7 +236,7 @@ foreach my $config (Slic3r::Config->new, Slic3r::Config::Static::new_FullPrintCo my $config = Slic3r::Config->new; $config->set('spiral_vase', 1); $config->set('retract_layer_change', [1,0]); - $config->normalize; + $config->normalize_fdm; is_deeply $config->get('retract_layer_change'), [0,0], 'retract_layer_change is disabled with spiral_vase'; } diff --git a/xs/xsp/Config.xsp b/xs/xsp/Config.xsp index 63dc5b312..b8f996797 100644 --- a/xs/xsp/Config.xsp +++ b/xs/xsp/Config.xsp @@ -48,7 +48,7 @@ %code{% THIS->apply(*other, true); %}; %name{get_keys} std::vector keys(); void erase(t_config_option_key opt_key); - void normalize(); + void normalize_fdm(); %name{setenv} void setenv_(); double min_object_distance() %code{% RETVAL = Slic3r::min_object_distance(*THIS); %}; static DynamicPrintConfig* load(char *path)