CutGizmo: Respect to the SLA shift

This commit is contained in:
YuSanka 2023-03-22 12:36:32 +01:00
parent ddf636fe38
commit 760f74ce6a

View file

@ -876,6 +876,7 @@ void GLGizmoCut3D::on_set_state()
}
m_selected.clear();
m_parent.set_use_color_clip_plane(false);
m_c->selection_info()->set_use_shift(false);
}
}
@ -1239,7 +1240,10 @@ BoundingBoxf3 GLGizmoCut3D::transformed_bounding_box(const Vec3d& plane_center,
{
const Selection& selection = m_parent.get_selection();
const Vec3d& instance_offset = selection.get_first_volume()->get_instance_offset();
const auto first_volume = selection.get_first_volume();
Vec3d instance_offset = first_volume->get_instance_offset();
instance_offset[Z] += first_volume->get_sla_shift_z();
const auto cut_matrix = Transform3d::Identity() * rotation_m.inverse() * translation_transform(instance_offset - plane_center);
const Selection::IndicesList& idxs = selection.get_volume_idxs();
@ -1357,6 +1361,12 @@ void GLGizmoCut3D::render_clipper_cut()
void GLGizmoCut3D::on_render()
{
if (m_state == On) {
// This gizmo is showing the object elevated. Tell the common
// SelectionInfo object to lie about the actual shift.
m_c->selection_info()->set_use_shift(true);
}
update_clipper();
init_picking_models();