From f961a492483a2de6b07c5668e04f20fad184790f Mon Sep 17 00:00:00 2001 From: gianpaolopalma Date: Thu, 7 Dec 2017 13:52:03 +0100 Subject: [PATCH] Added type info to the custom attributes --- vcg/complex/allocate.h | 4 ++++ vcg/complex/base.h | 4 +++- vcg/complex/complex.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/vcg/complex/allocate.h b/vcg/complex/allocate.h index 25486233..25cf2424 100644 --- a/vcg/complex/allocate.h +++ b/vcg/complex/allocate.h @@ -1070,6 +1070,7 @@ public: h._sizeof = sizeof(ATTR_TYPE); h._padding = 0; h._handle = new SimpleTempData(m.vert); + h._type = typeid(ATTR_TYPE); m.attrn++; h.n_attr = m.attrn; std::pair < AttrIterator , bool> res = m.vert_attr.insert(h); @@ -1211,6 +1212,7 @@ public: h._padding = 0; // h._typename = typeid(ATTR_TYPE).name(); h._handle = new SimpleTempData(m.edge); + h._type = typeid(ATTR_TYPE); m.attrn++; h.n_attr = m.attrn; std::pair < AttrIterator , bool> res = m.edge_attr.insert(h); @@ -1334,6 +1336,7 @@ public: h._sizeof = sizeof(ATTR_TYPE); h._padding = 0; h._handle = new SimpleTempData(m.face); + h._type = typeid(ATTR_TYPE); m.attrn++; h.n_attr = m.attrn; std::pair < AttrIterator , bool> res = m.face_attr.insert(h); @@ -1452,6 +1455,7 @@ public: h._sizeof = sizeof(ATTR_TYPE); h._padding = 0; h._handle = new Attribute(); + h._type = typeid(ATTR_TYPE); m.attrn++; h.n_attr = m.attrn; std::pair < AttrIterator , bool> res = m.mesh_attr.insert(h); diff --git a/vcg/complex/base.h b/vcg/complex/base.h index fc178f79..65cfb4a9 100644 --- a/vcg/complex/base.h +++ b/vcg/complex/base.h @@ -37,10 +37,12 @@ public: int _padding; // padding (used only with VMI loading) int n_attr; // unique ID of the attribute - + std::type_index _type; void Resize(size_t sz){((SimpleTempDataBase *)_handle)->Resize(sz);} void Reorder(std::vector & newVertIndex){((SimpleTempDataBase *)_handle)->Reorder(newVertIndex);} bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);} + + PointerToAttribute(): _type(typeid(void)) { }; }; diff --git a/vcg/complex/complex.h b/vcg/complex/complex.h index 0121700e..ebc3dc1e 100644 --- a/vcg/complex/complex.h +++ b/vcg/complex/complex.h @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include