From 617c163bd634580e27c85fe49445f408d6105470 Mon Sep 17 00:00:00 2001 From: Filip Sykala - NTB T15p Date: Tue, 31 Jan 2023 19:23:09 +0100 Subject: [PATCH] Write result transformation into all gl_volumes --- src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp index 663aafc77..32dc65e9b 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp @@ -547,11 +547,25 @@ bool GLGizmoEmboss::on_mouse_for_translate(const wxMouseEvent &mouse_event) // with Mesa driver OR on Linux if (!m_temp_transformation.has_value()) return false; + int instance_idx = m_parent.get_selection().get_instance_idx(); + const auto &instances = m_volume->get_object()->instances; + if (instance_idx < 0 || instance_idx >= instances.size()) + return false; + // Override of common transformation after draggig by set transformation into gl_volume - Transform3d volume_trmat = - gl_volume->get_instance_transformation().get_matrix().inverse() * + Transform3d volume_trmat = + instances[instance_idx]->get_matrix().inverse() * *m_temp_transformation; - gl_volume->set_volume_transformation(Geometry::Transformation(volume_trmat)); + + // ReWrite transformation inside of all instances + Geometry::Transformation transformation(volume_trmat); + for (GLVolume *vol : m_parent.get_volumes().volumes) { + if (vol->object_idx() != gl_volume->object_idx() || + vol->volume_idx() != gl_volume->volume_idx()) + continue; + vol->set_volume_transformation(transformation); + } + m_parent.toggle_model_objects_visibility(true); // Apply temporary position m_temp_transformation = {};