From 499dc72c51723125849e5d56607a369e991d948b Mon Sep 17 00:00:00 2001 From: gianpaolopalma Date: Thu, 29 Oct 2015 10:45:06 +0000 Subject: [PATCH] Added function CleanAttributes() to delete all attributes (vertex, face, edge and mesh attributes) --- vcg/complex/base.h | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/vcg/complex/base.h b/vcg/complex/base.h index 4974d80d..104dc66d 100644 --- a/vcg/complex/base.h +++ b/vcg/complex/base.h @@ -357,25 +357,6 @@ public: /// Function to destroy the mesh void Clear() { - // Clear attributes - typename std::set< PointerToAttribute>::iterator i; - for( i = vert_attr.begin(); i != vert_attr.end(); ++i) - delete ((SimpleTempDataBase*)(*i)._handle); - vert_attr.clear(); - - for( i = edge_attr.begin(); i != edge_attr.end(); ++i) - delete ((SimpleTempDataBase*)(*i)._handle); - edge_attr.clear(); - - for( i = face_attr.begin(); i != face_attr.end(); ++i) - delete ((SimpleTempDataBase*)(*i)._handle); - face_attr.clear(); - - for( i = mesh_attr.begin(); i != mesh_attr.end(); ++i) - delete ((SimpleTempDataBase*)(*i)._handle); - mesh_attr.clear(); - - for(FaceIterator fi = face.begin(); fi != face.end(); ++fi) (*fi).Dealloc(); vert.clear(); @@ -388,10 +369,32 @@ public: fn = 0; hn = 0; imark = 0; - attrn = 0; C()=Color4b::Gray; } + + void ClearAttributes() + { + // Clear attributes + typename std::set< PointerToAttribute>::iterator i; + for (i = vert_attr.begin(); i != vert_attr.end(); ++i) + delete ((SimpleTempDataBase*)(*i)._handle); + vert_attr.clear(); + + for (i = edge_attr.begin(); i != edge_attr.end(); ++i) + delete ((SimpleTempDataBase*)(*i)._handle); + edge_attr.clear(); + + for (i = face_attr.begin(); i != face_attr.end(); ++i) + delete ((SimpleTempDataBase*)(*i)._handle); + face_attr.clear(); + + for (i = mesh_attr.begin(); i != mesh_attr.end(); ++i) + delete ((SimpleTempDataBase*)(*i)._handle); + mesh_attr.clear(); + attrn = 0; + } + bool IsEmpty() const { return vert.empty() && edge.empty() && face.empty();