mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Use async timer everywhere
This commit is contained in:
parent
08047c11eb
commit
a1bcbea816
2 changed files with 14 additions and 15 deletions
|
@ -464,7 +464,7 @@ sub objects_loaded {
|
||||||
$self->{list}->Select($obj_idxs->[-1], 1);
|
$self->{list}->Select($obj_idxs->[-1], 1);
|
||||||
$self->object_list_changed;
|
$self->object_list_changed;
|
||||||
|
|
||||||
$self->start_background_process;
|
$self->schedule_background_process;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub remove {
|
sub remove {
|
||||||
|
@ -567,7 +567,7 @@ sub rotate {
|
||||||
|
|
||||||
# update print and start background processing
|
# update print and start background processing
|
||||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||||
$self->start_background_process;
|
$self->schedule_background_process;
|
||||||
|
|
||||||
$object->transform_thumbnail($self->{model}, $obj_idx);
|
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||||
}
|
}
|
||||||
|
@ -603,7 +603,7 @@ sub changescale {
|
||||||
|
|
||||||
# update print and start background processing
|
# update print and start background processing
|
||||||
$self->{print}->add_model_object($model_object, $obj_idx);
|
$self->{print}->add_model_object($model_object, $obj_idx);
|
||||||
$self->start_background_process;
|
$self->schedule_background_process;
|
||||||
|
|
||||||
$object->transform_thumbnail($self->{model}, $obj_idx);
|
$object->transform_thumbnail($self->{model}, $obj_idx);
|
||||||
}
|
}
|
||||||
|
@ -692,6 +692,11 @@ sub split_object {
|
||||||
$self->load_model_objects(@model_objects);
|
$self->load_model_objects(@model_objects);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub schedule_background_process {
|
||||||
|
my ($self) = @_;
|
||||||
|
$self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot
|
||||||
|
}
|
||||||
|
|
||||||
sub async_apply_config {
|
sub async_apply_config {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
@ -705,12 +710,12 @@ sub async_apply_config {
|
||||||
if ($invalidated) {
|
if ($invalidated) {
|
||||||
# kill current thread if any
|
# kill current thread if any
|
||||||
$self->stop_background_process;
|
$self->stop_background_process;
|
||||||
|
|
||||||
# schedule a new process thread
|
|
||||||
$self->start_background_process;
|
|
||||||
} else {
|
} else {
|
||||||
# TODO: restore process thread
|
# TODO: restore process thread
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# schedule a new process thread in case it wasn't running
|
||||||
|
$self->start_background_process;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub start_background_process {
|
sub start_background_process {
|
||||||
|
@ -718,11 +723,7 @@ sub start_background_process {
|
||||||
|
|
||||||
return if !$Slic3r::have_threads;
|
return if !$Slic3r::have_threads;
|
||||||
return if !@{$self->{objects}};
|
return if !@{$self->{objects}};
|
||||||
|
return if $self->{process_thread};
|
||||||
if ($self->{process_thread}) {
|
|
||||||
warn "Can't start new process thread because one is already running\n";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
# It looks like declaring a local $SIG{__WARN__} prevents the ugly
|
# It looks like declaring a local $SIG{__WARN__} prevents the ugly
|
||||||
# "Attempt to free unreferenced scalar" warning...
|
# "Attempt to free unreferenced scalar" warning...
|
||||||
|
@ -1062,7 +1063,7 @@ sub on_config_change {
|
||||||
return if !$self->skeinpanel->is_loaded;
|
return if !$self->skeinpanel->is_loaded;
|
||||||
|
|
||||||
# (re)start timer
|
# (re)start timer
|
||||||
$self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot
|
$self->schedule_background_process;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub list_item_deselected {
|
sub list_item_deselected {
|
||||||
|
@ -1145,6 +1146,7 @@ sub object_settings_dialog {
|
||||||
# update print
|
# update print
|
||||||
if ($dlg->PartsChanged || $dlg->PartSettingsChanged) {
|
if ($dlg->PartsChanged || $dlg->PartSettingsChanged) {
|
||||||
$self->{print}->reload_object($obj_idx);
|
$self->{print}->reload_object($obj_idx);
|
||||||
|
$self->schedule_background_process;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,9 +321,6 @@ Print::clear_objects()
|
||||||
this->delete_object(i);
|
this->delete_object(i);
|
||||||
|
|
||||||
this->clear_regions();
|
this->clear_regions();
|
||||||
|
|
||||||
this->state.invalidate(psSkirt);
|
|
||||||
this->state.invalidate(psBrim);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintObject*
|
PrintObject*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue