Removed dependency on ->object from Region.pm

This commit is contained in:
Alessandro Ranellucci 2013-11-26 18:46:48 +01:00
parent bd8c430afd
commit 57fd6ad563
4 changed files with 8 additions and 6 deletions

View file

@ -17,7 +17,7 @@ use Slic3r::Geometry::Clipper qw(union union_ex diff diff_ex intersection_ex off
use Slic3r::Surface ':types';
has 'object' => (is => 'ro', required => 1, weak_ref => 1);
has 'bounding_box' => (is => 'ro', required => 0);
has 'fillers' => (is => 'rw', default => sub { {} });
our %FillTypes = (
@ -40,7 +40,7 @@ sub filler {
}
$self->fillers->{$filler} ||= $FillTypes{$filler}->new(
bounding_box => $self->object->bounding_box,
bounding_box => $self->bounding_box,
);
return $self->fillers->{$filler};
}

View file

@ -5,7 +5,7 @@ use Slic3r::Geometry qw(PI);
has 'layer_id' => (is => 'rw');
has 'angle' => (is => 'rw', default => sub { $Slic3r::Config->fill_angle });
has 'bounding_box' => (is => 'ro', required => 1); # Slic3r::Geometry::BoundingBox object
has 'bounding_box' => (is => 'ro', required => 0); # Slic3r::Geometry::BoundingBox object
sub angles () { [0, PI/2] }
@ -16,7 +16,9 @@ sub infill_direction {
# set infill angle
my (@rotate, @shift);
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
$rotate[1] = $self->bounding_box->center_2D;
$rotate[1] = $self->bounding_box
? $self->bounding_box->center_2D
: $surface->expolygon->bounding_box->center_2D;
@shift = @{$rotate[1]};
if (defined $self->layer_id) {

View file

@ -328,7 +328,7 @@ sub _fill_gaps {
return unless @$gaps;
my $filler = $self->layer->object->fill_maker->filler('rectilinear');
my $filler = Slic3r::Fill->new->filler('rectilinear');
$filler->layer_id($self->layer->id);
# we should probably use this code to handle thin walls and remove that logic from

View file

@ -76,7 +76,7 @@ sub BUILD {
sub _build_fill_maker {
my $self = shift;
return Slic3r::Fill->new(object => $self);
return Slic3r::Fill->new(bounding_box => $self->bounding_box);
}
# This should be probably moved in Print.pm at the point where we sort Layer objects