From 70af837b553a4494ec8a41aa445233ce02f54080 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Tue, 13 Dec 2022 15:10:42 +0100 Subject: [PATCH] Follow-up of 0aa88e1deae128c4d0ec7b62ac0cbf2b758f79cc --- src/slic3r/GUI/GUI_ObjectManipulation.cpp | 33 +++++++++-------------- src/slic3r/GUI/Selection.cpp | 2 +- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/slic3r/GUI/GUI_ObjectManipulation.cpp b/src/slic3r/GUI/GUI_ObjectManipulation.cpp index 7a5167d4a..a13206cbf 100644 --- a/src/slic3r/GUI/GUI_ObjectManipulation.cpp +++ b/src/slic3r/GUI/GUI_ObjectManipulation.cpp @@ -1221,36 +1221,29 @@ void ObjectManipulation::change_size_value(int axis, double value) Vec3d ref_size = m_cache.size; #if ENABLE_WORLD_COORDINATE if (selection.is_single_volume_or_modifier()) { + size = size.cwiseQuotient(ref_size); + ref_size = Vec3d::Ones(); #else if (selection.is_single_volume() || selection.is_single_modifier()) { -#endif // ENABLE_WORLD_COORDINATE + const GLVolume* v = selection.get_first_volume(); + const Vec3d local_size = size.cwiseQuotient(v->get_instance_scaling_factor()); + const Vec3d local_ref_size = v->bounding_box().size().cwiseProduct(v->get_volume_scaling_factor()); + const Vec3d local_change = local_size.cwiseQuotient(local_ref_size); -#if ENABLE_WORLD_COORDINATE - if (is_world_coordinates()) { - size = size.cwiseQuotient(ref_size); - ref_size = Vec3d::Ones(); - } - else { -#endif // ENABLE_WORLD_COORDINATE - const GLVolume* v = selection.get_first_volume(); - const Vec3d local_size = size.cwiseQuotient(v->get_instance_scaling_factor()); - const Vec3d local_ref_size = v->bounding_box().size().cwiseProduct(v->get_volume_scaling_factor()); - const Vec3d local_change = local_size.cwiseQuotient(local_ref_size); - - size = local_change.cwiseProduct(v->get_volume_scaling_factor()); - ref_size = Vec3d::Ones(); -#if ENABLE_WORLD_COORDINATE - } + size = local_change.cwiseProduct(v->get_volume_scaling_factor()); + ref_size = Vec3d::Ones(); #endif // ENABLE_WORLD_COORDINATE } - else if (selection.is_single_full_instance()) + else if (selection.is_single_full_instance()) { #if ENABLE_WORLD_COORDINATE - ref_size = is_world_coordinates() ? + size = size.cwiseQuotient(ref_size); + ref_size = Vec3d::Ones(); #else ref_size = m_world_coordinates ? -#endif // ENABLE_WORLD_COORDINATE selection.get_unscaled_instance_bounding_box().size() : wxGetApp().model().objects[selection.get_first_volume()->object_idx()]->raw_mesh_bounding_box().size(); +#endif // ENABLE_WORLD_COORDINATE + } #if ENABLE_WORLD_COORDINATE this->do_size(axis, size.cwiseQuotient(ref_size)); diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 98993907d..5705ffafc 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1356,7 +1356,7 @@ void Selection::scale_and_translate(const Vec3d& scale, const Vec3d& translation else if (transformation_type.world()) original_box = get_bounding_box(); else if (transformation_type.instance()) - original_box = v.transformed_convex_hull_bounding_box(volume_data.get_volume_transform().get_matrix_no_scaling_factor()); + original_box = v.transformed_convex_hull_bounding_box(volume_data.get_volume_transform().get_matrix()); else original_box = v.bounding_box(); }