mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 09:51:59 +08:00
Bugfix: object disappeared from 2D plater when reloaded from disk. #3634
This commit is contained in:
parent
da0f4c4e01
commit
85bf2ed7ae
@ -1434,10 +1434,10 @@ sub reload_from_disk {
|
|||||||
return if !$model_object->input_file
|
return if !$model_object->input_file
|
||||||
|| !-e $model_object->input_file;
|
|| !-e $model_object->input_file;
|
||||||
|
|
||||||
my @obj_idx = $self->load_file($model_object->input_file);
|
my @new_obj_idx = $self->load_file($model_object->input_file);
|
||||||
return if !@obj_idx;
|
return if !@new_obj_idx;
|
||||||
|
|
||||||
foreach my $new_obj_idx (@obj_idx) {
|
foreach my $new_obj_idx (@new_obj_idx) {
|
||||||
my $o = $self->{model}->objects->[$new_obj_idx];
|
my $o = $self->{model}->objects->[$new_obj_idx];
|
||||||
$o->clear_instances;
|
$o->clear_instances;
|
||||||
$o->add_instance($_) for @{$model_object->instances};
|
$o->add_instance($_) for @{$model_object->instances};
|
||||||
@ -1450,6 +1450,12 @@ sub reload_from_disk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$self->remove($obj_idx);
|
$self->remove($obj_idx);
|
||||||
|
|
||||||
|
# Trigger thumbnail generation again, because the remove() method altered
|
||||||
|
# object indexes before background thumbnail generation called its completion
|
||||||
|
# event, so the on_thumbnail_made callback is called with the wrong $obj_idx.
|
||||||
|
# When porting to C++ we'll probably have cleaner ways to do this.
|
||||||
|
$self->make_thumbnail($_-1) for @new_obj_idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub export_object_stl {
|
sub export_object_stl {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user