More robust fix for 3D view and GUI buttons not in synch when object's size is almost identical to print volume's size

This commit is contained in:
Enrico Turri 2018-04-24 09:00:33 +02:00
parent 973060c728
commit 71d9500b2e
11 changed files with 33 additions and 76 deletions

View file

@ -1396,7 +1396,7 @@ sub Render {
if ($self->enable_picking) {
$self->mark_volumes_for_layer_height;
$self->volumes->set_print_box($self->bed_bounding_box->x_min, $self->bed_bounding_box->y_min, 0.0, $self->bed_bounding_box->x_max, $self->bed_bounding_box->y_max, $self->{config}->get('max_print_height'));
$self->volumes->update_outside_state($self->{config}, 0);
$self->volumes->check_outside_state($self->{config});
# do not cull backfaces to show broken geometry, if any
glDisable(GL_CULL_FACE);
}

View file

@ -1921,7 +1921,7 @@ sub object_list_changed {
}
my $export_in_progress = $self->{export_gcode_output_file} || $self->{send_gcode_file};
my $model_fits = $self->{model}->fits_print_volume($self->{config});
my $model_fits = $self->{canvas3D} ? $self->{canvas3D}->volumes->check_outside_state($self->{config}) : 1;
my $method = ($have_objects && ! $export_in_progress && $model_fits) ? 'Enable' : 'Disable';
$self->{"btn_$_"}->$method
for grep $self->{"btn_$_"}, qw(reslice export_gcode print send_gcode);

View file

@ -222,13 +222,14 @@ sub reload_scene {
# checks for geometry outside the print volume to render it accordingly
if (scalar @{$self->volumes} > 0)
{
if (!$self->{model}->fits_print_volume($self->{config})) {
my $contained = $self->volumes->check_outside_state($self->{config});
if (!$contained) {
$self->set_warning_enabled(1);
Slic3r::GUI::_3DScene::generate_warning_texture(L("Detected object outside print volume"));
$self->on_enable_action_buttons->(0) if ($self->on_enable_action_buttons);
} else {
$self->set_warning_enabled(0);
$self->volumes->update_outside_state($self->{config}, 1);
$self->volumes->reset_outside_state();
Slic3r::GUI::_3DScene::reset_warning_texture();
$self->on_enable_action_buttons->(1) if ($self->on_enable_action_buttons);
}