From f6f27b700f0305854fcdbcb1191af25a4b8bdbe4 Mon Sep 17 00:00:00 2001 From: "zhou.xu" Date: Mon, 25 Dec 2023 14:28:19 +0800 Subject: [PATCH] FIX:arrow direction in scaling tool is incorrect Jira: STUDIO-5672 Change-Id: I82c0ab336805e34c8380f93e64d3b9dbbf283805 --- .../GUI/Gizmos/GizmoObjectManipulation.cpp | 26 +++++-------------- src/slic3r/GUI/Selection.cpp | 2 +- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index 2cdd8aac3..d7e1b8a34 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -444,28 +444,14 @@ void GizmoObjectManipulation::reset_scale_value() change_scale_value(2, 100.); } -void GizmoObjectManipulation::set_uniform_scaling(const bool new_value) +void GizmoObjectManipulation::set_uniform_scaling(const bool use_uniform_scale) { - const Selection &selection = m_glcanvas.get_selection(); - if (selection.is_single_full_instance() && m_world_coordinates && !new_value) { - // Verify whether the instance rotation is multiples of 90 degrees, so that the scaling in world coordinates is possible. - // all volumes in the selection belongs to the same instance, any of them contains the needed instance data, so we take the first one - const GLVolume* volume = selection.get_volume(*selection.get_volume_idxs().begin()); - // Is the angle close to a multiple of 90 degrees? + if (!use_uniform_scale) + // Recalculate cached values at this panel, refresh the screen. + this->UpdateAndShow(true); - if (! Geometry::is_rotation_ninety_degrees(volume->get_instance_rotation())) { - // Cannot apply scaling in the world coordinate system. - // BBS: remove tilt prompt dialog - - // Bake the rotation into the meshes of the object. - wxGetApp().model().objects[volume->composite_id.object_id]->bake_xy_rotation_into_meshes(volume->composite_id.instance_id); - // Update the 3D scene, selections etc. - wxGetApp().plater()->update(); - // Recalculate cached values at this panel, refresh the screen. - this->UpdateAndShow(true); - } - } - m_uniform_scale = new_value; + m_uniform_scale = use_uniform_scale; + set_dirty(); } static const char* label_values[2][3] = { diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 54ae6b4a4..c0bcb57b5 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1644,7 +1644,7 @@ void Selection::render_sidebar_hints(const std::string& sidebar_field, bool unif glsafe(::glTranslated(center(0), center(1), center(2))); if (!boost::starts_with(sidebar_field, "position")) { Transform3d orient_matrix = Transform3d::Identity(); - if (boost::starts_with(sidebar_field, "scale")) + if (boost::starts_with(sidebar_field, "scale") || boost::starts_with(sidebar_field, "size")) orient_matrix = (*m_volumes)[*m_list.begin()]->get_instance_transformation().get_matrix(true, false, true, true); else if (boost::starts_with(sidebar_field, "rotation")) { if (boost::ends_with(sidebar_field, "x"))