Fixed crash on reslicing after infill invalidation.

The crash was introduced with sorting the extrusions into islands.
This commit is contained in:
Vojtech Bubnik 2022-11-28 10:07:22 +01:00
parent af6b022878
commit e6d10fc747
4 changed files with 14 additions and 4 deletions

View File

@ -408,12 +408,18 @@ static void insert_fills_into_islands(Layer &layer, uint32_t fill_region_id, uin
} }
} }
// friend to Layer void Layer::clear_fills()
void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator)
{ {
for (LayerRegion *layerm : m_regions) for (LayerRegion *layerm : m_regions)
layerm->m_fills.clear(); layerm->m_fills.clear();
for (LayerSlice &lslice : lslices_ex)
for (LayerIsland &island : lslice.islands)
island.fills.clear();
}
void Layer::make_fills(FillAdaptive::Octree* adaptive_fill_octree, FillAdaptive::Octree* support_fill_octree, FillLightning::Generator* lightning_generator)
{
this->clear_fills();
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING #ifdef SLIC3R_DEBUG_SLICE_PROCESSING
// this->export_region_fill_surfaces_to_svg_debug("10_fill-initial"); // this->export_region_fill_surfaces_to_svg_debug("10_fill-initial");

View File

@ -443,6 +443,7 @@ void Layer::make_perimeters()
layerm.m_fill_expolygons_composite_bboxes.clear(); layerm.m_fill_expolygons_composite_bboxes.clear();
}; };
// Remove layer islands, remove references to perimeters and fills from these layer islands to LayerRegion ExtrusionEntities.
for (LayerSlice &lslice : this->lslices_ex) for (LayerSlice &lslice : this->lslices_ex)
lslice.islands.clear(); lslice.islands.clear();

View File

@ -390,6 +390,8 @@ protected:
slice_z(slice_z), print_z(print_z), height(height), slice_z(slice_z), print_z(print_z), height(height),
m_id(id), m_object(object) {} m_id(id), m_object(object) {}
virtual ~Layer(); virtual ~Layer();
// Clear fill extrusions, remove them from layer islands.
void clear_fills();
private: private:
void sort_perimeters_into_islands( void sort_perimeters_into_islands(

View File

@ -131,6 +131,7 @@ void PrintObject::make_perimeters()
// Revert the typed slices into untyped slices. // Revert the typed slices into untyped slices.
if (m_typed_slices) { if (m_typed_slices) {
for (Layer *layer : m_layers) { for (Layer *layer : m_layers) {
layer->clear_fills();
layer->restore_untyped_slices(); layer->restore_untyped_slices();
m_print->throw_if_canceled(); m_print->throw_if_canceled();
} }