mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
- Add Slic3r::Config::get_raw() for getting the raw, uncalculated values.
- Use get_raw() for saving and displaying options in GUI
This commit is contained in:
parent
8d25e6490a
commit
4031cf26b4
2 changed files with 18 additions and 10 deletions
|
@ -490,6 +490,14 @@ sub get {
|
|||
return $value;
|
||||
}
|
||||
|
||||
sub get_raw {
|
||||
my $class = @_ == 2 ? shift : undef;
|
||||
my ($opt_key) = @_;
|
||||
no strict 'refs';
|
||||
my $value = ${"Slic3r::$opt_key"};
|
||||
return $value;
|
||||
}
|
||||
|
||||
sub set {
|
||||
my $class = @_ == 3 ? shift : undef;
|
||||
my ($opt_key, $value) = @_;
|
||||
|
@ -501,8 +509,8 @@ sub serialize {
|
|||
my $class = @_ == 2 ? shift : undef;
|
||||
my ($opt_key) = @_;
|
||||
return $Options->{$opt_key}{serialize}
|
||||
? $Options->{$opt_key}{serialize}->(get($opt_key))
|
||||
: get($opt_key);
|
||||
? $Options->{$opt_key}{serialize}->(get_raw($opt_key))
|
||||
: get_raw($opt_key);
|
||||
}
|
||||
|
||||
sub deserialize {
|
||||
|
@ -521,7 +529,7 @@ sub save {
|
|||
binmode $fh, ':utf8';
|
||||
foreach my $opt (sort keys %$Options) {
|
||||
next if $Options->{$opt}{gui_only};
|
||||
my $value = get($opt);
|
||||
my $value = get_raw($opt);
|
||||
$value = $Options->{$opt}{serialize}->($value) if $Options->{$opt}{serialize};
|
||||
printf $fh "%s = %s\n", $opt, $value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue