diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-21 09:33:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-21 09:33:37 +0400 |
commit | 9773f87891b58e91f46b3cfd3e6f4f50de5d9411 (patch) | |
tree | 38c74bc80c389d0224514a6b5eab74d72e14b57d /source | |
parent | 1d5922fbaf1bf66a73761c0baceda3edca8211fe (diff) |
bmesh docs:
- add examples for custom-data access
- group BMesh types logically in docs
- added missing docstrings
needed to add grouping functionality to sphinx for this.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/bvhutils.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 2 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 2 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_customdata.c | 111 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_customdata.h | 2 | ||||
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types_meshdata.c | 22 | ||||
-rw-r--r-- | source/creator/CMakeLists.txt | 2 |
7 files changed, 106 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 2a9b17c331b..90cdb7bb130 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -523,7 +523,7 @@ BVHTree* bvhtree_from_mesh_faces(BVHTreeFromMesh *data, DerivedMesh *mesh, float int i; int numFaces= mesh->getNumTessFaces(mesh); - /* BMESH spesific check that we have tessfaces, + /* BMESH specific check that we have tessfaces, * we _could_ tessellate here but rather not - campbell * * this assert checks we have tessfaces, diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7cc145765d9..76c128c5bc3 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -2785,7 +2785,7 @@ static void rna_def_scene_image_format_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - /* format spesific */ + /* format specific */ #ifdef WITH_OPENEXR /* OpenEXR */ diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 982a58edeb9..3a60018df57 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -180,7 +180,7 @@ static int bpy_bm_elem_index_set(BPy_BMElem *self, PyObject *value, void *UNUSED } } -/* type spesific get/sets +/* type specific get/sets * ---------------------- */ diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 530a9f2ae97..7fb1f93cd2e 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -72,6 +72,39 @@ static CustomDataLayer *bpy_bmlayeritem_get(BPy_BMLayerItem *self) /* getseters * ========= */ +/* used for many different types */ + +PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_doc, +"Generic float custom-data layer.\n\ntype: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__int_doc, +"Generic int custom-data layer.\n\ntype: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__string_doc, +"Generic string custom-data layer (exposed as bytes, 255 max length).\n\ntype: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__deform_doc, +"Vertex deform weight :class:`BMDeformVert` (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__shape_doc, +"Vertex shapekey absolute location (as a 3D Vector).\n\n:type: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__bevel_weight_doc, +"Bevel weight float in [0 - 1].\n\n:type: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__crease_doc, +"Edge crease for subsurf - float in [0 - 1].\n\n:type: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__tex_doc, +"Accessor for :class:`BMTexPoly` layer (TODO).\n\ntype: :class:`BMLayerCollection`" // TYPE DOESN'T EXIST YET +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__uv_doc, +"Accessor for :class:`BMLoopUV` UV (as a 2D Vector).\n\ntype: :class:`BMLayerCollection`" +); +PyDoc_STRVAR(bpy_bmlayeraccess_collection__color_doc, +"Accessor for vertex color layer.\n\ntype: :class:`BMLayerCollection`" +); + static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void *flag) { const int type = (int)GET_INT_FROM_POINTER(flag); @@ -81,6 +114,10 @@ static PyObject *bpy_bmlayeraccess_collection_get(BPy_BMLayerAccess *self, void return BPy_BMLayerCollection_CreatePyObject(self->bm, self->htype, type); } + +PyDoc_STRVAR(bpy_bmlayercollection_active_doc, +"This meshes vert sequence (read-only).\n\n:type: :class:`BMVertSeq`" +); static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *UNUSED(flag)) { CustomData *data; @@ -99,6 +136,9 @@ static PyObject *bpy_bmlayercollection_active_get(BPy_BMLayerItem *self, void *U } } +PyDoc_STRVAR(bpy_bmlayercollection_name_doc, +"The layers unique name (read-only).\n\n:type: string" +); static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void *UNUSED(flag)) { CustomDataLayer *layer; @@ -110,46 +150,46 @@ static PyObject *bpy_bmlayeritem_name_get(BPy_BMLayerItem *self, void *UNUSED(fl } static PyGetSetDef bpy_bmlayeraccess_vert_getseters[] = { - {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_MDEFORMVERT}, + {(char *)"deform", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__deform_doc, (void *)CD_MDEFORMVERT}, - {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_FLT}, - {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_INT}, - {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_STR}, + {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT}, + {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT}, + {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR}, - {(char *)"shape", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_SHAPEKEY}, - {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_BWEIGHT}, + {(char *)"shape", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__shape_doc, (void *)CD_SHAPEKEY}, + {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; static PyGetSetDef bpy_bmlayeraccess_edge_getseters[] = { - {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_FLT}, - {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_INT}, - {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_STR}, + {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT}, + {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT}, + {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR}, - {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_BWEIGHT}, - {(char *)"crease", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_CREASE}, + {(char *)"bevel_weight", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__bevel_weight_doc, (void *)CD_BWEIGHT}, + {(char *)"crease", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__crease_doc, (void *)CD_CREASE}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; static PyGetSetDef bpy_bmlayeraccess_face_getseters[] = { - {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_FLT}, - {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_INT}, - {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_STR}, + {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT}, + {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT}, + {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR}, - {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_MTEXPOLY}, + {(char *)"tex", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__tex_doc, (void *)CD_MTEXPOLY}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = { - {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_FLT}, - {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_INT}, - {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_PROP_STR}, + {(char *)"float", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__float_doc, (void *)CD_PROP_FLT}, + {(char *)"int", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__int_doc, (void *)CD_PROP_INT}, + {(char *)"string", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__string_doc, (void *)CD_PROP_STR}, - {(char *)"uv", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_MLOOPUV}, - {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)NULL, (void *)CD_MLOOPCOL}, + {(char *)"uv", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__uv_doc, (void *)CD_MLOOPUV}, + {(char *)"color", (getter)bpy_bmlayeraccess_collection_get, (setter)NULL, (char *)bpy_bmlayeraccess_collection__color_doc, (void *)CD_MLOOPCOL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -157,14 +197,14 @@ static PyGetSetDef bpy_bmlayeraccess_loop_getseters[] = { static PyGetSetDef bpy_bmlayercollection_getseters[] = { /* BMESH_TODO, make writeable */ - {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)NULL, NULL}, + {(char *)"active", (getter)bpy_bmlayercollection_active_get, (setter)NULL, (char *)bpy_bmlayercollection_active_doc, NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; static PyGetSetDef bpy_bmlayeritem_getseters[] = { /* BMESH_TODO, make writeable */ - {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)NULL, NULL}, + {(char *)"name", (getter)bpy_bmlayeritem_name_get, (setter)NULL, (char *)bpy_bmlayercollection_name_doc, NULL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; @@ -527,6 +567,21 @@ static PyObject *bpy_bmlayercollection_iter(BPy_BMLayerCollection *self) return iter; } +PyDoc_STRVAR(bpy_bmlayeraccess_type_doc, +"Exposes custom-data layer attributes." +); + +PyDoc_STRVAR(bpy_bmlayercollection_type_doc, +"Gives access to a collection of custom-data layers of the same type and behaves like python dictionaries, " +"except for the ability to do list like index access." +); + +PyDoc_STRVAR(bpy_bmlayeritem_type_doc, +"Exposes a single custom data layer, " +"their main purpose is for use as item accessors to custom-data when used with vert/edge/face/loop data." +); + + PyTypeObject BPy_BMLayerAccessVert_Type = {{{0}}}; /* bm.verts.layers */ PyTypeObject BPy_BMLayerAccessEdge_Type = {{{0}}}; /* bm.edges.layers */ PyTypeObject BPy_BMLayerAccessFace_Type = {{{0}}}; /* bm.faces.layers */ @@ -596,12 +651,12 @@ void BPy_BM_init_types_customdata(void) BPy_BMLayerItem_Type.tp_name = "BMLayerItem"; /* todo */ - BPy_BMLayerAccessVert_Type.tp_doc = NULL; - BPy_BMLayerAccessEdge_Type.tp_doc = NULL; - BPy_BMLayerAccessFace_Type.tp_doc = NULL; - BPy_BMLayerAccessLoop_Type.tp_doc = NULL; - BPy_BMLayerCollection_Type.tp_doc = NULL; - BPy_BMLayerItem_Type.tp_doc = NULL; + BPy_BMLayerAccessVert_Type.tp_doc = bpy_bmlayeraccess_type_doc; + BPy_BMLayerAccessEdge_Type.tp_doc = bpy_bmlayeraccess_type_doc; + BPy_BMLayerAccessFace_Type.tp_doc = bpy_bmlayeraccess_type_doc; + BPy_BMLayerAccessLoop_Type.tp_doc = bpy_bmlayeraccess_type_doc; + BPy_BMLayerCollection_Type.tp_doc = bpy_bmlayercollection_type_doc; + BPy_BMLayerItem_Type.tp_doc = bpy_bmlayeritem_type_doc; BPy_BMLayerAccessVert_Type.tp_repr = (reprfunc)NULL; BPy_BMLayerAccessEdge_Type.tp_repr = (reprfunc)NULL; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h index c777150b25f..b16b2806235 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.h +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h @@ -58,7 +58,7 @@ typedef struct BPy_BMLayerCollection { int type; /* customdata type - CD_XXX */ } BPy_BMLayerCollection; -/* access a spesific layer directly */ +/* access a specific layer directly */ typedef struct BPy_BMLayerItem { PyObject_VAR_HEAD struct BMesh *bm; /* keep first */ diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 7fffb205f2b..56b3d764156 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -49,6 +49,9 @@ typedef struct BPy_BMLoopUV { MLoopUV *data; } BPy_BMLoopUV; +PyDoc_STRVAR(bpy_bmloopuv_uv_doc, +"Loops UV (as a 2D Vector).\n\n:type: :class:`mathutils.Vector`" +); static PyObject *bpy_bmloopuv_uv_get(BPy_BMLoopUV *self, void *UNUSED(closure)) { return Vector_CreatePyObject(self->data->uv, 2, Py_WRAP, NULL); @@ -66,6 +69,17 @@ static int bpy_bmloopuv_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED } } +PyDoc_STRVAR(bpy_bmloopuv_flag__pin_uv_doc, +"UV pin state.\n\n:type: boolean" +); +PyDoc_STRVAR(bpy_bmloopuv_flag__select_doc, +"UV select state.\n\n:type: boolean" +); +PyDoc_STRVAR(bpy_bmloopuv_flag__select_edge_doc, +"UV edge select state.\n\n:type: boolean" +); + + static PyObject *bpy_bmloopuv_flag_get(BPy_BMLoopUV *self, void *flag_p) { const int flag = GET_INT_FROM_POINTER(flag_p); @@ -92,10 +106,10 @@ static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag static PyGetSetDef bpy_bmloopuv_getseters[] = { /* attributes match rna_def_mloopuv */ - {(char *)"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, (char *)NULL, NULL}, - {(char *)"pin_uv", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)NULL, (void *)MLOOPUV_PINNED}, - {(char *)"select", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)NULL, (void *)MLOOPUV_VERTSEL}, - {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)NULL, (void *)MLOOPUV_EDGESEL}, + {(char *)"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, (char *)bpy_bmloopuv_uv_doc, NULL}, + {(char *)"pin_uv", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__pin_uv_doc, (void *)MLOOPUV_PINNED}, + {(char *)"select", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_doc, (void *)MLOOPUV_VERTSEL}, + {(char *)"select_edge", (getter)bpy_bmloopuv_flag_get, (setter)bpy_bmloopuv_flag_set, (char *)bpy_bmloopuv_flag__select_edge_doc, (void *)MLOOPUV_EDGESEL}, {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index 57c62db3117..3374d653148 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -230,7 +230,7 @@ set(BLENDER_TEXT_FILES # ----------------------------------------------------------------------------- -# Platform Spesific Var: TARGETDIR_VER +# Platform Specific Var: TARGETDIR_VER if(UNIX AND NOT APPLE) if(WITH_INSTALL_PORTABLE) |