Is there a way in OpenMesh to copy element properties in between different mesh instances? copy_all_properties()
does copy all element properties from one element to another as described here, however, it is bound to a mesh instance and does not seem to copy anything if the two elements belong to different mesh objects.
I tried the following:
MyMesh mesh1, mesh2;
std::vector<MyMesh::VertexHandle> vhandles;
MyMesh::FaceHandle face1, face2;
auto mesh1_props = OpenMesh::FProp<int>(mesh1, "face_props");
auto mesh2_props = OpenMesh::FProp<int>(mesh2, "face_props");
vhandles.push_back(mesh1.add_vertex(MyMesh::Point(0,0,0)));
vhandles.push_back(mesh1.add_vertex(MyMesh::Point(0,1,0)));
vhandles.push_back(mesh1.add_vertex(MyMesh::Point(1,0,0)));
face1 = mesh1.add_face(vhandles);
mesh1_props[face1] = 5;
vhandles.clear();
vhandles.push_back(mesh2.add_vertex(MyMesh::Point(0,0,0)));
vhandles.push_back(mesh2.add_vertex(MyMesh::Point(0,1,0)));
vhandles.push_back(mesh2.add_vertex(MyMesh::Point(1,0,0)));
face2 = mesh2.add_face(vhandles);
mesh1.copy_all_properties(face1, face2);
std::cout<<"face1 prop "<<mesh1_props[face1]<<std::endl;
std::cout<<"face2 prop "<<mesh2_props[face2]<<std::endl;
which outputs:
face1 prop 5
face2 prop 0
so the property does not get copied.