diff options
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_types_customdata.h')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_customdata.h | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h index 07dafc63dee..0de79d7bd21 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.h +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h @@ -30,6 +30,42 @@ #ifndef __BMESH_PY_TYPES_CUSTOMDATA_H__ #define __BMESH_PY_TYPES_CUSTOMDATA_H__ -/* TODO */ +extern PyTypeObject BPy_BMLayerAccess_Type; +extern PyTypeObject BPy_BMLayerCollection_Type; +extern PyTypeObject BPy_BMLayerItem_Type; + +#define BPy_BMLayerAccess_Check(v) (Py_TYPE(v) == &BPy_BMLayerAccess_Type) +#define BPy_BMLayerCollection_Check(v) (Py_TYPE(v) == &BPy_BMLayerCollection_Type) +#define BPy_BMLayerItem_Check(v) (Py_TYPE(v) == &BPy_BMLayerItem_Type) + +/* all layers for vert/edge/face/loop */ +typedef struct BPy_BMLayerAccess { + PyObject_VAR_HEAD + struct BMesh *bm; /* keep first */ + char htype; +} BPy_BMLayerAccess; + +/* access different layer types deform/uv/vertexcolor */ +typedef struct BPy_BMLayerCollection { + PyObject_VAR_HEAD + struct BMesh *bm; /* keep first */ + char htype; + int type; /* customdata type - CD_XXX */ +} BPy_BMLayerCollection; + +/* access a spesific layer directly */ +typedef struct BPy_BMLayerItem { + PyObject_VAR_HEAD + struct BMesh *bm; /* keep first */ + char htype; + int type; /* customdata type - CD_XXX */ + int index; /* index of this layer type */ +} BPy_BMLayerItem; + +PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype); +PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type); +PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index); + +void BPy_BM_init_types_customdata(void); #endif /* __BMESH_PY_TYPES_CUSTOMDATA_H__ */ |