mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 13:35:57 +08:00
Whenever user opens and closes the preset editor, apply the new defaults to the overrides. This is less confusing. #3814
This commit is contained in:
parent
10830ec23b
commit
0c8f5eeb90
@ -554,7 +554,8 @@ sub _on_select_preset {
|
|||||||
|
|
||||||
wxTheApp->save_settings;
|
wxTheApp->save_settings;
|
||||||
|
|
||||||
my $config = $self->config;
|
# Ignore overrides in the plater, we only care about the preset configs.
|
||||||
|
my $config = $self->config(1);
|
||||||
|
|
||||||
$self->on_extruders_change(scalar @{$config->get('nozzle_diameter')});
|
$self->on_extruders_change(scalar @{$config->get('nozzle_diameter')});
|
||||||
|
|
||||||
@ -571,11 +572,12 @@ sub _on_select_preset {
|
|||||||
|
|
||||||
# Add/remove options (we do it this way for preserving current options)
|
# Add/remove options (we do it this way for preserving current options)
|
||||||
foreach my $opt_key (@$overridable) {
|
foreach my $opt_key (@$overridable) {
|
||||||
if (!$o_config->has($opt_key)) {
|
|
||||||
# Populate option with the default value taken from configuration
|
# Populate option with the default value taken from configuration
|
||||||
|
# (re-set the override always, because if we here it means user
|
||||||
|
# switched to this preset or opened/closed the editor, so he expects
|
||||||
|
# the new values set in the editor to be used).
|
||||||
$o_config->set($opt_key, $config->get($opt_key));
|
$o_config->set($opt_key, $config->get($opt_key));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
foreach my $opt_key (@{$o_config->get_keys}) {
|
foreach my $opt_key (@{$o_config->get_keys}) {
|
||||||
# Keep options listed among overridable and options added on the fly
|
# Keep options listed among overridable and options added on the fly
|
||||||
if ((none { $_ eq $opt_key } @$overridable)
|
if ((none { $_ eq $opt_key } @$overridable)
|
||||||
@ -758,7 +760,7 @@ sub show_preset_editor {
|
|||||||
|
|
||||||
# Returns the current config by merging the selected presets and the overrides.
|
# Returns the current config by merging the selected presets and the overrides.
|
||||||
sub config {
|
sub config {
|
||||||
my ($self) = @_;
|
my ($self, $ignore_overrides) = @_;
|
||||||
|
|
||||||
# use a DynamicConfig because FullPrintConfig is not enough
|
# use a DynamicConfig because FullPrintConfig is not enough
|
||||||
my $config = Slic3r::Config->new_from_defaults;
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
@ -791,7 +793,8 @@ sub config {
|
|||||||
$config->apply($filament_config);
|
$config->apply($filament_config);
|
||||||
}
|
}
|
||||||
$config->apply($_->dirty_config) for @{ $presets{print} };
|
$config->apply($_->dirty_config) for @{ $presets{print} };
|
||||||
$config->apply($self->{settings_override_config});
|
$config->apply($self->{settings_override_config})
|
||||||
|
unless $ignore_overrides;
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user