User interface of the variable layer thickness. Certainly not finished yet,

but sufficient for evaluation of the prints.
This commit is contained in:
bubnikv 2016-12-12 18:02:24 +01:00
parent 2d030f3a3c
commit 46b44fc141
5 changed files with 413 additions and 133 deletions

View file

@ -12,7 +12,7 @@ use base qw(Slic3r::GUI::3DScene Class::Accessor);
sub new {
my $class = shift;
my ($parent, $objects, $model, $config) = @_;
my ($parent, $objects, $model, $print, $config) = @_;
my $self = $class->SUPER::new($parent);
$self->enable_picking(1);
@ -22,6 +22,7 @@ sub new {
$self->{objects} = $objects;
$self->{model} = $model;
$self->{print} = $print;
$self->{config} = $config;
$self->{on_select_object} = sub {};
$self->{on_instances_moved} = sub {};
@ -31,7 +32,7 @@ sub new {
my $obj_idx = undef;
if ($volume_idx != -1) {
$obj_idx = $self->object_idx($volume_idx);
$obj_idx = $self->volumes->[$volume_idx]->object_idx;
}
$self->{on_select_object}->($obj_idx)
if $self->{on_select_object};
@ -42,8 +43,8 @@ sub new {
my %done = (); # prevent moving instances twice
foreach my $volume_idx (@volume_idxs) {
my $volume = $self->volumes->[$volume_idx];
my $obj_idx = $self->object_idx($volume_idx);
my $instance_idx = $self->instance_idx($volume_idx);
my $obj_idx = $volume->object_idx;
my $instance_idx = $volume->instance_idx;
next if $done{"${obj_idx}_${instance_idx}"};
$done{"${obj_idx}_${instance_idx}"} = 1;
@ -89,7 +90,7 @@ sub update {
$self->update_bed_size;
foreach my $obj_idx (0..$#{$self->{model}->objects}) {
my @volume_idxs = $self->load_object($self->{model}, $obj_idx);
my @volume_idxs = $self->load_object($self->{model}, $self->{print}, $obj_idx);
if ($self->{objects}[$obj_idx]->selected) {
$self->select_volume($_) for @volume_idxs;

View file

@ -114,7 +114,7 @@ sub new {
my $canvas;
if ($Slic3r::GUI::have_OpenGL) {
$canvas = $self->{canvas} = Slic3r::GUI::3DScene->new($self);
$canvas->load_object($self->{model_object}, undef, [0]);
$canvas->load_object($self->{model_object}, undef, undef, [0]);
$canvas->set_auto_bed_shape;
$canvas->SetSize([500,500]);
$canvas->SetMinSize($canvas->GetSize);
@ -244,7 +244,7 @@ sub _update {
}
$self->{canvas}->reset_objects;
$self->{canvas}->load_object($_, undef, [0]) for @objects;
$self->{canvas}->load_object($_, undef, undef, [0]) for @objects;
$self->{canvas}->SetCuttingPlane(
$self->{cut_options}{z},
[@expolygons],

View file

@ -22,6 +22,7 @@ sub new {
my $self = $class->SUPER::new($parent, -1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
my $object = $self->{model_object} = $params{model_object};
my $print_object = $self->{print_object} = $params{print_object};
# create TreeCtrl
my $tree = $self->{tree} = Wx::TreeCtrl->new($self, -1, wxDefaultPosition, [300, 100],
@ -82,7 +83,7 @@ sub new {
$self->reload_tree($canvas->volume_idx($volume_idx));
});
$canvas->load_object($self->{model_object}, undef, [0]);
$canvas->load_object($self->{model_object}, undef, undef, [0]);
$canvas->set_auto_bed_shape;
$canvas->SetSize([500,500]);
$canvas->zoom_to_volumes;