From 599fc84e98cb69e09586ada4ab9143e342bebcb3 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Wed, 18 May 2022 09:11:20 +0200 Subject: [PATCH] Tech ENABLE_TRANSFORMATIONS_BY_MATRICES - Implemented reset skew button for the case when volume world matrix contains skew while volume and instance matrices do not --- src/slic3r/GUI/Selection.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 395201af93..ca23154987 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1418,7 +1418,13 @@ void Selection::reset_skew() const VolumeCache& volume_data = m_cache.volumes_data[i]; const Geometry::Transformation& inst_trafo = volume_data.get_instance_transform(); const Geometry::Transformation& vol_trafo = volume_data.get_volume_transform(); - if (m_mode == Instance && inst_trafo.has_skew()) { + const Geometry::Transformation world_trafo = inst_trafo * vol_trafo; + if (!inst_trafo.has_skew() && !vol_trafo.has_skew() && world_trafo.has_skew()) { + Geometry::Transformation mod_world_trafo = Geometry::Transformation(world_trafo.get_matrix_no_offset()); + mod_world_trafo.reset_skew(); + v.set_volume_transformation(vol_trafo.get_offset_matrix() * inst_trafo.get_matrix_no_offset().inverse() * mod_world_trafo.get_matrix()); + } + else if (m_mode == Instance && inst_trafo.has_skew()) { Geometry::Transformation trafo = inst_trafo; trafo.reset_skew(); v.set_instance_transformation(trafo); @@ -1428,19 +1434,6 @@ void Selection::reset_skew() trafo.reset_skew(); v.set_volume_transformation(trafo); } - else { - const Geometry::Transformation world_trafo = inst_trafo * vol_trafo; - if (world_trafo.has_skew()) { - if (m_mode == Instance) { - // TODO - int a = 0; - } - else { - // TODO - int a = 0; - } - } - } } ensure_on_bed();