Performance improvements in reloading the 3D scene.

Now the 3D scene loading is postponed until the page is visible.
This commit is contained in:
bubnikv 2017-05-31 17:05:11 +02:00
parent 556f40bf00
commit ee5ee5f432
4 changed files with 57 additions and 40 deletions

View file

@ -100,11 +100,18 @@ sub set_on_model_update {
}
sub reload_scene {
my ($self) = @_;
my ($self, $force) = @_;
$self->reset_objects;
$self->update_bed_size;
if (! $self->IsShown && ! $force) {
$self->{reload_delayed} = 1;
return;
}
$self->{reload_delayed} = 0;
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx);
if ($self->{objects}[$obj_idx]->selected) {
@ -133,4 +140,10 @@ sub update_bed_size {
$self->set_bed_shape($self->{config}->bed_shape);
}
1;
# Called by the Platter wxNotebook when this page is activated.
sub OnActivate {
my ($self) = @_;
$self->reload_scene(1) if ($self->{reload_delayed});
}
1;