From d02012e4a3d070f21c8830111a2f190bce613628 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 9 Aug 2012 00:59:41 +0200 Subject: [PATCH] Accept multiple --load arguments for GUI too --- lib/Slic3r/GUI/Tab.pm | 11 ++++++----- slic3r.pl | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index bf5a52f00..acab6ca5d 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -202,9 +202,9 @@ sub get_preset_config { my $self = shift; my ($preset) = @_; - my $config = Slic3r::Config->new_from_defaults(@{$self->{options}}); - - if (!$preset->{default}) { + if ($preset->{default}) { + return Slic3r::Config->new_from_defaults(@{$self->{options}}); + } else { if (!-e $preset->{file}) { Slic3r::GUI::show_error($self, "The selected preset does not exist anymore ($preset->{file})."); return; @@ -212,11 +212,12 @@ sub get_preset_config { # apply preset values on top of defaults my $external_config = Slic3r::Config->load($preset->{file}); + my $config = Slic3r::Config->new; $config->set($_, $external_config->get($_)) for grep $external_config->has($_), @{$self->{options}}; + + return $config; } - - return $config; } sub add_options_page { diff --git a/slic3r.pl b/slic3r.pl index 0cf8baa26..f5575c0e7 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -71,7 +71,7 @@ if ($opt{save}) { my $gui; if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") { $gui = Slic3r::GUI->new; - $gui->{skeinpanel}->load_config_file($opt{load}[0]) if $opt{load}; + $gui->{skeinpanel}->load_config_file($_) for @{$opt{load}}; $gui->{skeinpanel}->load_config($cli_config); $gui->MainLoop; exit;