From f229d81b0e2e69788e91cec858000726ddb97036 Mon Sep 17 00:00:00 2001 From: fseegraeber Date: Mon, 10 Jun 2024 11:48:11 +0200 Subject: [PATCH] Fix Compute Planar Section - Split Surfaces: Now keeps attributes Fixes a few issues in the above mentioned filter: - Now transfers textures and attributes to the newly created meshes - The 'over' mesh will no longer contain unreferenced vertices of the 'under' mesh - Clears the selection for the 'over' mesh. None of the participating meshes now have any visible selection --- src/meshlabplugins/filter_meshing/meshfilter.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/meshlabplugins/filter_meshing/meshfilter.cpp b/src/meshlabplugins/filter_meshing/meshfilter.cpp index f9c547b7c..4cac74277 100644 --- a/src/meshlabplugins/filter_meshing/meshfilter.cpp +++ b/src/meshlabplugins/filter_meshing/meshfilter.cpp @@ -1901,8 +1901,12 @@ std::map ExtraMeshFilterPlugin::applyFilter( if(par.getBool("splitSurfaceWithSection")) { MeshModel* underM= md.addNewMesh("",sectionName+"_under"); + underM->updateDataMask(orig); underM->updateDataMask(MeshModel::MM_FACEFACETOPO); underM->updateDataMask(MeshModel::MM_VERTQUALITY); + for (const std::string& tex : orig->cm.textures) { + underM->addTexture(tex, orig->getTexture(tex)); + } tri::Append::Mesh(underM->cm,orig->cm); tri::UpdateQuality::VertexFromPlane(underM->cm, slicingPlane); @@ -1921,9 +1925,15 @@ std::map ExtraMeshFilterPlugin::applyFilter( tri::UpdateSelection::VertexFromQualityRange(underM->cm,0,std::numeric_limits::max()); tri::UpdateSelection::FaceFromVertexStrict(underM->cm); tri::UpdateSelection::FaceInvert(underM->cm); + tri::UpdateSelection::VertexClear(underM->cm); MeshModel* overM= md.addNewMesh("",sectionName+"_over"); + overM->updateDataMask(underM); + for (const std::string& tex : underM->cm.textures) { + overM->addTexture(tex, underM->getTexture(tex)); + } tri::Append::Mesh(overM->cm,underM->cm,true); + tri::UpdateSelection::Clear(overM->cm); tri::UpdateSelection::VertexClear(underM->cm); tri::UpdateSelection::VertexFromFaceStrict(underM->cm);