From 0c8f5eeb905bcb2c95fb40c45023f53f4bd995f7 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 29 Mar 2017 17:47:02 +0200 Subject: [PATCH] Whenever user opens and closes the preset editor, apply the new defaults to the overrides. This is less confusing. #3814 --- lib/Slic3r/GUI/Plater.pm | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 536f8be64d..60027cb5d2 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -554,7 +554,8 @@ sub _on_select_preset { 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')}); @@ -571,10 +572,11 @@ sub _on_select_preset { # Add/remove options (we do it this way for preserving current options) foreach my $opt_key (@$overridable) { - if (!$o_config->has($opt_key)) { - # Populate option with the default value taken from configuration - $o_config->set($opt_key, $config->get($opt_key)); - } + # 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)); } foreach my $opt_key (@{$o_config->get_keys}) { # Keep options listed among overridable and options added on the fly @@ -758,7 +760,7 @@ sub show_preset_editor { # Returns the current config by merging the selected presets and the overrides. sub config { - my ($self) = @_; + my ($self, $ignore_overrides) = @_; # use a DynamicConfig because FullPrintConfig is not enough my $config = Slic3r::Config->new_from_defaults; @@ -791,7 +793,8 @@ sub config { $config->apply($filament_config); } $config->apply($_->dirty_config) for @{ $presets{print} }; - $config->apply($self->{settings_override_config}); + $config->apply($self->{settings_override_config}) + unless $ignore_overrides; return $config; }