Refactored the Config XS bindings

This commit is contained in:
Alessandro Ranellucci 2015-12-16 12:33:19 +01:00
parent c73378744f
commit 3c862836f2
18 changed files with 104 additions and 194 deletions

View file

@ -389,19 +389,13 @@ sub read_ini {
return $ini;
}
package Slic3r::Config::GCode;
package Slic3r::Config::Static;
use parent 'Slic3r::Config';
package Slic3r::Config::Print;
use parent 'Slic3r::Config';
package Slic3r::Config::PrintObject;
use parent 'Slic3r::Config';
package Slic3r::Config::PrintRegion;
use parent 'Slic3r::Config';
package Slic3r::Config::Full;
use parent 'Slic3r::Config';
sub Slic3r::Config::GCode::new { Slic3r::Config::Static::new_GCodeConfig }
sub Slic3r::Config::Print::new { Slic3r::Config::Static::new_PrintConfig }
sub Slic3r::Config::PrintObject::new { Slic3r::Config::Static::new_PrintObjectConfig }
sub Slic3r::Config::PrintRegion::new { Slic3r::Config::Static::new_PrintRegionConfig }
sub Slic3r::Config::Full::new { Slic3r::Config::Static::new_FullPrintConfig }
1;

View file

@ -15,7 +15,7 @@ my @AXES = qw(X Y Z E);
sub apply_print_config {
my ($self, $print_config) = @_;
$self->config->apply_print_config($print_config);
$self->config->apply_static($print_config);
$self->_extrusion_axis($self->config->get_extrusion_axis);
}

View file

@ -287,7 +287,7 @@ sub make_skirt {
$extruded_length[$extruder_idx] ||= 0;
if (!$extruders_e_per_mm[$extruder_idx]) {
my $config = Slic3r::Config::GCode->new;
$config->apply_print_config($self->config);
$config->apply_static($self->config);
my $extruder = Slic3r::Extruder->new($extruder_idx, $config);
$extruders_e_per_mm[$extruder_idx] = $extruder->e_per_mm($mm3_per_mm);
}

View file

@ -353,7 +353,7 @@ sub process_layer {
my $gcode = "";
my $object = $layer->object;
$self->_gcodegen->config->apply_object_config($object->config);
$self->_gcodegen->config->apply_static($object->config);
# check whether we're going to apply spiralvase logic
if (defined $self->_spiral_vase) {
@ -594,7 +594,7 @@ sub _extrude_perimeters {
my $gcode = "";
foreach my $region_id (sort keys %$entities_by_region) {
$self->_gcodegen->config->apply_region_config($self->print->get_region($region_id)->config);
$self->_gcodegen->config->apply_static($self->print->get_region($region_id)->config);
$gcode .= $self->_gcodegen->extrude($_, 'perimeter', -1)
for @{ $entities_by_region->{$region_id} };
}
@ -606,7 +606,7 @@ sub _extrude_infill {
my $gcode = "";
foreach my $region_id (sort keys %$entities_by_region) {
$self->_gcodegen->config->apply_region_config($self->print->get_region($region_id)->config);
$self->_gcodegen->config->apply_static($self->print->get_region($region_id)->config);
my $collection = Slic3r::ExtrusionPath::Collection->new(@{ $entities_by_region->{$region_id} });
for my $fill (@{$collection->chained_path_from($self->_gcodegen->last_pos, 0)}) {