Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2018-05-25 19:21:06 +0300
committertamasmeszaros <meszaros.q@gmail.com>2018-05-25 19:21:06 +0300
commitb6f8ea03346e53cfd156d876516f99c737ff13ec (patch)
treed853b6e707787a7c24d55fa980cd9d5caf1aeeb6
parentfcef1b107e26d9ecbf97d08cf8386b121c571b37 (diff)
Progress should be displayed with synchronization.feature_slice_to_png_stable
-rw-r--r--xs/src/libslic3r/Print.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp
index 9c879fb34..f9f12e1bf 100644
--- a/xs/src/libslic3r/Print.cpp
+++ b/xs/src/libslic3r/Print.cpp
@@ -21,7 +21,8 @@
#include <wx/zipstrm.h>
#include "Rasterizer/Rasterizer.hpp"
-#include "tbb/parallel_for.h"
+#include <tbb/parallel_for.h>
+#include <tbb/spin_mutex.h>//#include "tbb/mutex.h"
namespace Slic3r {
@@ -1464,12 +1465,13 @@ void Print::print_to(std::string dirpath,
FilePrinter<format> printer(std::forward<Args>(args)...);
printer.layers(layers.size()); // Allocate space for all the layers
- set_status(0, "Rasterizing and compressing sliced layers");
-
int st_prev = 0;
+ const std::string jobdesc = "Rasterizing and compressing sliced layers";
+ set_status(0, jobdesc);
+ tbb::spin_mutex m;
// Method that prints one layer
- auto process_layer = [this, &layers, &printer, &st_prev,
+ auto process_layer = [this, &layers, &printer, &st_prev, &m, &jobdesc,
print_bb, dir, cx, cy] (unsigned layer_id)
{
Layer& l = *(layers[layer_id]);
@@ -1510,10 +1512,12 @@ void Print::print_to(std::string dirpath,
printer.finishLayer(layer_id); // Finish the layer for later saving it.
auto st = static_cast<int>(layer_id*100.0/layers.size());
- if(st > st_prev) {
- set_status(st, "processed");
+ m.lock();
+ if( st - st_prev > 10) {
+ set_status(st, jobdesc);
st_prev = st;
}
+ m.unlock();
// printer.saveLayer(layer_id, dir); We could save the layer immediately
};
@@ -1526,10 +1530,12 @@ void Print::print_to(std::string dirpath,
// Sequential version (for testing)
// for(unsigned l = 0; l < layers.size(); ++l) process_layer(l);
+ set_status(100, jobdesc);
+
// Save the print into the file system.
set_status(0, "Writing layers to disk");
printer.save(dir);
- set_status(100, "Done.");
+ set_status(100, "Writing layers to disk");
}
void Print::print_to_png(std::string dirpath, long width_px, long height_px,