multi_material_segmentation_by_painting is now returning only the painted region. Regions with default colors that aren't painted by multi-material gizmo aren't returned.
This commit also fixed the following issues:
1) After loading a 3MF with painted triangles using the MMU painting gizmo, the painted triangles might not be displayed correctly in the MMU painting gizmo.
2) The MMU segmentation was unnecessarily executed for all layers and not just for the painted layers.
3) Object's base color wasn't changed when the assigned extruder for that object was changed while the MMU paint gizmo was opened.
4) Changing the base color of an object was only possible by removing all painted triangles.
The cracks were caused by using glPolygonOffset to resolve Z-fighting. All triangles of the object were firstly rendered entirely with a base color. And then paint triangles were drawn over these already rendered triangles.
1) When splitting a triangle, vertices are now properly shared with
the neighbor triangles, if these are already split.
Please note that the splitting may not be regular if the splitting
thershold is changed between splitting calls. Still the new code
shares the vertices accross shared edges properly.
2) Triangles resp. vertices are newly reused after deleted using
linked lists of released triangles resp. vertices.
This mechanism replaces the old mechanism of reusing already split
triangles.
Based on information in https://stackoverflow.com/a/46115028, structured bindings in C++17 don't name variables, and because of that, it is impossible to capture these variables in lambda functions.
TriangleSelector::valid refactored to m_valid and valid()
and bool members moved next to each other to shrink data structure
size due to memory alignment.
Changed the serialization structure
std::map<int, std::vector<bool>>
to a significantly more compact
std::pair<std::vector<std::pair<int, int>>, std::vector<bool>>
Such change shall significantly improve efficiency of Undo / Redo stack.
Steps to repro:
1. start PrusaSlicer
2. add a box
-> watch the object list: only one item is shown in the list
3. switch to preview
-> the item in the object list gets a child