From 1a58513717072288936dc49e88920b1067d3d295 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Wed, 21 Nov 2018 12:10:10 +0100 Subject: [PATCH] Using the new status update interface to refresh scene right after the supports are ready. --- src/libslic3r/PrintBase.hpp | 4 +++- src/libslic3r/SLAPrint.cpp | 23 +++++++++++++++-------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/libslic3r/PrintBase.hpp b/src/libslic3r/PrintBase.hpp index dc3fb64e9..b61eedb9c 100644 --- a/src/libslic3r/PrintBase.hpp +++ b/src/libslic3r/PrintBase.hpp @@ -242,6 +242,8 @@ public: std::string text; // Bitmap of flags. enum FlagBits { + DEFAULT, + NO_RELOAD_SCENE = 0, RELOAD_SCENE = 1, }; // Bitmap of FlagBits @@ -255,7 +257,7 @@ public: // Register a custom status callback. void set_status_callback(status_callback_type cb) { m_status_callback = cb; } // Calls a registered callback to update the status, or print out the default message. - void set_status(int percent, const std::string &message, unsigned int flags = 0) { + void set_status(int percent, const std::string &message, unsigned int flags = SlicingStatus::DEFAULT) { if (m_status_callback) m_status_callback(SlicingStatus(percent, message, flags)); else printf("%d => %s\n", percent, message.c_str()); } diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index e3b012b7f..c8f6c1409 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -414,12 +414,13 @@ void SLAPrint::process() using slaposFn = std::function; using slapsFn = std::function; + // This is the actual order of steps done on each PrintObject std::array objectsteps = { - slaposObjectSlice, slaposSupportIslands, slaposSupportPoints, slaposSupportTree, slaposBasePool, + slaposObjectSlice, slaposSliceSupports }; @@ -445,21 +446,27 @@ void SLAPrint::process() const double ostepd = (max_objstatus - min_objstatus) / (objcount * 100.0); for(SLAPrintObject * po : m_objects) { - for(size_t s = 0; s < pobj_program.size(); ++s) { + for(size_t s = 0; s < objectsteps.size(); ++s) { auto currentstep = objectsteps[s]; + // if the base pool (which means also the support tree) is done, + // do a refresh when indicating progress + auto flg = currentstep == slaposObjectSlice ? + SlicingStatus::RELOAD_SCENE : SlicingStatus::DEFAULT; + // Cancellation checking. Each step will check for cancellation // on its own and return earlier gracefully. Just after it returns // execution gets to this point and throws the canceled signal. throw_if_canceled(); - if(po->m_stepmask[s] && !po->is_step_done(currentstep)) { + if(po->m_stepmask[currentstep] && !po->is_step_done(currentstep)) { + po->set_started(currentstep); + unsigned st = OBJ_STEP_LEVELS[currentstep]; st = unsigned(min_objstatus + st * ostepd); - set_status(st, OBJ_STEP_LABELS[currentstep]); + set_status(st, OBJ_STEP_LABELS[currentstep], flg); - po->set_started(currentstep); - pobj_program[s](*po); + pobj_program[currentstep](*po); po->set_done(currentstep); } } @@ -477,12 +484,12 @@ void SLAPrint::process() throw_if_canceled(); - if(m_stepmask[s] && !is_step_done(currentstep)) { + if(m_stepmask[currentstep] && !is_step_done(currentstep)) { set_status(PRINT_STEP_LEVELS[currentstep], PRINT_STEP_LABELS[currentstep]); set_started(currentstep); - print_program[s](); + print_program[currentstep](); set_done(currentstep); } }