From aac9c2481cae204d910e7efbe52a8f8b8035f11b Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Mon, 26 Nov 2018 21:24:33 +0100 Subject: [PATCH] Ported PrintObject::infill() to C++ --- lib/Slic3r/Print/Object.pm | 9 --------- src/test/libslic3r/test_support_material.cpp | 2 +- xs/src/libslic3r/PrintObject.cpp | 18 +++++++----------- xs/xsp/Print.xsp | 2 +- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 26317621c..2a50dcc46 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -75,15 +75,6 @@ sub prepare_infill { $self->set_step_done(STEP_PREPARE_INFILL); } -sub infill { - my ($self) = @_; - - # prerequisites - $self->prepare_infill; - - $self->_infill; -} - sub generate_support_material { my $self = shift; diff --git a/src/test/libslic3r/test_support_material.cpp b/src/test/libslic3r/test_support_material.cpp index 5e9d6c932..fa82323d5 100644 --- a/src/test/libslic3r/test_support_material.cpp +++ b/src/test/libslic3r/test_support_material.cpp @@ -282,7 +282,7 @@ bool test_6_checks(Print &print) // Pre-Processing. PrintObject *print_object = print.objects.front(); - print_object->_infill(); + print_object->infill(); SupportMaterial *support_material = print.objects.front()->_support_material(); support_material->generate(print_object); // TODO but not needed in test 6 (make brims and make skirts). diff --git a/xs/src/libslic3r/PrintObject.cpp b/xs/src/libslic3r/PrintObject.cpp index ccbc7a00a..c55f7ecf9 100644 --- a/xs/src/libslic3r/PrintObject.cpp +++ b/xs/src/libslic3r/PrintObject.cpp @@ -1054,6 +1054,9 @@ PrintObject::slice() void PrintObject::make_perimeters() { + // prerequisites + this->slice(); + if (this->state.is_done(posPerimeters)) return; this->state.set_started(posPerimeters); @@ -1063,9 +1066,6 @@ PrintObject::make_perimeters() 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 @@ -1185,8 +1185,11 @@ PrintObject::make_perimeters() } void -PrintObject::_infill() +PrintObject::infill() { + // prerequisites + this->prepare_infill(); + if (this->state.is_done(posInfill)) return; this->state.set_started(posInfill); @@ -1383,13 +1386,6 @@ PrintObject::combine_infill() } } -void -PrintObject::infill() -{ - this->prepare_infill(); - this->_infill(); -} - SupportMaterial * PrintObject::_support_material() { diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp index 89d84df05..3cab015e0 100644 --- a/xs/xsp/Print.xsp +++ b/xs/xsp/Print.xsp @@ -154,7 +154,7 @@ _constant() RETVAL = (SV*)newRV_noinc((SV*)layers_av); %}; void make_perimeters(); - void _infill(); + void infill(); void _simplify_slices(double distance); int ptr()