diff --git a/Doc/Tutorial/07b-delete_geometry/delete_geometry.cc b/Doc/Tutorial/07b-delete_geometry/delete_geometry.cc index 7189c801..771e6530 100644 --- a/Doc/Tutorial/07b-delete_geometry/delete_geometry.cc +++ b/Doc/Tutorial/07b-delete_geometry/delete_geometry.cc @@ -51,9 +51,6 @@ struct MyTraits : public OpenMesh::DefaultTraits { - VertexAttributes(OpenMesh::Attributes::Status); - FaceAttributes(OpenMesh::Attributes::Status); - EdgeAttributes(OpenMesh::Attributes::Status); }; @@ -67,6 +64,11 @@ int main() { MyMesh mesh; + // the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute + mesh.request_face_status(); + mesh.request_edge_status(); + mesh.request_vertex_status(); + // generate vertices MyMesh::VertexHandle vhandle[8]; diff --git a/Doc/tutorial_07b.docu b/Doc/tutorial_07b.docu index f0893532..73a83b2b 100644 --- a/Doc/tutorial_07b.docu +++ b/Doc/tutorial_07b.docu @@ -9,11 +9,14 @@ we have to extend the default traits for our mesh class. Vertices, faces and (half-)edges need the OpenMesh::Attributes::Status attribute which is used to hold the flag "deleted" if an element is deleted. -The struct which defines the mesh traits then looks like this: +Instead of defining the required attributes via traits on compile-time, it is possible to request +attributes dynamically on run-time by requesting them. +In this example, we want to delete faces, edges and vertices, therefore requesting the status attribute is required. +\note You have to request attributes before you use them, if you don't enable them via traits. \dontinclude delete_geometry.cc -\skipline struct -\until }; +\skipline // the request +\until mesh.request_vertex_status(); After having created the geometry of the cube one can delete faces and vertices by simply calling delete_vertices() (delete_faces() or delete_edges() respectively). diff --git a/src/Unittests/unittests_tutorials.cc b/src/Unittests/unittests_tutorials.cc index 9deb242d..552fa614 100644 --- a/src/Unittests/unittests_tutorials.cc +++ b/src/Unittests/unittests_tutorials.cc @@ -609,9 +609,14 @@ TEST_F(OpenMeshTutorials, extending_the_mesh_using_traits) { EXPECT_TRUE(ok) << "Cannot write mesh to file 'smoothed_extended_output.off'"; } -/* + TEST_F(OpenMeshTutorials, deleting_geometry_elements) { - MyMeshWithStatus mesh; + Mesh mesh; + + // the request has to be called before a vertex/face/edge can be deleted. it grants access to the status attribute + mesh.request_face_status(); + mesh.request_edge_status(); + mesh.request_vertex_status(); // generate vertices MyMeshWithStatus::VertexHandle vhandle[8]; @@ -730,7 +735,7 @@ TEST_F(OpenMeshTutorials, deleting_geometry_elements) { EXPECT_TRUE(ok) << "Cannot write mesh to file 'deleted_output.off'"; } -*/ + TEST_F(OpenMeshTutorials, storing_custom_properties) { MyMesh mesh;