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
|
@ -835,7 +835,9 @@ sub new_from_cli {
|
|||
|
||||
sub merge {
|
||||
my $class = shift;
|
||||
return $class->new(map %$_, @_);
|
||||
my $config = $class->new;
|
||||
$config->apply($_) for @_;
|
||||
return $config;
|
||||
}
|
||||
|
||||
sub load {
|
||||
|
|
|
@ -232,16 +232,22 @@ sub config {
|
|||
|
||||
# retrieve filament presets and build a single config object for them
|
||||
my $filament_config;
|
||||
foreach my $preset_idx ($self->{plater}->filament_presets) {
|
||||
my $preset = $self->{options_tabs}{filament}->get_preset($preset_idx);
|
||||
my $config = $self->{options_tabs}{filament}->get_preset_config($preset);
|
||||
if (!$filament_config) {
|
||||
$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];
|
||||
if ($self->{plater}->filament_presets == 1) {
|
||||
$filament_config = $self->{options_tabs}{filament}->config;
|
||||
} else {
|
||||
# TODO: handle dirty presets.
|
||||
# perhaps plater shouldn't expose dirty presets at all in multi-extruder environments.
|
||||
foreach my $preset_idx ($self->{plater}->filament_presets) {
|
||||
my $preset = $self->{options_tabs}{filament}->get_preset($preset_idx);
|
||||
my $config = $self->{options_tabs}{filament}->get_preset_config($preset);
|
||||
if (!$filament_config) {
|
||||
$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
|
||||
$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;
|
||||
|
|
Loading…
Reference in a new issue