From d6b409d0d98bacffb67e9f1f81731726f144a283 Mon Sep 17 00:00:00 2001 From: bubnikv Date: Thu, 14 Mar 2019 15:11:27 +0100 Subject: [PATCH] Update the SLA slices at the print preview once the index is calculated. --- src/libslic3r/PrintBase.hpp | 1 + src/libslic3r/SLAPrint.cpp | 5 ++++- src/slic3r/GUI/Plater.cpp | 10 ++++++++-- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index e01b678a5..2d47d3567 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -272,6 +272,7 @@ public: NO_RELOAD_SCENE = 0, RELOAD_SCENE = 1 << 1, RELOAD_SLA_SUPPORT_POINTS = 1 << 2, + RELOAD_SLA_PREVIEW = 1 << 3, }; // Bitmap of FlagBits unsigned int flags; diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index b6c8aad13..52f1e032b 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -821,7 +821,7 @@ void SLAPrint::process() // We have the layer polygon collection but we need to unite them into // an index where the key is the height level in discrete levels (clipper) - auto index_slices = [ilhd](SLAPrintObject& po) { + auto index_slices = [this, ilhd](SLAPrintObject& po) { po.m_slice_index.clear(); auto sih = LevelID(scale_(ilhd)); @@ -890,6 +890,9 @@ void SLAPrint::process() sr.support_slices_idx = SLAPrintObject::SliceRecord::Idx(i); } } + + // Using RELOAD_SLA_PREVIEW to tell the Plater to pass the update status to the 3D preview to load the SLA slices. + report_status(*this, -2, "", SlicingStatus::RELOAD_SLA_PREVIEW); }; // Rasterizing the model objects, and their supports diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 64d189859..601c2ddb6 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2434,8 +2434,10 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt) void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) { - this->statusbar()->set_progress(evt.status.percent); - this->statusbar()->set_status_text(_(L(evt.status.text)) + wxString::FromUTF8("…")); + if (evt.status.percent >= -1) { + this->statusbar()->set_progress(evt.status.percent); + this->statusbar()->set_status_text(_(L(evt.status.text)) + wxString::FromUTF8("…")); + } if (evt.status.flags & PrintBase::SlicingStatus::RELOAD_SCENE) { switch (this->printer_technology) { case ptFFF: @@ -2453,6 +2455,10 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt) // Update SLA gizmo (reload_scene calls update_gizmos_data) q->canvas3D()->reload_scene(true); } + if (evt.status.flags & PrintBase::SlicingStatus::RELOAD_SLA_PREVIEW) { + // Update the SLA preview + this->preview->reload_print(); + } } void Plater::priv::on_slicing_completed(wxCommandEvent &)