diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-26 00:58:03 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-26 00:58:03 +0400 |
commit | 98aececc8e61e7d6d9225e59ab10d27da9498953 (patch) | |
tree | cee5dfeb04d4c0016dadaeabcfad5428ac7e692c /source/blender/bmesh/operators | |
parent | 4f4bba39fb0da31bb4adad7e5110f98f85e59ebe (diff) |
bmesh code cleanup
* change BMO_elem_flag_* defines to inline functions.
* BMO_slot_map_insert() is too big for an inline function - un-inline it.
* remove redundant casts.
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_removedoubles.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_utils.c | 7 |
4 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 610790393f1..b93e12fbfc4 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -134,7 +134,7 @@ static void UNUSED_FUNCTION(rotsys_remove_edge)(struct BMEdge *e, struct BMVert } if (vd->e == e) - vd->e = (e != (BMEdge *)e1->next) ? (BMEdge *)e1->next : NULL; + vd->e = (e != e1->next) ? e1->next : NULL; e1->next = e1->prev = NULL; } diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index bd528faa43e..35fc6a1eadf 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -518,7 +518,7 @@ void bmesh_finddoubles_common(BMesh *bm, BMOperator *op, BMOperator *optarget, c /* Compare sort values of the verts using 3x tolerance (allowing for the tolerance * on each of the three axes). This avoids the more expensive length comparison * for most vertex pairs. */ - if ((v2->co[0]+v2->co[1]+v2->co[2])-(v->co[0]+v->co[1]+v->co[2]) > dist3) + if ((v2->co[0] + v2->co[1] + v2->co[2]) - (v->co[0] + v->co[1] + v->co[2]) > dist3) break; if (keepvert) { diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 50b66abd703..f35d05f69df 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -459,7 +459,7 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts int numcuts = params->numcuts; int i, j, a, b, s = numcuts + 2 /* , totv = numcuts * 4 + 4 */; - lines = MEM_callocN(sizeof(BMVert *)*(numcuts + 2)*(numcuts + 2), "q_4edge_split"); + lines = MEM_callocN(sizeof(BMVert *) * (numcuts + 2) * (numcuts + 2), "q_4edge_split"); /* build a 2-dimensional array of verts, * containing every vert (and all new ones) * in the face */ @@ -564,7 +564,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, int i, j, a, b, numcuts = params->numcuts; /* number of verts in each lin */ - lines = MEM_callocN(sizeof(void *)*(numcuts + 2), "triangle vert table"); + lines = MEM_callocN(sizeof(void *) * (numcuts + 2), "triangle vert table"); lines[0] = (BMVert **) stackarr; lines[0][0] = verts[numcuts * 2 + 1]; @@ -577,7 +577,7 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, lines[numcuts + 1][numcuts + 1] = verts[numcuts]; for (i = 0; i < numcuts; i++) { - lines[i + 1] = MEM_callocN(sizeof(void *)*(2 + i), "triangle vert table row"); + lines[i + 1] = MEM_callocN(sizeof(void *) * (2 + i), "triangle vert table row"); a = numcuts * 2 + 2 + i; b = numcuts + numcuts - i; e = connect_smallest_face(bm, verts[a], verts[b], &nf); diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 1acdf05ef35..b3102d7fafc 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -271,7 +271,7 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BMFace *f, *startf, **fstack = NULL; BLI_array_declare(fstack); BMLoop *l, *l2; - float maxx, cent[3]; + float maxx, maxx_test, cent[3]; int i, maxi, flagflip = BMO_slot_bool_get(op, "do_flip"); startf = NULL; @@ -292,9 +292,8 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op) BM_face_center_bounds_calc(bm, f, cent); - cent[0] = cent[0]*cent[0] + cent[1]*cent[1] + cent[2]*cent[2]; - if (cent[0] > maxx) { - maxx = cent[0]; + if ((maxx_test = dot_v3v3(cent, cent)) > maxx) { + maxx = maxx_test; startf = f; } } |