SLA backend thread-safety improvements

- Put AnyPtr into separate header, it deserves one
- Add means to handle shared pointers inside AnyPtr
- Use shared pointers in sla csg collection for meshes not owned by Model
- Add method to get the last completed step in PrintObjectBase
- Make SLAPrintObject::get_parts_to_slice() safe to call from UI thread against background thread activity.
This commit is contained in:
tamasmeszaros 2023-01-11 18:24:44 +01:00
parent a4e50f8219
commit 440df505b4
11 changed files with 218 additions and 109 deletions

View file

@ -123,16 +123,9 @@ public:
// like hollowing and drilled holes.
const TriangleMesh & get_mesh_to_print() const;
const Range<CSGContainer::const_iterator> get_parts_to_slice() const
{
return range(m_mesh_to_slice);
}
std::vector<csg::CSGPart> get_parts_to_slice() const;
const Range<CSGContainer::const_iterator> get_parts_to_slice(SLAPrintObjectStep step) const
{
auto r = m_mesh_to_slice.equal_range(step);
return {r.first, r.second};
}
std::vector<csg::CSGPart> get_parts_to_slice(SLAPrintObjectStep step) const;
sla::SupportPoints transformed_support_points() const;
sla::DrainHoles transformed_drainhole_points() const;
@ -373,6 +366,15 @@ private:
// Holds CSG operations for the printed object, prioritized by print steps.
CSGContainer m_mesh_to_slice;
auto mesh_to_slice(SLAPrintObjectStep s) const
{
auto r = m_mesh_to_slice.equal_range(s);
return Range{r.first, r.second};
}
auto mesh_to_slice() const { return range(m_mesh_to_slice); }
// Holds the preview of the object to be printed (as it will look like with
// all its holes and cavities, negatives and positive volumes unified.
// Essentially this should be a m_mesh_to_slice after the CSG operations