Change: --save will now only save the specified options, without the defaults
This commit is contained in:
parent
28695c719c
commit
342513a4de
18
slic3r.pl
18
slic3r.pl
@ -53,9 +53,6 @@ my %cli_options = ();
|
|||||||
GetOptions(%options) or usage(1);
|
GetOptions(%options) or usage(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
# process command line options
|
|
||||||
my $cli_config = Slic3r::Config->new_from_cli(%cli_options);
|
|
||||||
|
|
||||||
# load configuration files
|
# load configuration files
|
||||||
my @external_configs = ();
|
my @external_configs = ();
|
||||||
if ($opt{load}) {
|
if ($opt{load}) {
|
||||||
@ -71,19 +68,22 @@ if ($opt{load}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# merge configuration
|
# process command line options
|
||||||
my $config = Slic3r::Config->new_from_defaults;
|
my $cli_config = Slic3r::Config->new;
|
||||||
foreach my $c (@external_configs, $cli_config) {
|
foreach my $c (@external_configs, Slic3r::Config->new_from_cli(%cli_options)) {
|
||||||
$c->normalize; # expand shortcuts before applying, otherwise destination values would be already filled with defaults
|
$c->normalize; # expand shortcuts before applying, otherwise destination values would be already filled with defaults
|
||||||
$config->apply($c);
|
$cli_config->apply($c);
|
||||||
}
|
}
|
||||||
|
|
||||||
# save configuration
|
# save configuration
|
||||||
if ($opt{save}) {
|
if ($opt{save}) {
|
||||||
$config->validate;
|
$cli_config->save($opt{save});
|
||||||
$config->save($opt{save});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# apply command line config on top of default config
|
||||||
|
my $config = Slic3r::Config->new_from_defaults;
|
||||||
|
$config->apply($cli_config);
|
||||||
|
|
||||||
# launch GUI
|
# launch GUI
|
||||||
my $gui;
|
my $gui;
|
||||||
if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
if (!@ARGV && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
||||||
|
Loading…
Reference in New Issue
Block a user