mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-15 02:05:57 +08:00
Removed dependency on ->object from Region.pm
This commit is contained in:
parent
bd8c430afd
commit
57fd6ad563
@ -17,7 +17,7 @@ use Slic3r::Geometry::Clipper qw(union union_ex diff diff_ex intersection_ex off
|
|||||||
use Slic3r::Surface ':types';
|
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 { {} });
|
has 'fillers' => (is => 'rw', default => sub { {} });
|
||||||
|
|
||||||
our %FillTypes = (
|
our %FillTypes = (
|
||||||
@ -40,7 +40,7 @@ sub filler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->fillers->{$filler} ||= $FillTypes{$filler}->new(
|
$self->fillers->{$filler} ||= $FillTypes{$filler}->new(
|
||||||
bounding_box => $self->object->bounding_box,
|
bounding_box => $self->bounding_box,
|
||||||
);
|
);
|
||||||
return $self->fillers->{$filler};
|
return $self->fillers->{$filler};
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ use Slic3r::Geometry qw(PI);
|
|||||||
|
|
||||||
has 'layer_id' => (is => 'rw');
|
has 'layer_id' => (is => 'rw');
|
||||||
has 'angle' => (is => 'rw', default => sub { $Slic3r::Config->fill_angle });
|
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] }
|
sub angles () { [0, PI/2] }
|
||||||
|
|
||||||
@ -16,7 +16,9 @@ sub infill_direction {
|
|||||||
# set infill angle
|
# set infill angle
|
||||||
my (@rotate, @shift);
|
my (@rotate, @shift);
|
||||||
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
|
$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]};
|
@shift = @{$rotate[1]};
|
||||||
|
|
||||||
if (defined $self->layer_id) {
|
if (defined $self->layer_id) {
|
||||||
|
@ -328,7 +328,7 @@ sub _fill_gaps {
|
|||||||
|
|
||||||
return unless @$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);
|
$filler->layer_id($self->layer->id);
|
||||||
|
|
||||||
# we should probably use this code to handle thin walls and remove that logic from
|
# we should probably use this code to handle thin walls and remove that logic from
|
||||||
|
@ -76,7 +76,7 @@ sub BUILD {
|
|||||||
|
|
||||||
sub _build_fill_maker {
|
sub _build_fill_maker {
|
||||||
my $self = shift;
|
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
|
# This should be probably moved in Print.pm at the point where we sort Layer objects
|
||||||
|
Loading…
x
Reference in New Issue
Block a user