Refactoring: new Layer::make_fill() method
This commit is contained in:
parent
9eabbded2b
commit
a32937cef2
@ -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);
|
||||
|
||||
|
@ -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 } ]
|
||||
|
@ -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;
|
||||
}
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user