mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 14:04:11 -06:00
Merge branch 'xs-config'
Conflicts: lib/Slic3r/Config.pm xs/MANIFEST
This commit is contained in:
commit
ab25cc4940
19 changed files with 2370 additions and 1235 deletions
1270
lib/Slic3r/Config.pm
1270
lib/Slic3r/Config.pm
File diff suppressed because it is too large
Load diff
|
@ -381,9 +381,17 @@ sub _set_config {
|
|||
my ($opt_key, $index, $value) = @_;
|
||||
|
||||
my ($get_m, $serialized) = $self->_config_methods($opt_key, $index);
|
||||
defined $index
|
||||
? $self->config->$get_m($opt_key)->[$index] = $value
|
||||
: $self->config->set($opt_key, $value, $serialized);
|
||||
if (defined $index) {
|
||||
my $values = $self->config->$get_m($opt_key);
|
||||
$values->[$index] = $value;
|
||||
$self->config->set($opt_key, $values);
|
||||
} else {
|
||||
if ($serialized) {
|
||||
$self->config->set_deserialize($opt_key, $value);
|
||||
} else {
|
||||
$self->config->set($opt_key, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub _config_methods {
|
||||
|
|
|
@ -733,6 +733,9 @@ sub export_gcode {
|
|||
catch_error => sub { Slic3r::GUI::catch_error($self, @_) && $self->on_export_failed },
|
||||
);
|
||||
}
|
||||
|
||||
# this method gets executed in a separate thread by wxWidgets since it's a button handler
|
||||
Slic3r::thread_cleanup() if $Slic3r::have_threads;
|
||||
}
|
||||
|
||||
sub export_gcode2 {
|
||||
|
@ -802,6 +805,9 @@ sub export_stl {
|
|||
my $output_file = $self->_get_export_file('STL') or return;
|
||||
Slic3r::Format::STL->write_file($output_file, $self->{model}, binary => 1);
|
||||
$self->statusbar->SetStatusText("STL file exported to $output_file");
|
||||
|
||||
# this method gets executed in a separate thread by wxWidgets since it's a button handler
|
||||
Slic3r::thread_cleanup() if $Slic3r::have_threads;
|
||||
}
|
||||
|
||||
sub export_amf {
|
||||
|
@ -810,6 +816,9 @@ sub export_amf {
|
|||
my $output_file = $self->_get_export_file('AMF') or return;
|
||||
Slic3r::Format::AMF->write_file($output_file, $self->{model});
|
||||
$self->statusbar->SetStatusText("AMF file exported to $output_file");
|
||||
|
||||
# this method gets executed in a separate thread by wxWidgets since it's a menu handler
|
||||
Slic3r::thread_cleanup() if $Slic3r::have_threads;
|
||||
}
|
||||
|
||||
sub _get_export_file {
|
||||
|
@ -853,7 +862,9 @@ sub make_thumbnail {
|
|||
};
|
||||
|
||||
@_ = ();
|
||||
$Slic3r::have_threads ? threads->create($cb)->detach : $cb->();
|
||||
$Slic3r::have_threads
|
||||
? threads->create(sub { $cb->(); Slic3r::thread_cleanup(); })->detach
|
||||
: $cb->();
|
||||
}
|
||||
|
||||
sub on_thumbnail_made {
|
||||
|
|
|
@ -312,7 +312,7 @@ sub load_config {
|
|||
my ($config) = @_;
|
||||
|
||||
foreach my $tab (values %{$self->{options_tabs}}) {
|
||||
$tab->set_value($_, $config->$_) for keys %$config;
|
||||
$tab->set_value($_, $config->$_) for @{$config->get_keys};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,7 +291,8 @@ sub set_value {
|
|||
sub reload_values {
|
||||
my $self = shift;
|
||||
|
||||
$self->set_value($_, $self->{config}->get($_)) for keys %{$self->{config}};
|
||||
$self->set_value($_, $self->{config}->get($_))
|
||||
for @{$self->{config}->get_keys};
|
||||
}
|
||||
|
||||
sub update_tree {
|
||||
|
@ -735,7 +736,9 @@ sub config {
|
|||
|
||||
# remove all unused values
|
||||
foreach my $opt_key ($self->_extruder_options) {
|
||||
splice @{ $config->{$opt_key} }, $self->{extruders_count};
|
||||
my $values = $config->get($opt_key);
|
||||
splice @$values, $self->{extruders_count};
|
||||
$config->set($opt_key, $values);
|
||||
}
|
||||
|
||||
return $config;
|
||||
|
|
|
@ -925,13 +925,13 @@ sub write_gcode {
|
|||
$extruder->absolute_E, $extruder->extruded_volume/1000;
|
||||
}
|
||||
|
||||
if ($Slic3r::Config->gcode_comments) {
|
||||
if ($self->config->gcode_comments) {
|
||||
# append full config
|
||||
print $fh "\n";
|
||||
foreach my $opt_key (sort keys %{$Slic3r::Config}) {
|
||||
foreach my $opt_key (sort @{$self->config->get_keys}) {
|
||||
next if $Slic3r::Config::Options->{$opt_key}{shortcut};
|
||||
next if $Slic3r::Config::Options->{$opt_key}{gui_only};
|
||||
printf $fh "; %s = %s\n", $opt_key, $Slic3r::Config->serialize($opt_key);
|
||||
printf $fh "; %s = %s\n", $opt_key, $self->config->serialize($opt_key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue