mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 21:15:52 +08:00
If background slicing is disabled, reslice automatically when selecting the preview tabs. When making changes, go back to the plater view. #2979
This commit is contained in:
parent
42a6fb130f
commit
464421cfe4
@ -114,6 +114,7 @@ sub new {
|
|||||||
$self->{canvas}->on_instances_moved($on_instances_moved);
|
$self->{canvas}->on_instances_moved($on_instances_moved);
|
||||||
|
|
||||||
# Initialize 3D toolpaths preview
|
# Initialize 3D toolpaths preview
|
||||||
|
$self->{preview3D_page_idx} = -1;
|
||||||
if ($Slic3r::GUI::have_OpenGL) {
|
if ($Slic3r::GUI::have_OpenGL) {
|
||||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print});
|
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self->{preview_notebook}, $self->{print});
|
||||||
$self->{preview3D}->canvas->on_viewport_changed(sub {
|
$self->{preview3D}->canvas->on_viewport_changed(sub {
|
||||||
@ -124,15 +125,29 @@ sub new {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Initialize toolpaths preview
|
# Initialize toolpaths preview
|
||||||
|
$self->{toolpaths2D_page_idx} = -1;
|
||||||
if ($Slic3r::GUI::have_OpenGL) {
|
if ($Slic3r::GUI::have_OpenGL) {
|
||||||
$self->{toolpaths2D} = Slic3r::GUI::Plater::2DToolpaths->new($self->{preview_notebook}, $self->{print});
|
$self->{toolpaths2D} = Slic3r::GUI::Plater::2DToolpaths->new($self->{preview_notebook}, $self->{print});
|
||||||
$self->{preview_notebook}->AddPage($self->{toolpaths2D}, 'Layers');
|
$self->{preview_notebook}->AddPage($self->{toolpaths2D}, 'Layers');
|
||||||
|
$self->{toolpaths2D_page_idx} = $self->{preview_notebook}->GetPageCount-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub {
|
||||||
if ($self->{preview_notebook}->GetSelection == $self->{preview3D_page_idx}) {
|
wxTheApp->CallAfter(sub {
|
||||||
$self->{preview3D}->load_print;
|
my $sel = $self->{preview_notebook}->GetSelection;
|
||||||
}
|
if ($sel == $self->{preview3D_page_idx} || $sel == $self->{toolpaths2D_page_idx}) {
|
||||||
|
$self->{preview3D}->load_print;
|
||||||
|
|
||||||
|
if (!$Slic3r::GUI::Settings->{_}{background_processing}) {
|
||||||
|
$self->statusbar->SetCancelCallback(sub {
|
||||||
|
$self->stop_background_process;
|
||||||
|
$self->statusbar->SetStatusText("Slicing cancelled");
|
||||||
|
$self->{preview_notebook}->SetSelection(0);
|
||||||
|
});
|
||||||
|
$self->start_background_process;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
# toolbar for object manipulation
|
# toolbar for object manipulation
|
||||||
@ -1035,6 +1050,10 @@ sub split_object {
|
|||||||
sub schedule_background_process {
|
sub schedule_background_process {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
|
if (!$Slic3r::GUI::Settings->{_}{background_processing}) {
|
||||||
|
$self->{preview_notebook}->SetSelection(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (defined $self->{apply_config_timer}) {
|
if (defined $self->{apply_config_timer}) {
|
||||||
$self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot
|
$self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot
|
||||||
}
|
}
|
||||||
|
@ -126,7 +126,6 @@ sub load_print {
|
|||||||
#my @volume_ids = $self->canvas->load_object($object->model_object);
|
#my @volume_ids = $self->canvas->load_object($object->model_object);
|
||||||
#$self->canvas->volumes->[$_]->color->[3] = 0.2 for @volume_ids;
|
#$self->canvas->volumes->[$_]->color->[3] = 0.2 for @volume_ids;
|
||||||
}
|
}
|
||||||
$self->canvas->zoom_to_volumes;
|
|
||||||
$self->_loaded(1);
|
$self->_loaded(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user