From 16ff7e40e66f93484695445b89090547de78d086 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 23 Apr 2012 01:19:50 +0000 Subject: code cleanup: change C naming convention (so py and C api match), eg: C: BM_face_calc_area(f), Py: BMFace.calc_area() --- source/blender/bmesh/intern/bmesh_mesh.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/bmesh/intern/bmesh_mesh.c') diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index 0a5e3bab804..6c208b46244 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -584,6 +584,18 @@ void BM_mesh_elem_index_validate(BMesh *bm, const char *location, const char *fu } +/** + * Return the amount of element of type 'type' in a given bmesh. + */ +int BM_mesh_elem_count(BMesh *bm, const char htype) +{ + if (htype == BM_VERT) return bm->totvert; + else if (htype == BM_EDGE) return bm->totedge; + else if (htype == BM_FACE) return bm->totface; + + return 0; +} + /** * Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays * (xxx_idx[org_index] = new_index). -- cgit v1.2.3