diff options
Diffstat (limited to 'src/libslic3r/Layer.cpp')
-rw-r--r-- | src/libslic3r/Layer.cpp | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/libslic3r/Layer.cpp b/src/libslic3r/Layer.cpp index 29b20d2e1..975274445 100644 --- a/src/libslic3r/Layer.cpp +++ b/src/libslic3r/Layer.cpp @@ -64,19 +64,30 @@ void Layer::make_slices() this->lslices.emplace_back(std::move(slices[i])); } -// Merge typed slices into untyped slices. This method is used to revert the effects of detect_surfaces_type() called for posPrepareInfill. -void Layer::merge_slices() +static inline bool layer_needs_raw_backup(const Layer *layer) { - if (m_regions.size() == 1 && (this->id() > 0 || this->object()->config().elefant_foot_compensation.value == 0)) { - // Optimization, also more robust. Don't merge classified pieces of layerm->slices, - // but use the non-split islands of a layer. For a single region print, these shall be equal. - // Don't use this optimization on 1st layer with Elephant foot compensation applied, as this->lslices are uncompensated, - // while regions are compensated. - m_regions.front()->slices.set(this->lslices, stInternal); + return ! (layer->regions().size() == 1 && (layer->id() > 0 || layer->object()->config().elefant_foot_compensation.value == 0)); +} + +void Layer::backup_untyped_slices() +{ + if (layer_needs_raw_backup(this)) { + for (LayerRegion *layerm : m_regions) + layerm->raw_slices = to_expolygons(layerm->slices.surfaces); } else { + assert(m_regions.size() == 1); + m_regions.front()->raw_slices.clear(); + } +} + +void Layer::restore_untyped_slices() +{ + if (layer_needs_raw_backup(this)) { for (LayerRegion *layerm : m_regions) - // without safety offset, artifacts are generated (upstream Slic3r GH #2494) - layerm->slices.set(union_ex(to_polygons(std::move(layerm->slices.surfaces)), true), stInternal); + layerm->slices.set(layerm->raw_slices, stInternal); + } else { + assert(m_regions.size() == 1); + m_regions.front()->slices.set(this->lslices, stInternal); } } |