diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm index 0b7fbd26c..de23e403e 100644 --- a/lib/Slic3r/GUI/Plater.pm +++ b/lib/Slic3r/GUI/Plater.pm @@ -121,7 +121,7 @@ sub new { EVT_NOTEBOOK_PAGE_CHANGED($self, $self->{preview_notebook}, sub { if ($self->{preview_notebook}->GetSelection == $self->{preview3D_page_idx}) { - $self->{preview3D}->reload_print; + $self->{preview3D}->load_print; } }); @@ -874,14 +874,16 @@ sub schedule_background_process { if (defined $self->{apply_config_timer}) { $self->{apply_config_timer}->Start(PROCESS_DELAY, 1); # 1 = one shot - $self->{toolpaths2D}->reload_print if $self->{toolpaths2D}; - $self->{preview3D}->reload_print if $self->{preview3D}; } } sub async_apply_config { my ($self) = @_; + # reset preview canvases + $self->{toolpaths2D}->reload_print if $self->{toolpaths2D}; + $self->{preview3D}->reload_print if $self->{preview3D}; + # pause process thread before applying new config # since we don't want to touch data that is being used by the threads $self->pause_background_process; diff --git a/lib/Slic3r/GUI/Plater/3DPreview.pm b/lib/Slic3r/GUI/Plater/3DPreview.pm index 605463a6a..e34650538 100644 --- a/lib/Slic3r/GUI/Plater/3DPreview.pm +++ b/lib/Slic3r/GUI/Plater/3DPreview.pm @@ -8,7 +8,7 @@ use Wx qw(:misc :sizer :slider :statictext wxWHITE); use Wx::Event qw(EVT_SLIDER EVT_KEY_DOWN); use base qw(Wx::Panel Class::Accessor); -__PACKAGE__->mk_accessors(qw(print enabled canvas slider)); +__PACKAGE__->mk_accessors(qw(print enabled _loaded canvas slider)); sub new { my $class = shift; @@ -76,6 +76,14 @@ sub reload_print { my ($self) = @_; $self->canvas->reset_objects; + $self->_loaded(0); + $self->load_print; +} + +sub load_print { + my ($self) = @_; + + return if $self->_loaded; # we require that there's at least one object and the posSlice step # is performed on all of them (this ensures that _shifted_copies was @@ -112,6 +120,7 @@ sub reload_print { $self->canvas->load_print_object_toolpaths($object); } $self->canvas->zoom_to_volumes; + $self->_loaded(1); } }