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:
authorLukáš Hejl <hejl.lukas@gmail.com>2021-04-19 08:01:11 +0300
committerLukáš Hejl <hejl.lukas@gmail.com>2021-04-19 08:01:11 +0300
commite3c33844d5d89b2bf61aa781cca2cb963d9bef59 (patch)
tree168b1b0463d18225ac352b8d0d04f18cec59509a /src/libslic3r/Format/3mf.cpp
parent4da8de5f4909a77ca3d07e3b6540f50508f969c3 (diff)
WIP: Duplicated the FDM support gizmo for the MMU segmentation
Diffstat (limited to 'src/libslic3r/Format/3mf.cpp')
-rw-r--r--src/libslic3r/Format/3mf.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/libslic3r/Format/3mf.cpp b/src/libslic3r/Format/3mf.cpp
index 152d72079..631f4769c 100644
--- a/src/libslic3r/Format/3mf.cpp
+++ b/src/libslic3r/Format/3mf.cpp
@@ -95,6 +95,7 @@ static constexpr const char* PRINTABLE_ATTR = "printable";
static constexpr const char* INSTANCESCOUNT_ATTR = "instances_count";
static constexpr const char* CUSTOM_SUPPORTS_ATTR = "slic3rpe:custom_supports";
static constexpr const char* CUSTOM_SEAM_ATTR = "slic3rpe:custom_seam";
+static constexpr const char* MMU_SEGMENTATION_ATTR = "slic3rpe:mmu_segmentation";
static constexpr const char* KEY_ATTR = "key";
static constexpr const char* VALUE_ATTR = "value";
@@ -289,6 +290,7 @@ namespace Slic3r {
std::vector<unsigned int> triangles;
std::vector<std::string> custom_supports;
std::vector<std::string> custom_seam;
+ std::vector<std::string> mmu_segmentation;
bool empty() { return vertices.empty() || triangles.empty(); }
@@ -297,6 +299,7 @@ namespace Slic3r {
triangles.clear();
custom_supports.clear();
custom_seam.clear();
+ mmu_segmentation.clear();
}
};
@@ -1564,6 +1567,7 @@ namespace Slic3r {
m_curr_object.geometry.custom_supports.push_back(get_attribute_value_string(attributes, num_attributes, CUSTOM_SUPPORTS_ATTR));
m_curr_object.geometry.custom_seam.push_back(get_attribute_value_string(attributes, num_attributes, CUSTOM_SEAM_ATTR));
+ m_curr_object.geometry.mmu_segmentation.push_back(get_attribute_value_string(attributes, num_attributes, MMU_SEGMENTATION_ATTR));
return true;
}
@@ -1888,15 +1892,18 @@ namespace Slic3r {
volume->source.transform = Slic3r::Geometry::Transformation(volume_matrix_to_object);
volume->calculate_convex_hull();
- // recreate custom supports and seam from previously loaded attribute
+ // recreate custom supports, seam and mmu segmentation from previously loaded attribute
for (unsigned i=0; i<triangles_count; ++i) {
size_t index = src_start_id/3 + i;
assert(index < geometry.custom_supports.size());
assert(index < geometry.custom_seam.size());
+ assert(index < geometry.mmu_segmentation.size());
if (! geometry.custom_supports[index].empty())
volume->supported_facets.set_triangle_from_string(i, geometry.custom_supports[index]);
if (! geometry.custom_seam[index].empty())
volume->seam_facets.set_triangle_from_string(i, geometry.custom_seam[index]);
+ if (! geometry.mmu_segmentation[index].empty())
+ volume->mmu_segmentation_facets.set_triangle_from_string(i, geometry.mmu_segmentation[index]);
}
@@ -2530,6 +2537,15 @@ namespace Slic3r {
output_buffer += "\"";
}
+ std::string mmu_painting_data_string = volume->mmu_segmentation_facets.get_triangle_as_string(i);
+ if (! mmu_painting_data_string.empty()) {
+ output_buffer += " ";
+ output_buffer += MMU_SEGMENTATION_ATTR;
+ output_buffer += "=\"";
+ output_buffer += mmu_painting_data_string;
+ output_buffer += "\"";
+ }
+
output_buffer += "/>\n";
if (! flush())