From 068566f98552c632427f9d9bb9f3465833bcf85c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 24 Feb 2012 10:35:52 +0000 Subject: bmesh py api - normal_update() functions for vert/edge/face. --- source/blender/python/bmesh/bmesh_py_types.c | 58 +++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 2 deletions(-) (limited to 'source/blender/python') diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 7574db8141f..9cbb223c96f 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -560,7 +560,7 @@ PyDoc_STRVAR(bpy_bmesh_normal_update_doc, " :arg skip_hidden: When True hidden elements are ignored.\n" " :type skip_hidden: boolean\n" ); -static PyObject *bpy_bmesh_normal_update(BPy_BMElem *self, PyObject *args) +static PyObject *bpy_bmesh_normal_update(BPy_BMesh *self, PyObject *args) { int skip_hidden = FALSE; @@ -716,6 +716,21 @@ static PyObject *bpy_bmvert_calc_edge_angle(BPy_BMVert *self) } +PyDoc_STRVAR(bpy_bmvert_normal_update_doc, +".. method:: normal_update()\n" +"\n" +" Update vertex normal.\n" +); +static PyObject *bpy_bmvert_normal_update(BPy_BMVert *self) +{ + BPY_BM_CHECK_OBJ(self); + + BM_vert_normal_update(self->bm, self->v); + + Py_RETURN_NONE; +} + + /* Edge * ---- */ @@ -776,6 +791,21 @@ static PyObject *bpy_bmedge_other_vert(BPy_BMEdge *self, BPy_BMVert *value) } +PyDoc_STRVAR(bpy_bmedge_normal_update_doc, +".. method:: normal_update()\n" +"\n" +" Update edges vertex normals.\n" +); +static PyObject *bpy_bmedge_normal_update(BPy_BMEdge *self) +{ + BPY_BM_CHECK_OBJ(self); + + BM_edge_normals_update(self->bm, self->e); + + Py_RETURN_NONE; +} + + /* Face * ---- */ @@ -874,6 +904,21 @@ static PyObject *bpy_bmface_calc_center_bounds(BPy_BMFace *self) } +PyDoc_STRVAR(bpy_bmface_normal_update_doc, +".. method:: normal_update()\n" +"\n" +" Update faces normal.\n" +); +static PyObject *bpy_bmface_normal_update(BPy_BMFace *self) +{ + BPY_BM_CHECK_OBJ(self); + + BM_face_normal_update(self->bm, self->f); + + Py_RETURN_NONE; +} + + /* Loop * ---- */ @@ -1092,7 +1137,7 @@ PyDoc_STRVAR(bpy_bmelemseq_new_doc, " *Edge Sequence*\n" "\n" " :arg verts: Vertex pair.\n" -" :type verts: pair of :class:`BMVerts`\n" +" :type verts: pair of :class:`BMVert`\n" " :arg example: Existing edge to initialize settings (optional argument).\n" " :type example: :class:`BMEdge`\n" " :return: The newly created edge.\n" @@ -1297,6 +1342,9 @@ static struct PyMethodDef bpy_bmvert_methods[] = { {"copy_from", (PyCFunction)bpy_bm_elem_copy_from, METH_O, bpy_bm_elem_copy_from_doc}, {"calc_vert_angle", (PyCFunction)bpy_bmvert_calc_edge_angle, METH_NOARGS, bpy_bmvert_calc_edge_angle_doc}, + + {"normal_update", (PyCFunction)bpy_bmvert_normal_update, METH_NOARGS, bpy_bmvert_normal_update_doc}, + {NULL, NULL, 0, NULL} }; @@ -1307,6 +1355,9 @@ static struct PyMethodDef bpy_bmedge_methods[] = { {"other_vert", (PyCFunction)bpy_bmedge_other_vert, METH_O, bpy_bmedge_other_vert_doc}, {"calc_face_angle", (PyCFunction)bpy_bmedge_calc_face_angle, METH_NOARGS, bpy_bmedge_calc_face_angle_doc}, + + {"normal_update", (PyCFunction)bpy_bmedge_normal_update, METH_NOARGS, bpy_bmedge_normal_update_doc}, + {NULL, NULL, 0, NULL} }; @@ -1319,6 +1370,9 @@ static struct PyMethodDef bpy_bmface_methods[] = { {"calc_area", (PyCFunction)bpy_bmface_calc_area, METH_NOARGS, bpy_bmface_calc_area_doc}, {"calc_center_median", (PyCFunction)bpy_bmface_calc_center_mean, METH_NOARGS, bpy_bmface_calc_center_mean_doc}, {"calc_center_bounds", (PyCFunction)bpy_bmface_calc_center_bounds, METH_NOARGS, bpy_bmface_calc_center_bounds_doc}, + + {"normal_update", (PyCFunction)bpy_bmface_normal_update, METH_NOARGS, bpy_bmface_normal_update_doc}, + {NULL, NULL, 0, NULL} }; -- cgit v1.2.3