Merge branch 'dev' into lm_sla_supports_ui

This commit is contained in:
Lukas Matena 2018-09-12 10:04:57 +02:00
commit ccf27ae1f3
17 changed files with 638 additions and 261 deletions

View file

@ -154,16 +154,15 @@ sub new {
};
# callback to react to gizmo rotate
# omitting last three parameters means rotation around Z
# otherwise they are the components of the rotation axis vector
my $on_gizmo_rotate = sub {
my ($angle) = @_;
$self->rotate(rad2deg($angle), Z, 'absolute');
};
# callback to react to gizmo flatten
my $on_gizmo_flatten = sub {
my ($angle, $axis_x, $axis_y, $axis_z) = @_;
if (!defined $axis_x) {
$self->rotate(rad2deg($angle), Z, 'absolute');
}
else {
$self->rotate(rad2deg($angle), undef, 'absolute', $axis_x, $axis_y, $axis_z) if $angle != 0;
}
$self->rotate(rad2deg($angle), undef, 'absolute', $axis_x, $axis_y, $axis_z) if $angle != 0;
};
# callback to update object's geometry info while using gizmos
@ -264,6 +263,7 @@ sub new {
Slic3r::GUI::_3DScene::register_on_enable_action_buttons_callback($self->{canvas3D}, $enable_action_buttons);
Slic3r::GUI::_3DScene::register_on_gizmo_scale_uniformly_callback($self->{canvas3D}, $on_gizmo_scale_uniformly);
Slic3r::GUI::_3DScene::register_on_gizmo_rotate_callback($self->{canvas3D}, $on_gizmo_rotate);
Slic3r::GUI::_3DScene::register_on_gizmo_flatten_callback($self->{canvas3D}, $on_gizmo_flatten);
Slic3r::GUI::_3DScene::register_on_update_geometry_info_callback($self->{canvas3D}, $on_update_geometry_info);
Slic3r::GUI::_3DScene::register_action_add_callback($self->{canvas3D}, $on_action_add);
Slic3r::GUI::_3DScene::register_action_delete_callback($self->{canvas3D}, $on_action_delete);
@ -880,6 +880,15 @@ sub load_files {
$model->convert_multipart_object(scalar(@$nozzle_dmrs)) if $dialog->ShowModal() == wxID_YES;
}
# objects imported from 3mf require a call to center_around_origin to have gizmos working properly and this call
# need to be done after looks_like_multipart_object detection
if ($input_file =~ /.3[mM][fF]$/)
{
foreach my $model_object (@{$model->objects}) {
$model_object->center_around_origin; # also aligns object to Z = 0
}
}
if ($one_by_one) {
push @obj_idx, $self->load_model_objects(@{$model->objects});
} else {