From a9e8dcf10f3d8b24bf5e5ac94efe2ab42e9fd909 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 31 Jan 2023 13:22:43 +0100 Subject: [PATCH] Remove duplicate 'last_completed_step()' method --- src/slic3r/GUI/Gizmos/GLGizmoSlaBase.cpp | 12 +----------- src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp | 2 -- src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.cpp index 444e3bf46..025cb2627 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.cpp @@ -62,7 +62,7 @@ void GLGizmoSlaBase::update_volumes() new_volume->set_instance_transformation(po->model_object()->instances[m_parent.get_selection().get_instance_idx()]->get_transformation()); new_volume->set_sla_shift_z(po->get_current_elevation()); new_volume->mesh_raycaster = std::make_unique(backend_mesh); - m_input_enabled = last_completed_step(*m_c->selection_info()->print_object()->print()) >= m_min_sla_print_object_step; + m_input_enabled = po->last_completed_step() >= m_min_sla_print_object_step; if (m_input_enabled) new_volume->selected = true; // to set the proper color else @@ -127,16 +127,6 @@ void GLGizmoSlaBase::unregister_volume_raycasters_for_picking() m_volume_raycasters.clear(); } -int GLGizmoSlaBase::last_completed_step(const SLAPrint& sla) -{ - int step = -1; - for (int i = 0; i < (int)SLAPrintObjectStep::slaposCount; ++i) { - if (sla.is_step_done((SLAPrintObjectStep)i)) - ++step; - } - return step; -} - // Unprojects the mouse position on the mesh and saves hit point and normal of the facet into pos_and_normal // Return false if no intersection was found, true otherwise. bool GLGizmoSlaBase::unproject_on_mesh(const Vec2d& mouse_pos, std::pair& pos_and_normal) diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp index 9b5e9f469..438477598 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaBase.hpp @@ -38,8 +38,6 @@ protected: bool is_input_enabled() const { return m_input_enabled; } int get_min_sla_print_object_step() const { return m_min_sla_print_object_step; } - static int last_completed_step(const SLAPrint& sla); - bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair& pos_and_normal); const GLVolumeCollection &volumes() const { return m_volumes; } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp index 4b449b3cc..0bab4020a 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoSlaSupports.cpp @@ -66,7 +66,7 @@ void GLGizmoSlaSupports::data_changed() m_c->instances_hider()->set_hide_full_scene(true); const SLAPrintObject* po = m_c->selection_info()->print_object(); const int required_step = get_min_sla_print_object_step(); - if (po != nullptr && last_completed_step(*po->print()) < required_step) + if (po != nullptr && po->last_completed_step() < required_step) reslice_until_step((SLAPrintObjectStep)required_step, false); update_volumes();