From 190a4cde48df9f167468f37d1a95f36bb7f24fa8 Mon Sep 17 00:00:00 2001 From: YuSanka Date: Tue, 8 Aug 2023 10:25:26 +0200 Subject: [PATCH] CutGizmo: Next bug fixing * Fixed a crash on UndoRedo action when switching between cut modes * Fixed update of the CutGizmo parameters when selected object is changed --- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 5a4637b126..55d57f7178 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -507,7 +507,6 @@ void GLGizmoCut3D::switch_to_mode(size_t new_mode) if (m_use_TAG_mesh) update_plane_model(); reset_cut_by_contours(); - update_clipper(); } bool GLGizmoCut3D::render_cut_mode_combo() @@ -1572,7 +1571,6 @@ void GLGizmoCut3D::on_set_state() { if (m_state == On) { m_parent.set_use_color_clip_plane(true); - apply_color_clip_plane_colors(); update_bb(); m_connectors_editing = !m_selected.empty(); @@ -2065,8 +2063,14 @@ void GLGizmoCut3D::update_bb() m_bounding_box = box; + // check, if mode is set to Planar, when object has a connectors + if (const int object_idx = m_parent.get_selection().get_object_idx(); + object_idx >= 0 && !wxGetApp().plater()->model().objects[object_idx]->cut_connectors.empty()) + m_mode = size_t(CutMode::cutPlanar); + invalidate_cut_plane(); reset_cut_by_contours(); + apply_color_clip_plane_colors(); m_max_pos = box.max; m_min_pos = box.min; @@ -2077,6 +2081,8 @@ void GLGizmoCut3D::update_bb() else set_center_pos(m_bb_center); + m_contour_width = CutMode(m_mode) == CutMode::cutTongueAndGroove ? 0.f : 0.4f; + m_radius = box.radius(); m_grabber_connection_len = 0.5 * m_radius;// std::min(0.75 * m_radius, 35.0); m_grabber_radius = m_grabber_connection_len * 0.85; @@ -2107,8 +2113,6 @@ void GLGizmoCut3D::update_bb() if (CommonGizmosDataObjects::SelectionInfo* selection = m_c->selection_info(); selection && selection->model_object()) m_selected.resize(selection->model_object()->cut_connectors.size(), false); - -// reset_cut_by_contours(); } }