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) ];
|
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;
|
package Slic3r::Layer::Support;
|
||||||
our @ISA = qw(Slic3r::Layer);
|
our @ISA = qw(Slic3r::Layer);
|
||||||
|
|
||||||
|
@ -480,6 +480,7 @@ sub process_layer {
|
|||||||
# - for each extruder, we group extrusions by island
|
# - for each extruder, we group extrusions by island
|
||||||
# - for each island, we extrude perimeters first, unless user set the infill_first
|
# - for each island, we extrude perimeters first, unless user set the infill_first
|
||||||
# option
|
# option
|
||||||
|
# (Still, we have to keep track of regions because we need to apply their config)
|
||||||
|
|
||||||
# group extrusions by extruder and then by island
|
# group extrusions by extruder and then by island
|
||||||
my %by_extruder = (); # extruder_id => [ { perimeters => \@perimeters, infill => \@infill } ]
|
my %by_extruder = (); # extruder_id => [ { perimeters => \@perimeters, infill => \@infill } ]
|
||||||
|
@ -515,26 +515,16 @@ sub infill {
|
|||||||
|
|
||||||
Slic3r::parallelize(
|
Slic3r::parallelize(
|
||||||
threads => $self->print->config->threads,
|
threads => $self->print->config->threads,
|
||||||
items => sub {
|
items => sub { 0..$#{$self->layers} },
|
||||||
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;
|
|
||||||
},
|
|
||||||
thread_cb => sub {
|
thread_cb => sub {
|
||||||
my $q = shift;
|
my $q = shift;
|
||||||
while (defined (my $obj_layer = $q->dequeue)) {
|
while (defined (my $i = $q->dequeue)) {
|
||||||
my ($i, $region_id) = @$obj_layer;
|
$self->get_layer($i)->make_fill;
|
||||||
my $layerm = $self->get_layer($i)->regions->[$region_id];
|
|
||||||
$layerm->fills->clear;
|
|
||||||
$layerm->fills->append($_) for $self->fill_maker->make_fill($layerm);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
no_threads_cb => sub {
|
no_threads_cb => sub {
|
||||||
foreach my $layerm (map @{$_->regions}, @{$self->layers}) {
|
foreach my $layer (@{$self->layers}) {
|
||||||
$layerm->fills->clear;
|
$layer->make_fill;
|
||||||
$layerm->fills->append($_) for $self->fill_maker->make_fill($layerm);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user