From 3cf6d1c8889689b8662ba77aab4f913cba8b876b Mon Sep 17 00:00:00 2001 From: Lukas Matena <lukasmatena@seznam.cz> Date: Wed, 18 Aug 2021 11:17:41 +0200 Subject: [PATCH] Revert 740067c and e645f4a 740067c: "Fixed cut contours in gizmo cut after deleting an object" e645f4a: "Fixed cut contours after cutting an object in gizmo cut" --- src/slic3r/GUI/3DScene.cpp | 2 +- src/slic3r/GUI/Gizmos/GLGizmoCut.cpp | 16 +++------------- src/slic3r/GUI/Gizmos/GLGizmoCut.hpp | 10 ---------- 3 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index 9c0341ff4..8ef333d69 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -306,7 +306,7 @@ void GLVolume::SinkingContours::update() int object_idx = m_parent.object_idx(); Model& model = GUI::wxGetApp().plater()->model(); - if (0 <= object_idx && object_idx < (int)model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) { + if (0 <= object_idx && object_idx < model.objects.size() && m_parent.is_sinking() && !m_parent.is_below_printbed()) { const BoundingBoxf3& box = m_parent.transformed_convex_hull_bounding_box(); if (!m_old_box.size().isApprox(box.size()) || m_old_box.min.z() != box.min.z()) { m_old_box = box; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp index 40654422e..707726e08 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.cpp @@ -55,15 +55,8 @@ std::string GLGizmoCut::on_get_name() const void GLGizmoCut::on_set_state() { // Reset m_cut_z on gizmo activation -#if ENABLE_SINKING_CONTOURS - if (get_state() == On) { - m_cut_z = bounding_box().center().z(); - m_cut_contours.reset(); - } -#else if (get_state() == On) m_cut_z = bounding_box().center().z(); -#endif // ENABLE_SINKING_CONTOURS } bool GLGizmoCut::on_is_activable() const @@ -216,12 +209,8 @@ void GLGizmoCut::on_render_input_window(float x, float y, float bottom_limit) m_imgui->end(); - if (cut_clicked && (m_keep_upper || m_keep_lower)) { + if (cut_clicked && (m_keep_upper || m_keep_lower)) perform_cut(m_parent.get_selection()); -#if ENABLE_SINKING_CONTOURS - m_cut_contours.reset(); -#endif // ENABLE_SINKING_CONTOURS - } } void GLGizmoCut::set_cut_z(double cut_z) @@ -319,8 +308,9 @@ void GLGizmoCut::update_contours() m_cut_contours.contours.set_color(-1, { 1.0f, 1.0f, 1.0f, 1.0f }); } } - else if (box.center() != m_cut_contours.position) + else if (box.center() != m_cut_contours.position) { m_cut_contours.shift = box.center() - m_cut_contours.position; + } } else m_cut_contours.contours.reset(); diff --git a/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp b/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp index ffea14ad4..abd879350 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoCut.hpp @@ -35,16 +35,6 @@ class GLGizmoCut : public GLGizmoBase Vec3d shift{ Vec3d::Zero() }; int object_idx{ -1 }; int instance_idx{ -1 }; - - void reset() { - mesh.clear(); - contours.reset(); - cut_z = 0.0; - position = Vec3d::Zero(); - shift = Vec3d::Zero(); - object_idx = -1; - instance_idx = -1; - } }; CutContours m_cut_contours;