Fixed update of sequential printing clearance contours after deleting an object

This commit is contained in:
enricoturri1966 2023-05-15 12:35:25 +02:00
parent beabf5d652
commit 568dc2a0e8
4 changed files with 14 additions and 8 deletions

View File

@ -966,7 +966,8 @@ void GLCanvas3D::SequentialPrintClearance::render()
glsafe(::glEnable(GL_BLEND)); glsafe(::glEnable(GL_BLEND));
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)); 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 ENABLE_GL_CORE_PROFILE
if (OpenGLManager::get_gl_info().is_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) { for (const auto& [id, trafo] : m_instances) {
shader->set_uniform("view_model_matrix", camera.get_view_matrix() * trafo); shader->set_uniform("view_model_matrix", camera.get_view_matrix() * trafo);
assert(id < m_contours.size()); 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(); m_contours[id].render();
} }

View File

@ -987,6 +987,7 @@ public:
} }
void update_sequential_clearance(bool force_contours_generation); 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 Print* fff_print() const;
const SLAPrint* sla_print() const; const SLAPrint* sla_print() const;

View File

@ -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); sidebar->obj_list()->invalidate_cut_info_for_object(obj_idx);
model.delete_object(obj_idx); model.delete_object(obj_idx);
update(); update();
object_list_changed(); object_list_changed();
return true; return true;
} }
@ -3255,7 +3257,7 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
if (view3D->is_layers_editing_enabled()) if (view3D->is_layers_editing_enabled())
view3D->get_wxglcanvas()->Refresh(); view3D->get_wxglcanvas()->Refresh();
if (background_process.empty()) if (invalidated == Print::APPLY_STATUS_CHANGED || background_process.empty())
view3D->get_canvas3d()->reset_sequential_print_clearance(); view3D->get_canvas3d()->reset_sequential_print_clearance();
if (invalidated == Print::APPLY_STATUS_INVALIDATED) { 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); process_validation_warning(warning);
if (printer_technology == ptFFF) { if (printer_technology == ptFFF) {
GLCanvas3D* canvas = view3D->get_canvas3d(); GLCanvas3D* canvas = view3D->get_canvas3d();
if (canvas->is_sequential_print_clearance_evaluating()) { canvas->reset_sequential_print_clearance();
canvas->reset_sequential_print_clearance(); canvas->set_as_dirty();
canvas->set_as_dirty(); canvas->request_extra_frame();
canvas->request_extra_frame();
}
} }
} }
else { else {
@ -3313,6 +3313,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
GLCanvas3D::ContoursList contours; GLCanvas3D::ContoursList contours;
contours.contours = background_process.fff_print()->get_sequential_print_clearance_contours(); contours.contours = background_process.fff_print()->get_sequential_print_clearance_contours();
canvas->set_sequential_print_clearance_contours(contours, true); canvas->set_sequential_print_clearance_contours(contours, true);
canvas->set_as_dirty();
canvas->request_extra_frame();
} }
} }
} }

View File

@ -1538,6 +1538,8 @@ void Selection::erase()
wxGetApp().obj_list()->delete_from_model_and_list(items); wxGetApp().obj_list()->delete_from_model_and_list(items);
ensure_not_below_bed(); ensure_not_below_bed();
} }
wxGetApp().plater()->canvas3D()->set_sequential_clearance_as_evaluating();
} }
void Selection::render(float scale_factor) void Selection::render(float scale_factor)