Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-03-16 09:03:13 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-03-16 09:03:13 +0400
commitebec1116184275f594cf08417b04fa43fa554628 (patch)
tree6e971d90151d1db9bd2a026f10294375c967c4c1 /source/blender/python/bmesh/bmesh_py_types_customdata.h
parentc6c0601d8ea410494b59081152f3cc080a8f39a3 (diff)
bmesh py api:
Wrap customdata, so far you can access the data layers in a pythonic way but not manipulate the customdata yet. provides dictionary like access to customdata layers, eg: texpoly = bm.faces.tex["UVMap"] print(bm.verts.shape.keys()) # un-intended pun, keys() works on all layers. print("MyInt" in bm.edges.int) # __contains__ layer = bm.faces.get("CheckForLayer")
Diffstat (limited to 'source/blender/python/bmesh/bmesh_py_types_customdata.h')
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_customdata.h38
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__ */