diff --git a/src/slic3r/GUI/GUI_ObjectList.cpp b/src/slic3r/GUI/GUI_ObjectList.cpp index 15367a2fb..099353157 100644 --- a/src/slic3r/GUI/GUI_ObjectList.cpp +++ b/src/slic3r/GUI/GUI_ObjectList.cpp @@ -1977,6 +1977,30 @@ void ObjectList::load_generic_subobject(const std::string& type_name, const Mode // update printable state on canvas wxGetApp().plater()->canvas3D()->update_instance_printable_state_for_object((size_t)obj_idx); + // apply the instance transform to all volumes and reset instance transform except the offset + { + const Geometry::Transformation &instance_transformation = model_object.instances[0]->get_transformation(); + Vec3d original_instance_center = instance_transformation.get_offset(); + + const Transform3d &transformation_matrix = instance_transformation.get_matrix(); + for (ModelVolume *volume : model_object.volumes) { + const Transform3d &volume_matrix = volume->get_matrix(); + Transform3d new_matrix = transformation_matrix * volume_matrix; + volume->set_transformation(new_matrix); + } + model_object.instances[0]->set_transformation(Geometry::Transformation()); + + model_object.ensure_on_bed(); + // keep new instance center the same as the original center + model_object.translate(-original_instance_center); + model_object.origin_translation += original_instance_center; + model_object.translate_instances(model_object.origin_translation); + model_object.origin_translation = Vec3d::Zero(); + + // update the cache data in selection to keep the data of ModelVolume and GLVolume are consistent + wxGetApp().plater()->update(); + } + selection_changed(); //BBS: notify partplate the modify diff --git a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp index 5b7dbe2f4..b8653f5d6 100644 --- a/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp +++ b/src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp @@ -98,7 +98,7 @@ void GizmoObjectManipulation::update_settings_value(const Selection& selection) if (m_world_coordinates) { m_new_rotate_label_string = L("Rotate"); - m_new_rotation = Vec3d::Zero(); + m_new_rotation = volume->get_instance_rotation() * (180. / M_PI); m_new_size = selection.get_scaled_instance_bounding_box().size(); m_new_scale = m_new_size.cwiseProduct(selection.get_unscaled_instance_bounding_box().size().cwiseInverse()) * 100.; }