More work for removing references to $Slic3r::Config

xs-bb
Alessandro Ranellucci 2013-12-24 11:58:36 +01:00
parent 1157a7f859
commit 2956c1a2e5
4 changed files with 14 additions and 12 deletions

View File

@ -25,7 +25,11 @@ has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}});
sub _build_bridge_flow {
my $self = shift;
return Slic3r::Flow::Bridge->new(nozzle_diameter => $self->nozzle_diameter);
return Slic3r::Flow::Bridge->new(
nozzle_diameter => $self->nozzle_diameter,
bridge_flow_ratio => $self->config->bridge_flow_ratio,
);
}
sub _build_e_per_mm3 {

View File

@ -90,13 +90,14 @@ use Moo;
extends 'Slic3r::Flow';
# layer_height is not required in this case
has '+layer_height' => (is => 'ro', required => 0);
has '+layer_height' => (is => 'ro', required => 0);
has 'bridge_flow_ratio' => (is => 'ro', required => 1);
use Slic3r::Geometry qw(PI);
sub _build_width {
my $self = shift;
return sqrt($Slic3r::Config->bridge_flow_ratio * ($self->nozzle_diameter**2));
return sqrt($self->bridge_flow_ratio * ($self->nozzle_diameter**2));
}
sub _build_spacing {

View File

@ -39,9 +39,6 @@ sub BUILD {
sub init_config {
my $self = shift;
# store config in a handy place
$Slic3r::Config = $self->config;
# legacy with existing config files
$self->config->set('first_layer_height', $self->config->layer_height)
if !$self->config->first_layer_height;
@ -861,7 +858,7 @@ sub write_gcode {
}
my $buffer = Slic3r::GCode::CoolingBuffer->new(
config => $Slic3r::Config,
config => $self->config,
gcodegen => $gcodegen,
);
@ -903,7 +900,7 @@ sub write_gcode {
}
my $buffer = Slic3r::GCode::CoolingBuffer->new(
config => $Slic3r::Config,
config => $self->config,
gcodegen => $gcodegen,
);
foreach my $print_z (sort { $a <=> $b } keys %layers) {

View File

@ -26,10 +26,10 @@ plan tests => 2;
{
my $thread = threads->create(sub {
# $print can't be inizialized outside the thread because Object->slice will
# modify it by removing meshes and popping layers
my $print = Slic3r::Test::init_print('20mm_cube');
Slic3r::Test::gcode($print);
{
my $print = Slic3r::Test::init_print('20mm_cube');
Slic3r::Test::gcode($print);
}
Slic3r::thread_cleanup();
return 1;
});