Extended support of MMU segmentation backed for more than three colors.

Serialization and deserialization in TriangleSelector were extended to support up to 16 materials (3 unused states left for possible later extension). These changes also affect the encoding of data from custom supports and seams, but it is backward compatible with the previous encoding. And for custom supports and seams, it is produced exactly the same data encoding as before.
This commit is contained in:
Lukáš Hejl
2021-04-27 00:37:49 +02:00
parent ea402ff871
commit 8ae1d180c7
3 changed files with 50 additions and 31 deletions

View File

@@ -1918,7 +1918,8 @@ void PrintObject::_slice(const std::vector<coordf_t> &layer_height_profile)
size_t region_count_before_change = this->num_regions();
std::vector<std::vector<std::pair<ExPolygon, size_t>>> segmented_regions = multi_material_segmentation_by_painting(*this);
// Skip region with default extruder
for (size_t region_idx = 1; region_idx < 3; ++region_idx) {
const size_t num_extruders = this->print()->config().nozzle_diameter.size();
for (size_t region_idx = 1; region_idx < num_extruders; ++region_idx) {
std::vector<ExPolygons> c_layers(m_layers.size());
for (size_t layer_idx = 0; layer_idx < m_layers.size(); ++layer_idx) {
for(const std::pair<ExPolygon, size_t> &colored_polygon : segmented_regions[layer_idx]) {