diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index b5e8e42f7..32a6e62fc 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -29,6 +29,15 @@ sub regions { return [ map $self->get_region($_), 0..($self->region_count-1) ]; } +sub make_fill { + my ($self) = @_; + + foreach my $layerm (@{$self->regions}) { + $layerm->fills->clear; + $layerm->fills->append($_) for $self->object->fill_maker->make_fill($layerm); + } +} + package Slic3r::Layer::Support; our @ISA = qw(Slic3r::Layer); diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index cf458c1ec..e3022fef0 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -480,6 +480,7 @@ sub process_layer { # - for each extruder, we group extrusions by island # - for each island, we extrude perimeters first, unless user set the infill_first # option + # (Still, we have to keep track of regions because we need to apply their config) # group extrusions by extruder and then by island my %by_extruder = (); # extruder_id => [ { perimeters => \@perimeters, infill => \@infill } ] diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index aaa228845..240023834 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -515,26 +515,16 @@ sub infill { Slic3r::parallelize( threads => $self->print->config->threads, - items => sub { - my @items = (); # [layer_id, region_id] - for my $region_id (0 .. ($self->print->region_count-1)) { - push @items, map [$_, $region_id], 0..($self->layer_count - 1); - } - @items; - }, + items => sub { 0..$#{$self->layers} }, thread_cb => sub { my $q = shift; - while (defined (my $obj_layer = $q->dequeue)) { - my ($i, $region_id) = @$obj_layer; - my $layerm = $self->get_layer($i)->regions->[$region_id]; - $layerm->fills->clear; - $layerm->fills->append($_) for $self->fill_maker->make_fill($layerm); + while (defined (my $i = $q->dequeue)) { + $self->get_layer($i)->make_fill; } }, no_threads_cb => sub { - foreach my $layerm (map @{$_->regions}, @{$self->layers}) { - $layerm->fills->clear; - $layerm->fills->append($_) for $self->fill_maker->make_fill($layerm); + foreach my $layer (@{$self->layers}) { + $layer->make_fill; } }, );