mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 15:35:55 +08:00
Moved threads option from print settings to application preferences
This commit is contained in:
parent
b50417cb20
commit
a1c7b65741
@ -60,6 +60,7 @@ our $no_controller;
|
|||||||
our $no_plater;
|
our $no_plater;
|
||||||
our $mode;
|
our $mode;
|
||||||
our $autosave;
|
our $autosave;
|
||||||
|
our $threads;
|
||||||
our @cb;
|
our @cb;
|
||||||
|
|
||||||
our $Settings = {
|
our $Settings = {
|
||||||
@ -70,8 +71,8 @@ our $Settings = {
|
|||||||
invert_zoom => 0,
|
invert_zoom => 0,
|
||||||
background_processing => 0,
|
background_processing => 0,
|
||||||
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
||||||
# By default, Prusa has the controller hidden.
|
no_controller => 0,
|
||||||
no_controller => 1,
|
threads => $Slic3r::Config::Options->{threads}{default},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -121,16 +122,15 @@ sub OnInit {
|
|||||||
my $last_version;
|
my $last_version;
|
||||||
if (-f "$enc_datadir/slic3r.ini") {
|
if (-f "$enc_datadir/slic3r.ini") {
|
||||||
my $ini = eval { Slic3r::Config->read_ini("$datadir/slic3r.ini") };
|
my $ini = eval { Slic3r::Config->read_ini("$datadir/slic3r.ini") };
|
||||||
$Settings = $ini if $ini;
|
if ($ini) {
|
||||||
$last_version = $Settings->{_}{version};
|
$last_version = $ini->{_}{version};
|
||||||
$Settings->{_}{mode} ||= 'expert';
|
$ini->{_}{$_} = $Settings->{_}{$_}
|
||||||
$Settings->{_}{autocenter} //= 1;
|
for grep !exists $ini->{_}{$_}, keys %{$Settings->{_}};
|
||||||
$Settings->{_}{invert_zoom} //= 0;
|
$Settings = $ini;
|
||||||
$Settings->{_}{background_processing} //= 1;
|
}
|
||||||
# If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden.
|
|
||||||
$Settings->{_}{no_controller} //= 1;
|
|
||||||
}
|
}
|
||||||
$Settings->{_}{version} = $Slic3r::VERSION;
|
$Settings->{_}{version} = $Slic3r::VERSION;
|
||||||
|
$Settings->{_}{threads} = $threads if $threads;
|
||||||
$self->save_settings;
|
$self->save_settings;
|
||||||
|
|
||||||
# application frame
|
# application frame
|
||||||
|
@ -1157,6 +1157,10 @@ sub start_background_process {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($Slic3r::GUI::Settings->{_}{threads}) {
|
||||||
|
$self->{print}->config->set('threads', $Slic3r::GUI::Settings->{_}{threads});
|
||||||
|
}
|
||||||
|
|
||||||
# start thread
|
# start thread
|
||||||
@_ = ();
|
@_ = ();
|
||||||
$self->{process_thread} = Slic3r::spawn_thread(sub {
|
$self->{process_thread} = Slic3r::spawn_thread(sub {
|
||||||
|
@ -67,6 +67,13 @@ sub new {
|
|||||||
default => $Slic3r::GUI::Settings->{_}{background_processing},
|
default => $Slic3r::GUI::Settings->{_}{background_processing},
|
||||||
readonly => !$Slic3r::have_threads,
|
readonly => !$Slic3r::have_threads,
|
||||||
));
|
));
|
||||||
|
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
|
opt_id => 'threads',
|
||||||
|
type => 'i',
|
||||||
|
label => 'Threads',
|
||||||
|
tooltip => $Slic3r::Config::Options->{threads}{tooltip},
|
||||||
|
default => $Slic3r::GUI::Settings->{_}{threads},
|
||||||
|
));
|
||||||
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
|
||||||
opt_id => 'no_controller',
|
opt_id => 'no_controller',
|
||||||
type => 'bool',
|
type => 'bool',
|
||||||
|
@ -497,7 +497,7 @@ sub build {
|
|||||||
external_perimeter_extrusion_width infill_extrusion_width solid_infill_extrusion_width
|
external_perimeter_extrusion_width infill_extrusion_width solid_infill_extrusion_width
|
||||||
top_infill_extrusion_width support_material_extrusion_width
|
top_infill_extrusion_width support_material_extrusion_width
|
||||||
infill_overlap bridge_flow_ratio
|
infill_overlap bridge_flow_ratio
|
||||||
xy_size_compensation threads resolution
|
xy_size_compensation resolution
|
||||||
));
|
));
|
||||||
$self->{config}->set('print_settings_id', '');
|
$self->{config}->set('print_settings_id', '');
|
||||||
|
|
||||||
@ -686,7 +686,6 @@ sub build {
|
|||||||
{
|
{
|
||||||
my $optgroup = $page->new_optgroup('Other');
|
my $optgroup = $page->new_optgroup('Other');
|
||||||
$optgroup->append_single_option_line('xy_size_compensation');
|
$optgroup->append_single_option_line('xy_size_compensation');
|
||||||
$optgroup->append_single_option_line('threads') if $Slic3r::have_threads;
|
|
||||||
$optgroup->append_single_option_line('resolution');
|
$optgroup->append_single_option_line('resolution');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ use Slic3r::Geometry::Clipper qw(diff);
|
|||||||
has '_print' => (
|
has '_print' => (
|
||||||
is => 'ro',
|
is => 'ro',
|
||||||
default => sub { Slic3r::Print->new },
|
default => sub { Slic3r::Print->new },
|
||||||
handles => [qw(apply_config extruders output_filepath
|
handles => [qw(apply_config config extruders output_filepath
|
||||||
total_used_filament total_extruded_volume
|
total_used_filament total_extruded_volume
|
||||||
placeholder_parser process)],
|
placeholder_parser process)],
|
||||||
);
|
);
|
||||||
|
@ -29,6 +29,7 @@ my %cli_options = ();
|
|||||||
'debug' => \$Slic3r::debug,
|
'debug' => \$Slic3r::debug,
|
||||||
'gui' => \$opt{gui},
|
'gui' => \$opt{gui},
|
||||||
'o|output=s' => \$opt{output},
|
'o|output=s' => \$opt{output},
|
||||||
|
'j|threads=i' => \$opt{threads},
|
||||||
|
|
||||||
'save=s' => \$opt{save},
|
'save=s' => \$opt{save},
|
||||||
'load=s@' => \$opt{load},
|
'load=s@' => \$opt{load},
|
||||||
@ -109,6 +110,7 @@ if ((!@ARGV || $opt{gui}) && !$opt{save} && eval "require Slic3r::GUI; 1") {
|
|||||||
$Slic3r::GUI::no_plater = $opt{no_plater};
|
$Slic3r::GUI::no_plater = $opt{no_plater};
|
||||||
$Slic3r::GUI::mode = $opt{gui_mode};
|
$Slic3r::GUI::mode = $opt{gui_mode};
|
||||||
$Slic3r::GUI::autosave = $opt{autosave};
|
$Slic3r::GUI::autosave = $opt{autosave};
|
||||||
|
$Slic3r::GUI::threads = $opt{threads};
|
||||||
}
|
}
|
||||||
$gui = Slic3r::GUI->new;
|
$gui = Slic3r::GUI->new;
|
||||||
setlocale(LC_NUMERIC, 'C');
|
setlocale(LC_NUMERIC, 'C');
|
||||||
@ -263,6 +265,7 @@ if (@ARGV) { # slicing from command line
|
|||||||
);
|
);
|
||||||
|
|
||||||
$sprint->apply_config($config);
|
$sprint->apply_config($config);
|
||||||
|
$sprint->config->set('threads', $opt{threads}) if $opt{threads};
|
||||||
$sprint->set_model($model);
|
$sprint->set_model($model);
|
||||||
|
|
||||||
if ($opt{export_svg}) {
|
if ($opt{export_svg}) {
|
||||||
@ -293,7 +296,7 @@ sub usage {
|
|||||||
my $j = '';
|
my $j = '';
|
||||||
if ($Slic3r::have_threads) {
|
if ($Slic3r::have_threads) {
|
||||||
$j = <<"EOF";
|
$j = <<"EOF";
|
||||||
-j, --threads <num> Number of threads to use (1+, default: $config->{threads})
|
-j, --threads <num> Number of threads to use
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1383,7 +1383,6 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
def = this->add("threads", coInt);
|
def = this->add("threads", coInt);
|
||||||
def->label = "Threads";
|
def->label = "Threads";
|
||||||
def->tooltip = "Threads are used to parallelize long-running tasks. Optimal threads number is slightly above the number of available cores/processors.";
|
def->tooltip = "Threads are used to parallelize long-running tasks. Optimal threads number is slightly above the number of available cores/processors.";
|
||||||
def->cli = "threads|j=i";
|
|
||||||
def->readonly = true;
|
def->readonly = true;
|
||||||
def->min = 1;
|
def->min = 1;
|
||||||
{
|
{
|
||||||
|
@ -624,6 +624,7 @@ class CLIConfig
|
|||||||
ConfigOptionString save;
|
ConfigOptionString save;
|
||||||
ConfigOptionFloat scale;
|
ConfigOptionFloat scale;
|
||||||
ConfigOptionPoint3 scale_to_fit;
|
ConfigOptionPoint3 scale_to_fit;
|
||||||
|
ConfigOptionBool threads;
|
||||||
|
|
||||||
CLIConfig() : ConfigBase(), StaticConfig() {
|
CLIConfig() : ConfigBase(), StaticConfig() {
|
||||||
this->def = &cli_config_def;
|
this->def = &cli_config_def;
|
||||||
@ -647,6 +648,7 @@ class CLIConfig
|
|||||||
OPT_PTR(save);
|
OPT_PTR(save);
|
||||||
OPT_PTR(scale);
|
OPT_PTR(scale);
|
||||||
OPT_PTR(scale_to_fit);
|
OPT_PTR(scale_to_fit);
|
||||||
|
OPT_PTR(threads);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user