From f2e2c9aa71208273427eb124281771fe7e00c6d1 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 26 Nov 2018 21:16:37 +0100 Subject: [PATCH] Ported PrintObject::make_perimeters() to C++ --- lib/Slic3r/Print/Object.pm | 18 ------------------ xs/src/libslic3r/Print.hpp | 1 - xs/src/libslic3r/PrintObject.cpp | 21 ++++++++++----------- xs/xsp/Print.xsp | 2 +- 4 files changed, 11 insertions(+), 31 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 4e8aff5a7..5a450a9ea 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -34,24 +34,6 @@ sub support_layers { return [ map $self->get_support_layer($_), 0..($self->support_layer_count - 1) ]; } -sub make_perimeters { - my ($self) = @_; - - return if $self->step_done(STEP_PERIMETERS); - - # Temporary workaround for detect_surfaces_type() not being idempotent (see #3764). - # We can remove this when idempotence is restored. This make_perimeters() method - # will just call merge_slices() to undo the typed slices and invalidate posDetectSurfaces. - if ($self->typed_slices) { - $self->invalidate_step(STEP_SLICE); - } - - # prerequisites - $self->slice; - - $self->_make_perimeters; -} - # This will assign a type (top/bottom/internal) to $layerm->slices # and transform $layerm->fill_surfaces from expolygon # to typed top/bottom/internal surfaces; diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index e3420a5a9..250ed6e96 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -164,7 +164,6 @@ class PrintObject void _slice(); std::vector _slice_region(size_t region_id, std::vector z, bool modifier); - void _make_perimeters(); void _infill(); /// Initialize and generate support material. diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index 643b8a839..35279aac4 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -946,16 +946,6 @@ PrintObject::_slice_region(size_t region_id, std::vector z, bool modifier return layers; } -void -PrintObject::make_perimeters() -{ - if (this->state.is_done(posPerimeters)) return; - if (this->typed_slices) - this->state.invalidate(posSlice); - this->slice(); // take care of prereqs - this->_make_perimeters(); -} - /* 1) Decides Z positions of the layers, 2) Initializes layers and their regions @@ -1059,11 +1049,20 @@ PrintObject::slice() } void -PrintObject::_make_perimeters() +PrintObject::make_perimeters() { if (this->state.is_done(posPerimeters)) return; this->state.set_started(posPerimeters); + // Temporary workaround for detect_surfaces_type() not being idempotent (see #3764). + // We can remove this when idempotence is restored. This make_perimeters() method + // will just call merge_slices() to undo the typed slices and invalidate posDetectSurfaces. + if (this->typed_slices) + this->state.invalidate(posSlice); + + // prerequisites + this->slice(); + // merge slices if they were split into types // This is not currently taking place because since merge_slices + detect_surfaces_type // are not truly idempotent we are invalidating posSlice here (see the Perl part of diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index 1d6f0eba6..e5cceda9b 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -153,7 +153,7 @@ _constant() } RETVAL = (SV*)newRV_noinc((SV*)layers_av); %}; - void _make_perimeters(); + void make_perimeters(); void _infill(); void _simplify_slices(double distance);