mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 19:40:38 +08:00
bugfix: cache raft height for z-indicator in preview to avoid segfault when reslicing
This commit is contained in:
parent
bdd3afa2ba
commit
6d063a4413
@ -94,6 +94,9 @@ sub new {
|
|||||||
my $plater = $self->{plater} = $params{plater};
|
my $plater = $self->{plater} = $params{plater};
|
||||||
my $object = $self->{object} = $self->{plater}->{print}->get_object($self->{obj_idx});
|
my $object = $self->{object} = $self->{plater}->{print}->get_object($self->{obj_idx});
|
||||||
|
|
||||||
|
# store last raft height to correctly draw z-indicator plane during a running background job where the printObject is not valid
|
||||||
|
$self->{last_raft_height} = 0;
|
||||||
|
|
||||||
# Initialize 3D toolpaths preview
|
# Initialize 3D toolpaths preview
|
||||||
if ($Slic3r::GUI::have_OpenGL) {
|
if ($Slic3r::GUI::have_OpenGL) {
|
||||||
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self, $plater->{print});
|
$self->{preview3D} = Slic3r::GUI::Plater::3DPreview->new($self, $plater->{print});
|
||||||
@ -187,9 +190,11 @@ sub new {
|
|||||||
my ($z) = @_;
|
my ($z) = @_;
|
||||||
|
|
||||||
if($z) { # compensate raft height
|
if($z) { # compensate raft height
|
||||||
my $top_layer = $self->{object}->get_layer($self->{object}->layer_count-1);
|
if($self->{object}->layer_count > 0) { # printobject is not valid during toolpath generation but preview still shows last result
|
||||||
my $raft_height = max(0, $top_layer->print_z - unscale($self->{object}->size->z));
|
my $top_layer = $self->{object}->get_layer($self->{object}->layer_count-1);
|
||||||
$z += $raft_height;
|
$self->{last_raft_height} = max(0, $top_layer->print_z - unscale($self->{object}->size->z));
|
||||||
|
}
|
||||||
|
$z += $self->{last_raft_height};
|
||||||
}
|
}
|
||||||
$self->{preview3D}->canvas->SetCuttingPlane(Z, $z, []);
|
$self->{preview3D}->canvas->SetCuttingPlane(Z, $z, []);
|
||||||
$self->{preview3D}->canvas->Render;
|
$self->{preview3D}->canvas->Render;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user