From 568dc2a0e8b1eaec9b7198df67f976194010cad4 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Mon, 15 May 2023 12:35:25 +0200 Subject: [PATCH] Fixed update of sequential printing clearance contours after deleting an object --- src/slic3r/GUI/GLCanvas3D.cpp | 5 +++-- src/slic3r/GUI/GLCanvas3D.hpp | 1 + src/slic3r/GUI/Plater.cpp | 14 ++++++++------ src/slic3r/GUI/Selection.cpp | 2 ++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index 812c75a33..b4ce7fbff 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -966,7 +966,8 @@ void GLCanvas3D::SequentialPrintClearance::render() glsafe(::glEnable(GL_BLEND)); glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); - m_fill.render(); + if (!m_evaluating) + m_fill.render(); #if ENABLE_GL_CORE_PROFILE if (OpenGLManager::get_gl_info().is_core_profile()) { @@ -990,7 +991,7 @@ void GLCanvas3D::SequentialPrintClearance::render() for (const auto& [id, trafo] : m_instances) { shader->set_uniform("view_model_matrix", camera.get_view_matrix() * trafo); assert(id < m_contours.size()); - m_contours[id].set_color(m_fill.is_initialized() ? FILL_COLOR : m_evaluating ? NO_FILL_EVALUATING_COLOR : NO_FILL_COLOR); + m_contours[id].set_color((!m_evaluating && m_fill.is_initialized()) ? FILL_COLOR : m_evaluating ? NO_FILL_EVALUATING_COLOR : NO_FILL_COLOR); m_contours[id].render(); } diff --git a/src/slic3r/GUI/GLCanvas3D.hpp b/src/slic3r/GUI/GLCanvas3D.hpp index 7e8cc5d25..ef4b0c76c 100644 --- a/src/slic3r/GUI/GLCanvas3D.hpp +++ b/src/slic3r/GUI/GLCanvas3D.hpp @@ -987,6 +987,7 @@ public: } void update_sequential_clearance(bool force_contours_generation); + void set_sequential_clearance_as_evaluating() { m_sequential_print_clearance.m_evaluating = true; } const Print* fff_print() const; const SLAPrint* sla_print() const; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 5bfc60ea0..18f63a3aa 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -3057,8 +3057,10 @@ bool Plater::priv::delete_object_from_model(size_t obj_idx) sidebar->obj_list()->invalidate_cut_info_for_object(obj_idx); model.delete_object(obj_idx); + update(); object_list_changed(); + return true; } @@ -3255,7 +3257,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool if (view3D->is_layers_editing_enabled()) view3D->get_wxglcanvas()->Refresh(); - if (background_process.empty()) + if (invalidated == Print::APPLY_STATUS_CHANGED || background_process.empty()) view3D->get_canvas3d()->reset_sequential_print_clearance(); if (invalidated == Print::APPLY_STATUS_INVALIDATED) { @@ -3295,11 +3297,9 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool process_validation_warning(warning); if (printer_technology == ptFFF) { GLCanvas3D* canvas = view3D->get_canvas3d(); - if (canvas->is_sequential_print_clearance_evaluating()) { - canvas->reset_sequential_print_clearance(); - canvas->set_as_dirty(); - canvas->request_extra_frame(); - } + canvas->reset_sequential_print_clearance(); + canvas->set_as_dirty(); + canvas->request_extra_frame(); } } else { @@ -3313,6 +3313,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool GLCanvas3D::ContoursList contours; contours.contours = background_process.fff_print()->get_sequential_print_clearance_contours(); canvas->set_sequential_print_clearance_contours(contours, true); + canvas->set_as_dirty(); + canvas->request_extra_frame(); } } } diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index cbd61a1dd..cfd7233c2 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -1538,6 +1538,8 @@ void Selection::erase() wxGetApp().obj_list()->delete_from_model_and_list(items); ensure_not_below_bed(); } + + wxGetApp().plater()->canvas3D()->set_sequential_clearance_as_evaluating(); } void Selection::render(float scale_factor)