Bugfix: when an external config was selected in any section, exported settings didn't reflect other sections properly
This commit is contained in:
parent
2f2bc8210a
commit
4fcecf5ef6
3 changed files with 21 additions and 12 deletions
lib/Slic3r
|
@ -835,7 +835,9 @@ sub new_from_cli {
|
||||||
|
|
||||||
sub merge {
|
sub merge {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
return $class->new(map %$_, @_);
|
my $config = $class->new;
|
||||||
|
$config->apply($_) for @_;
|
||||||
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub load {
|
sub load {
|
||||||
|
|
|
@ -232,16 +232,22 @@ sub config {
|
||||||
|
|
||||||
# retrieve filament presets and build a single config object for them
|
# retrieve filament presets and build a single config object for them
|
||||||
my $filament_config;
|
my $filament_config;
|
||||||
foreach my $preset_idx ($self->{plater}->filament_presets) {
|
if ($self->{plater}->filament_presets == 1) {
|
||||||
my $preset = $self->{options_tabs}{filament}->get_preset($preset_idx);
|
$filament_config = $self->{options_tabs}{filament}->config;
|
||||||
my $config = $self->{options_tabs}{filament}->get_preset_config($preset);
|
} else {
|
||||||
if (!$filament_config) {
|
# TODO: handle dirty presets.
|
||||||
$filament_config = $config;
|
# perhaps plater shouldn't expose dirty presets at all in multi-extruder environments.
|
||||||
next;
|
foreach my $preset_idx ($self->{plater}->filament_presets) {
|
||||||
}
|
my $preset = $self->{options_tabs}{filament}->get_preset($preset_idx);
|
||||||
foreach my $opt_key (keys %$config) {
|
my $config = $self->{options_tabs}{filament}->get_preset_config($preset);
|
||||||
next unless ref $filament_config->get($opt_key) eq 'ARRAY';
|
if (!$filament_config) {
|
||||||
push @{ $filament_config->get($opt_key) }, $config->get($opt_key)->[0];
|
$filament_config = $config;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
foreach my $opt_key (keys %$config) {
|
||||||
|
next unless ref $filament_config->get($opt_key) eq 'ARRAY';
|
||||||
|
push @{ $filament_config->get($opt_key) }, $config->get($opt_key)->[0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -210,7 +210,8 @@ sub get_preset_config {
|
||||||
}
|
}
|
||||||
|
|
||||||
# apply preset values on top of defaults
|
# apply preset values on top of defaults
|
||||||
$config->apply(Slic3r::Config->load($preset->{file}));
|
my $external_config = Slic3r::Config->load($preset->{file});
|
||||||
|
$config->set($_, $external_config->get($_)) for @{$self->{options}};
|
||||||
}
|
}
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|
Loading…
Add table
Reference in a new issue