Added type info to the custom attributes
This commit is contained in:
parent
6b80ae85f2
commit
f961a49248
|
@ -1070,6 +1070,7 @@ public:
|
||||||
h._sizeof = sizeof(ATTR_TYPE);
|
h._sizeof = sizeof(ATTR_TYPE);
|
||||||
h._padding = 0;
|
h._padding = 0;
|
||||||
h._handle = new SimpleTempData<VertContainer,ATTR_TYPE>(m.vert);
|
h._handle = new SimpleTempData<VertContainer,ATTR_TYPE>(m.vert);
|
||||||
|
h._type = typeid(ATTR_TYPE);
|
||||||
m.attrn++;
|
m.attrn++;
|
||||||
h.n_attr = m.attrn;
|
h.n_attr = m.attrn;
|
||||||
std::pair < AttrIterator , bool> res = m.vert_attr.insert(h);
|
std::pair < AttrIterator , bool> res = m.vert_attr.insert(h);
|
||||||
|
@ -1211,6 +1212,7 @@ public:
|
||||||
h._padding = 0;
|
h._padding = 0;
|
||||||
// h._typename = typeid(ATTR_TYPE).name();
|
// h._typename = typeid(ATTR_TYPE).name();
|
||||||
h._handle = new SimpleTempData<EdgeContainer,ATTR_TYPE>(m.edge);
|
h._handle = new SimpleTempData<EdgeContainer,ATTR_TYPE>(m.edge);
|
||||||
|
h._type = typeid(ATTR_TYPE);
|
||||||
m.attrn++;
|
m.attrn++;
|
||||||
h.n_attr = m.attrn;
|
h.n_attr = m.attrn;
|
||||||
std::pair < AttrIterator , bool> res = m.edge_attr.insert(h);
|
std::pair < AttrIterator , bool> res = m.edge_attr.insert(h);
|
||||||
|
@ -1334,6 +1336,7 @@ public:
|
||||||
h._sizeof = sizeof(ATTR_TYPE);
|
h._sizeof = sizeof(ATTR_TYPE);
|
||||||
h._padding = 0;
|
h._padding = 0;
|
||||||
h._handle = new SimpleTempData<FaceContainer,ATTR_TYPE>(m.face);
|
h._handle = new SimpleTempData<FaceContainer,ATTR_TYPE>(m.face);
|
||||||
|
h._type = typeid(ATTR_TYPE);
|
||||||
m.attrn++;
|
m.attrn++;
|
||||||
h.n_attr = m.attrn;
|
h.n_attr = m.attrn;
|
||||||
std::pair < AttrIterator , bool> res = m.face_attr.insert(h);
|
std::pair < AttrIterator , bool> res = m.face_attr.insert(h);
|
||||||
|
@ -1452,6 +1455,7 @@ public:
|
||||||
h._sizeof = sizeof(ATTR_TYPE);
|
h._sizeof = sizeof(ATTR_TYPE);
|
||||||
h._padding = 0;
|
h._padding = 0;
|
||||||
h._handle = new Attribute<ATTR_TYPE>();
|
h._handle = new Attribute<ATTR_TYPE>();
|
||||||
|
h._type = typeid(ATTR_TYPE);
|
||||||
m.attrn++;
|
m.attrn++;
|
||||||
h.n_attr = m.attrn;
|
h.n_attr = m.attrn;
|
||||||
std::pair < AttrIterator , bool> res = m.mesh_attr.insert(h);
|
std::pair < AttrIterator , bool> res = m.mesh_attr.insert(h);
|
||||||
|
|
|
@ -37,10 +37,12 @@ public:
|
||||||
int _padding; // padding (used only with VMI loading)
|
int _padding; // padding (used only with VMI loading)
|
||||||
|
|
||||||
int n_attr; // unique ID of the attribute
|
int n_attr; // unique ID of the attribute
|
||||||
|
std::type_index _type;
|
||||||
void Resize(size_t sz){((SimpleTempDataBase *)_handle)->Resize(sz);}
|
void Resize(size_t sz){((SimpleTempDataBase *)_handle)->Resize(sz);}
|
||||||
void Reorder(std::vector<size_t> & newVertIndex){((SimpleTempDataBase *)_handle)->Reorder(newVertIndex);}
|
void Reorder(std::vector<size_t> & newVertIndex){((SimpleTempDataBase *)_handle)->Reorder(newVertIndex);}
|
||||||
bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);}
|
bool operator<(const PointerToAttribute b) const { return(_name.empty()&&b._name.empty())?(_handle < b._handle):( _name < b._name);}
|
||||||
|
|
||||||
|
PointerToAttribute(): _type(typeid(void)) { };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <typeindex>
|
||||||
#include <wrap/callback.h>
|
#include <wrap/callback.h>
|
||||||
#include <vcg/complex/exception.h>
|
#include <vcg/complex/exception.h>
|
||||||
#include <vcg/container/simple_temporary_data.h>
|
#include <vcg/container/simple_temporary_data.h>
|
||||||
|
|
Loading…
Reference in New Issue