ENH: optimize the performance of slicing

Signed-off-by: yifan.wu <yifan.wu@bambulab.com>
Change-Id: Ic769fabf641eb07eaf5cb55bf308a49831998470
This commit is contained in:
yifan.wu 2022-10-24 17:21:23 +08:00 committed by Lane.Wei
parent d641f947d6
commit 9e89a1e10e
1 changed files with 14 additions and 8 deletions

View File

@ -1404,15 +1404,21 @@ void Print::process()
obj->set_done(posIroning);
}
}
for (PrintObject *obj : m_objects) {
if (need_slicing_objects.count(obj) != 0) {
obj->generate_support_material();
tbb::parallel_for(tbb::blocked_range<int>(0, int(m_objects.size())),
[this, need_slicing_objects](const tbb::blocked_range<int>& range) {
for (int i = range.begin(); i < range.end(); i++) {
PrintObject* obj = m_objects[i];
if (need_slicing_objects.count(obj) != 0) {
obj->generate_support_material();
}
else {
if (obj->set_started(posSupportMaterial))
obj->set_done(posSupportMaterial);
}
}
}
else {
if (obj->set_started(posSupportMaterial))
obj->set_done(posSupportMaterial);
}
}
);
for (PrintObject *obj : m_objects)
{