From 8fbfad275c618ebf145224647c4fa285e60350a4 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 29 Nov 2018 10:57:06 +0100 Subject: [PATCH 1/2] Reordered scene reload to prevent race conditions. Also extended progress status bar to support status value -1 for pulsing. --- src/libslic3r/SLAPrint.cpp | 24 ++++++++++-------------- src/slic3r/GUI/ProgressStatusBar.cpp | 6 +++++- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index 78cb86f75..5a5a0735f 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -517,7 +517,7 @@ void SLAPrint::process() }; // This step generates the sla base pad - auto base_pool = [](SLAPrintObject& po) { + auto base_pool = [this](SLAPrintObject& po) { // this step can only go after the support tree has been created // and before the supports had been sliced. (or the slicing has to be // repeated) @@ -545,6 +545,15 @@ void SLAPrint::process() po.m_supportdata->support_tree_ptr->add_pad(bp, wt, h, md, er); } + + // if the base pool (which means also the support tree) is + // done, do a refresh when indicating progress. Now the + // geometries for the supports and the optional base pad are + // ready. We can grant access for the control thread to read + // the geometries, but first we have to update the caches: + po.support_mesh(); /*po->pad_mesh();*/ + auto rc = SlicingStatus::RELOAD_SCENE; + set_status(-1, L("Visualizing supports"), rc); }; // Slicing the support geometries similarly to the model slicing procedure. @@ -768,8 +777,6 @@ void SLAPrint::process() [](){} // validate }; - static const auto RELOAD_SCENE = SlicingStatus::RELOAD_SCENE; - unsigned st = min_objstatus; unsigned incr = 0; @@ -789,19 +796,8 @@ void SLAPrint::process() if(po->m_stepmask[currentstep] && po->set_started(currentstep)) { set_status(int(st), OBJ_STEP_LABELS[currentstep]); - pobj_program[currentstep](*po); po->set_done(currentstep); - - if(currentstep == slaposBasePool) { - // if the base pool (which means also the support tree) is - // done, do a refresh when indicating progress. Now the - // geometries for the supports and the optional base pad are - // ready. We can grant access for the control thread to read - // the geometries, but first we have to update the caches: - po->support_mesh(); /*po->pad_mesh();*/ - set_status(int(st), L("Visualizing supports"), RELOAD_SCENE); - } } incr = OBJ_STEP_LEVELS[currentstep]; diff --git a/src/slic3r/GUI/ProgressStatusBar.cpp b/src/slic3r/GUI/ProgressStatusBar.cpp index 44a7b06c5..93ab3feb9 100644 --- a/src/slic3r/GUI/ProgressStatusBar.cpp +++ b/src/slic3r/GUI/ProgressStatusBar.cpp @@ -75,7 +75,11 @@ void ProgressStatusBar::set_progress(int val) if(val == m_prog->GetRange()) { m_prog->SetValue(0); show_progress(false); - } else { + } + else if(val < 0) { + m_prog->Pulse(); + } + else { m_prog->SetValue(val); } } From 7b9c8ca06c01f94d0ce6828605ebf25cdff3bc79 Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Thu, 29 Nov 2018 12:53:56 +0100 Subject: [PATCH 2/2] Fix for empty zip when the object is moved after slicing --- src/libslic3r/SLAPrint.cpp | 14 +------------- src/libslic3r/SLAPrint.hpp | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/libslic3r/SLAPrint.cpp b/src/libslic3r/SLAPrint.cpp index ba490e422..c4abc583e 100644 --- a/src/libslic3r/SLAPrint.cpp +++ b/src/libslic3r/SLAPrint.cpp @@ -567,19 +567,7 @@ void SLAPrint::process() } }; - using Layer = sla::ExPolygons; - using LayerCopies = std::vector; - struct LayerRef { - std::reference_wrapper lref; - std::reference_wrapper copies; - LayerRef(const Layer& lyr, const LayerCopies& cp) : - lref(std::cref(lyr)), copies(std::cref(cp)) {} - }; - - using LevelID = long long; - using LayerRefs = std::vector; - // layers according to quantized height levels - std::map levels; + auto& levels = m_printer_input; // 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) diff --git a/src/libslic3r/SLAPrint.hpp b/src/libslic3r/SLAPrint.hpp index 93b88a7df..2d6eb49c2 100644 --- a/src/libslic3r/SLAPrint.hpp +++ b/src/libslic3r/SLAPrint.hpp @@ -200,7 +200,31 @@ private: PrintObjects m_objects; std::vector m_stepmask; - SLAPrinterPtr m_printer; + + // Definition of the print input map. It consists of the slices indexed + // with scaled (clipper) Z coordinates. Also contains the instance + // transformations in scaled and filtered version. This is enough for the + // rasterizer to be able to draw every layer in the right position + using Layer = ExPolygons; + using LayerCopies = std::vector; + struct LayerRef { + std::reference_wrapper lref; + std::reference_wrapper copies; + LayerRef(const Layer& lyr, const LayerCopies& cp) : + lref(std::cref(lyr)), copies(std::cref(cp)) {} + }; + + // Layers according to quantized height levels. This will be consumed by + // the printer (rasterizer) in the SLAPrint class. + using LevelID = long long; + + // One level may contain multiple slices from multiple objects and their + // supports + using LayerRefs = std::vector; + std::map m_printer_input; + + // The printer itself + SLAPrinterPtr m_printer; friend SLAPrintObject; };