From fd9f2d84504edb9174cd89ecf0420cb719d2bed6 Mon Sep 17 00:00:00 2001 From: Ian Bassi Date: Tue, 17 Nov 2026 22:10:12 -0300 Subject: [PATCH] Undo changes to the dovetail count and gap The cut tool's undo state held the dovetail shape but not the number of dovetails or the gap between them, so undo left both as they were. Changing the count with its buttons did not take a snapshot either. Save both in the state and take a snapshot when the count changes. Ported from Snapmaker/OrcaSlicer@b070bcfaffcf93aaa04dff8fe97da3ee8dbd68bb Co-authored-by: mwz-iot --- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index a4bba20f8b..90680a1605 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -1426,10 +1426,13 @@ void GLGizmoCut3D::on_load(cereal::BinaryInputArchive& ar) float groove_angle; float groove_depth_tolerance; float groove_width_tolerance; + int groove_count; + float groove_gap; ar( m_keep_upper, m_keep_lower, m_rotate_lower, m_rotate_upper, m_hide_cut_plane, mode, m_connectors_editing, m_ar_plane_center, m_rotation_m, - groove_depth, groove_width, groove_flaps_angle, groove_angle, groove_depth_tolerance, groove_width_tolerance); + groove_depth, groove_width, groove_flaps_angle, groove_angle, groove_depth_tolerance, groove_width_tolerance, + groove_count, groove_gap); m_start_dragging_m = m_rotation_m; @@ -1444,7 +1447,9 @@ void GLGizmoCut3D::on_load(cereal::BinaryInputArchive& ar) !is_approx(m_groove.flaps_angle , groove_flaps_angle) || !is_approx(m_groove.angle , groove_angle) || !is_approx(m_groove.depth_tolerance, groove_depth_tolerance) || - !is_approx(m_groove.width_tolerance, groove_width_tolerance) ) + !is_approx(m_groove.width_tolerance, groove_width_tolerance) || + m_groove_count != groove_count || + !is_approx(m_groove_gap, groove_gap) ) { m_groove.depth = groove_depth; m_groove.width = groove_width; @@ -1452,6 +1457,8 @@ void GLGizmoCut3D::on_load(cereal::BinaryInputArchive& ar) m_groove.angle = groove_angle; m_groove.depth_tolerance= groove_depth_tolerance; m_groove.width_tolerance= groove_width_tolerance; + m_groove_count = groove_count; + m_groove_gap = groove_gap; update_plane_model(); } reset_cut_by_contours(); @@ -1464,7 +1471,8 @@ void GLGizmoCut3D::on_save(cereal::BinaryOutputArchive& ar) const { ar( m_keep_upper, m_keep_lower, m_rotate_lower, m_rotate_upper, m_hide_cut_plane, m_mode, m_connectors_editing, m_ar_plane_center, m_start_dragging_m, - m_groove.depth, m_groove.width, m_groove.flaps_angle, m_groove.angle, m_groove.depth_tolerance, m_groove.width_tolerance); + m_groove.depth, m_groove.width, m_groove.flaps_angle, m_groove.angle, m_groove.depth_tolerance, m_groove.width_tolerance, + m_groove_count, m_groove_gap); } std::string GLGizmoCut3D::on_get_name() const @@ -2798,6 +2806,8 @@ void GLGizmoCut3D::render_groove_int_input(const std::string& label, int& in_val val = std::clamp(val, min_val, max_val); // ORCA Holding +/- at the limit clamps back to the same value, don't rebuild for that. if (val != in_val) { + Plater::TakeSnapshot snapshot(wxGetApp().plater(), GUI::format("%1%: %2%", _u8L("Groove change"), label), + UndoRedo::SnapshotType::GizmoAction); in_val = val; is_changed = true; }