Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Split keeps a moved linked copy's place (#94): the new Part takes the source's transform
islandmed0fb37174eb8f
diff --git a/src/core/Parts.cpp b/src/core/Parts.cppindex b27bc341..8cfb5b63 100644--- a/src/core/Parts.cpp+++ b/src/core/Parts.cpp@@ -283,11 +283,13 @@ CommandResult splitOffPart(Document& doc, TriangleSet set, const char* label, coconst bool visible = from.visible;const uint32_t folder = from.folder;const Shading shading = from.shading;+ const glm::mat4 place = from.transform; // (a moved linked copy, #94: the piece stays where it was seen)const int at = doc.addPart(std::move(piece), doc.uniquePartName(source + " " + suffix), false, doc.activePart + 1);Part& added = doc.parts[size_t(at)];added.visible = visible;added.folder = folder;added.shading = shading;+ added.transform = place;const uint32_t id = added.id;const std::string name = added.name;doc.replaceMeshUndoable(std::move(rest), label);diff --git a/tests/test_parts.cpp b/tests/test_parts.cppindex a5778395..b9bdf7c1 100644--- a/tests/test_parts.cpp+++ b/tests/test_parts.cpp@@ -296,6 +296,20 @@ TEST(part_split_by_selection) {CHECK(!reg.execute(doc, "part_split_masked").ok);}+TEST(part_split_linked_copy) {+ // Splitting a moved linked copy (#94): the new Part stays where the copy is, not at the shared mesh's place.+ Document doc;+ CommandRegistry reg;+ CHECK(reg.execute(doc, "new_sphere", {{"subdivisions", 3.0}}).ok);+ CHECK(reg.execute(doc, "part_duplicate_linked", {{"offset", std::string("3,0,0")}}).ok);+ const int copy = doc.activePart;+ CHECK(doc.parts[size_t(copy)].moved());+ doc.mesh.mask.assign(doc.mesh.vertexCount(), 0.0f);+ for (size_t v = 0; v < doc.mesh.vertexCount(); ++v) doc.mesh.mask[v] = doc.mesh.positions[v].x > 0.0f ? 1.0f : 0.0f;+ CHECK(reg.execute(doc, "part_split_masked").ok);+ CHECK(doc.parts[size_t(copy + 1)].transform == doc.parts[size_t(copy)].transform);+}+TEST(part_split_mask_threshold) {// A triangle is masked when its corners' average mask is above 0.5 (kMaskedThreshold), not at it.Mesh m;