Out of bed detection - Disabled GUI buttons when object outside bed
This commit is contained in:
parent
85d158525f
commit
ebb2d45761
@ -98,6 +98,16 @@ sub new {
|
|||||||
$self->update;
|
$self->update;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# callback to enable/disable action buttons
|
||||||
|
my $enable_action_buttons = sub {
|
||||||
|
my ($enable) = @_;
|
||||||
|
$self->{btn_export_gcode}->Enable($enable);
|
||||||
|
$self->{btn_reslice}->Enable($enable);
|
||||||
|
$self->{btn_print}->Enable($enable);
|
||||||
|
$self->{btn_send_gcode}->Enable($enable);
|
||||||
|
$self->{btn_export_stl}->Enable($enable);
|
||||||
|
};
|
||||||
|
|
||||||
# Initialize 3D plater
|
# Initialize 3D plater
|
||||||
if ($Slic3r::GUI::have_OpenGL) {
|
if ($Slic3r::GUI::have_OpenGL) {
|
||||||
$self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{print}, $self->{config});
|
$self->{canvas3D} = Slic3r::GUI::Plater::3D->new($self->{preview_notebook}, $self->{objects}, $self->{model}, $self->{print}, $self->{config});
|
||||||
@ -113,6 +123,7 @@ sub new {
|
|||||||
$self->{canvas3D}->set_on_decrease_objects(sub { $self->decrease() });
|
$self->{canvas3D}->set_on_decrease_objects(sub { $self->decrease() });
|
||||||
$self->{canvas3D}->set_on_remove_object(sub { $self->remove() });
|
$self->{canvas3D}->set_on_remove_object(sub { $self->remove() });
|
||||||
$self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
$self->{canvas3D}->set_on_instances_moved($on_instances_moved);
|
||||||
|
$self->{canvas3D}->set_on_enable_action_buttons($enable_action_buttons);
|
||||||
$self->{canvas3D}->use_plain_shader(1);
|
$self->{canvas3D}->use_plain_shader(1);
|
||||||
$self->{canvas3D}->set_on_wipe_tower_moved(sub {
|
$self->{canvas3D}->set_on_wipe_tower_moved(sub {
|
||||||
my ($new_pos_3f) = @_;
|
my ($new_pos_3f) = @_;
|
||||||
|
@ -12,7 +12,7 @@ use Wx::Locale gettext => 'L';
|
|||||||
|
|
||||||
__PACKAGE__->mk_accessors(qw(
|
__PACKAGE__->mk_accessors(qw(
|
||||||
on_arrange on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
|
on_arrange on_rotate_object_left on_rotate_object_right on_scale_object_uniformly
|
||||||
on_remove_object on_increase_objects on_decrease_objects));
|
on_remove_object on_increase_objects on_decrease_objects on_enable_action_buttons));
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my $class = shift;
|
my $class = shift;
|
||||||
@ -176,6 +176,11 @@ sub set_on_model_update {
|
|||||||
$self->on_model_update($cb);
|
$self->on_model_update($cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub set_on_enable_action_buttons {
|
||||||
|
my ($self, $cb) = @_;
|
||||||
|
$self->on_enable_action_buttons($cb);
|
||||||
|
}
|
||||||
|
|
||||||
sub reload_scene {
|
sub reload_scene {
|
||||||
my ($self, $force) = @_;
|
my ($self, $force) = @_;
|
||||||
|
|
||||||
@ -217,10 +222,12 @@ sub reload_scene {
|
|||||||
if (!$self->{model}->fits_print_volume($self->{config})) {
|
if (!$self->{model}->fits_print_volume($self->{config})) {
|
||||||
$self->set_warning_enabled(1);
|
$self->set_warning_enabled(1);
|
||||||
Slic3r::GUI::_3DScene::generate_warning_texture(L("Detected object outside print volume"));
|
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 {
|
} else {
|
||||||
$self->set_warning_enabled(0);
|
$self->set_warning_enabled(0);
|
||||||
$self->volumes->update_outside_state($self->{config}, 1);
|
$self->volumes->update_outside_state($self->{config}, 1);
|
||||||
Slic3r::GUI::_3DScene::reset_warning_texture();
|
Slic3r::GUI::_3DScene::reset_warning_texture();
|
||||||
|
$self->on_enable_action_buttons->(1) if ($self->on_enable_action_buttons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user