One more little optimization

This commit is contained in:
Alessandro Ranellucci 2013-06-22 20:37:15 +02:00
parent db266cde9f
commit 1565560b55

View File

@ -145,6 +145,12 @@ sub slice {
my $self = shift; my $self = shift;
my %params = @_; my %params = @_;
# make sure all layers contain layer region objects for all regions
my $regions_count = $self->print->regions_count;
foreach my $layer (@{ $self->layers }) {
$layer->region($_) for 0 .. ($regions_count-1);
}
# process facets # process facets
for my $region_id (0 .. $#{$self->meshes}) { for my $region_id (0 .. $#{$self->meshes}) {
my $mesh = $self->meshes->[$region_id]; # ignore undef meshes my $mesh = $self->meshes->[$region_id]; # ignore undef meshes
@ -152,8 +158,7 @@ sub slice {
my $apply_lines = sub { my $apply_lines = sub {
my $lines = shift; my $lines = shift;
foreach my $layer_id (keys %$lines) { foreach my $layer_id (keys %$lines) {
my $layerm = $self->layers->[$layer_id]->region($region_id); push @{$self->layers->[$layer_id]->regions->[$region_id]->lines}, @{$lines->{$layer_id}};
push @{$layerm->lines}, @{$lines->{$layer_id}};
} }
}; };
Slic3r::parallelize( Slic3r::parallelize(
@ -192,9 +197,6 @@ sub slice {
pop @{$self->layers} while @{$self->layers} && (!map @{$_->lines}, @{$self->layers->[-1]->regions}); pop @{$self->layers} while @{$self->layers} && (!map @{$_->lines}, @{$self->layers->[-1]->regions});
foreach my $layer (@{ $self->layers }) { foreach my $layer (@{ $self->layers }) {
# make sure all layers contain layer region objects for all regions
$layer->region($_) for 0 .. ($self->print->regions_count-1);
Slic3r::debugf "Making surfaces for layer %d (slice z = %f):\n", Slic3r::debugf "Making surfaces for layer %d (slice z = %f):\n",
$layer->id, unscale $layer->slice_z if $Slic3r::debug; $layer->id, unscale $layer->slice_z if $Slic3r::debug;