Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2012-08-10 18:05:16 +0400
committerAlessandro Ranellucci <aar@cpan.org>2012-08-10 18:05:16 +0400
commit624e16b7e22c6a28e93fe11da1b414887538ade0 (patch)
tree0c48628952d0482dabec3068ee52ce5ae992b5d2
parent2576e3b00aec2246d5b3f0ea7c0c27f61579d6f5 (diff)
Unexpected results splitting objects with threaded perls. #610
-rw-r--r--lib/Slic3r/GUI/Plater.pm22
1 files changed, 16 insertions, 6 deletions
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index 1c141fbf6..ee7e53690 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -323,10 +323,16 @@ sub object_loaded {
sub remove {
my $self = shift;
+ my ($obj_idx) = @_;
- foreach my $pobj (@{$self->{selected_objects}}) {
- my ($obj_idx, $copy_idx) = ($pobj->[0], $pobj->[1]);
- $self->{print}->copies->[$obj_idx][$copy_idx] = undef;
+ if (defined $obj_idx) {
+ $self->{print}->copies->[$obj_idx][$_] = undef
+ for 0 .. $#{ $self->{print}->copies->[$obj_idx] };
+ } else {
+ foreach my $pobj (@{$self->{selected_objects}}) {
+ my ($obj_idx, $copy_idx) = ($pobj->[0], $pobj->[1]);
+ $self->{print}->copies->[$obj_idx][$copy_idx] = undef;
+ }
}
my @objects_to_remove = ();
@@ -476,9 +482,15 @@ sub split_object {
my @new_meshes = $mesh->split_mesh;
if (@new_meshes == 1) {
- Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be splitted because it contained already a single part.");
+ Slic3r::GUI::warning_catcher($self)->("The selected object couldn't be splitted because it already contains a single part.");
return;
}
+
+ # remove the original object before spawning the object_loaded event, otherwise
+ # we'll pass the wrong $obj_idx to it (which won't be recognized after the
+ # thumbnail thread returns)
+ $self->remove($obj_idx);
+
foreach my $mesh (@new_meshes) {
my $object = $self->{print}->add_object_from_mesh($mesh);
$object->input_file($current_object->input_file);
@@ -487,8 +499,6 @@ sub split_object {
$self->object_loaded($new_obj_idx, no_arrange => 1);
}
- $self->{list}->Select($obj_idx, 1);
- $self->remove;
$self->arrange;
}