Code Cleanup: style change only
authorCampbell Barton <ideasman42@gmail.com>
Sun, 5 Feb 2012 15:55:28 +0000 (15:55 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 5 Feb 2012 15:55:28 +0000 (15:55 +0000)
31 files changed:
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_interp.c
source/blender/bmesh/intern/bmesh_iterators.c
source/blender/bmesh/intern/bmesh_iterators_inline.c
source/blender/bmesh/intern/bmesh_marking.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/bmesh/intern/bmesh_mods.c
source/blender/bmesh/intern/bmesh_newcore.c
source/blender/bmesh/intern/bmesh_operators.c
source/blender/bmesh/intern/bmesh_polygon.c
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_structure.c
source/blender/bmesh/intern/bmesh_walkers.c
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/bmesh/operators/bevel.c
source/blender/bmesh/operators/bmesh_dupeops.c
source/blender/bmesh/operators/connectops.c
source/blender/bmesh/operators/createops.c
source/blender/bmesh/operators/dissolveops.c
source/blender/bmesh/operators/edgesplitop.c
source/blender/bmesh/operators/extrudeops.c
source/blender/bmesh/operators/join_triangles.c
source/blender/bmesh/operators/mesh_conv.c
source/blender/bmesh/operators/primitiveops.c
source/blender/bmesh/operators/removedoubles.c
source/blender/bmesh/operators/subdivideop.c
source/blender/bmesh/operators/triangulateop.c
source/blender/bmesh/operators/utils.c
source/blender/editors/mesh/bmesh_select.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/mesh/bmeshutils.c

index 821e9393fdec6de129174755e696894708d07365..644a4f00a3f4ddaf385a332c89bd0955bcd7a539 100644 (file)
@@ -82,7 +82,7 @@ BMVert *BM_Make_Vert(BMesh *bm, float co[3], BMVert *example)
 {
        BMVert *v = NULL;
        v = bmesh_mv(bm, co);
-       if(example)
+       if (example)
                CustomData_bmesh_copy_data(&bm->vdata, &bm->vdata, example->head.data, &v->head.data);
        return v;
 }
@@ -106,13 +106,13 @@ BMEdge *BM_Make_Edge(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge *example, int nod
 {
        BMEdge *e = NULL;
        
-       if(nodouble) /*test if edge already exists.*/
+       if (nodouble) /*test if edge already exists.*/
                e = BM_Edge_Exist(v1, v2);
 
-       if(!e) {
+       if (!e) {
                e = bmesh_me(bm, v1, v2);
 
-               if(example)
+               if (example)
                        CustomData_bmesh_copy_data(&bm->edata, &bm->edata, example->head.data, &e->head.data);
        }
        
@@ -155,7 +155,7 @@ BMFace *BM_Make_Face_QuadTri_v(BMesh *bm, BMVert **verts, int len, const BMFace
 
        edar[0] = BM_Edge_Exist(verts[0], verts[1]);
        edar[1] = BM_Edge_Exist(verts[1], verts[2]);
-       if(len == 4) {
+       if (len == 4) {
                edar[2] = BM_Edge_Exist(verts[2], verts[3]);
                edar[3] = BM_Edge_Exist(verts[3], verts[0]);
        }
@@ -163,9 +163,9 @@ BMFace *BM_Make_Face_QuadTri_v(BMesh *bm, BMVert **verts, int len, const BMFace
                edar[2] = BM_Edge_Exist(verts[2], verts[0]);
        }
 
-       if(nodouble) {
+       if (nodouble) {
                /*check if face exists or overlaps*/
-               if(len == 4) {
+               if (len == 4) {
                        overlap = BM_Exist_Face_Overlaps(bm, verts, len, &f);
                }
                else {
@@ -174,21 +174,22 @@ BMFace *BM_Make_Face_QuadTri_v(BMesh *bm, BMVert **verts, int len, const BMFace
        }
 
        /*make new face*/
-       if((!f) && (!overlap)) {
-               if(!edar[0]) edar[0] = BM_Make_Edge(bm, verts[0], verts[1], NULL, 0);
-               if(!edar[1]) edar[1] = BM_Make_Edge(bm, verts[1], verts[2], NULL, 0);
-               if(len == 4) {
-                       if(!edar[2]) edar[2] = BM_Make_Edge(bm, verts[2], verts[3], NULL, 0);
-                       if(!edar[3]) edar[3] = BM_Make_Edge(bm, verts[3], verts[0], NULL, 0);
-               } else {
-                       if(!edar[2]) edar[2] = BM_Make_Edge(bm, verts[2], verts[0], NULL, 0);
+       if ((!f) && (!overlap)) {
+               if (!edar[0]) edar[0] = BM_Make_Edge(bm, verts[0], verts[1], NULL, 0);
+               if (!edar[1]) edar[1] = BM_Make_Edge(bm, verts[1], verts[2], NULL, 0);
+               if (len == 4) {
+                       if (!edar[2]) edar[2] = BM_Make_Edge(bm, verts[2], verts[3], NULL, 0);
+                       if (!edar[3]) edar[3] = BM_Make_Edge(bm, verts[3], verts[0], NULL, 0);
+               }
+               else {
+                       if (!edar[2]) edar[2] = BM_Make_Edge(bm, verts[2], verts[0], NULL, 0);
                }
        
                f = BM_Make_Face(bm, verts, edar, len, 0);
        
-               if(example && f)
+               if (example && f) {
                        BM_Copy_Attributes(bm, bm, example, f);
-
+               }
        }
 
        return f;
@@ -204,13 +205,14 @@ void BM_Face_CopyShared(BMesh *bm, BMFace *f)
        if (!f) return;
 
        l=BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, f);
-       for (; l; l=BMIter_Step(&iter)) {
+       for ( ; l; l=BMIter_Step(&iter)) {
                l2 = l->radial_next;
                
                if (l2 && l2 != l) {
                        if (l2->v == l->v) {
                                bm_copy_loop_attributes(bm, bm, l2, l);
-                       } else {
+                       }
+                       else {
                                l2 = l2->next;
                                bm_copy_loop_attributes(bm, bm, l2, l);
                        }
@@ -371,7 +373,7 @@ void BM_remove_tagged_faces(BMesh *bm, int flag)
        BMIter iter;
 
        BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
-               if(BMO_TestFlag(bm, f, flag)) BM_Kill_Face(bm, f);
+               if (BMO_TestFlag(bm, f, flag)) BM_Kill_Face(bm, f);
        }
 }
 
@@ -381,7 +383,7 @@ void BM_remove_tagged_edges(BMesh *bm, int flag)
        BMIter iter;
 
        BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
-               if(BMO_TestFlag(bm, e, flag)) BM_Kill_Edge(bm, e);
+               if (BMO_TestFlag(bm, e, flag)) BM_Kill_Edge(bm, e);
        }
 }
 
@@ -391,7 +393,7 @@ void BM_remove_tagged_verts(BMesh *bm, int flag)
        BMIter iter;
 
        BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
-               if(BMO_TestFlag(bm, v, flag)) BM_Kill_Vert(bm, v);
+               if (BMO_TestFlag(bm, v, flag)) BM_Kill_Vert(bm, v);
        }
 }
 
@@ -441,23 +443,23 @@ void BM_Copy_Attributes(BMesh *source_mesh, BMesh *target_mesh, const void *sour
        const BMHeader *sheader = source;
        BMHeader *theader = target;
        
-       if(sheader->htype != theader->htype)
+       if (sheader->htype != theader->htype)
                return;
 
        /*First we copy select*/
-       if(BM_Selected(source_mesh, source)) BM_Select(target_mesh, target, TRUE);
+       if (BM_Selected(source_mesh, source)) BM_Select(target_mesh, target, TRUE);
        
        /*Now we copy flags*/
        theader->hflag = sheader->hflag;
        
        /*Copy specific attributes*/
-       if(theader->htype == BM_VERT)
+       if (theader->htype == BM_VERT)
                bm_copy_vert_attributes(source_mesh, target_mesh, (const BMVert*)source, (BMVert*)target);
-       else if(theader->htype == BM_EDGE)
+       else if (theader->htype == BM_EDGE)
                bm_copy_edge_attributes(source_mesh, target_mesh, (const BMEdge*)source, (BMEdge*)target);
-       else if(theader->htype == BM_LOOP)
+       else if (theader->htype == BM_LOOP)
                bm_copy_loop_attributes(source_mesh, target_mesh, (const BMLoop*)source, (BMLoop*)target);
-       else if(theader->htype == BM_FACE)
+       else if (theader->htype == BM_FACE)
                bm_copy_face_attributes(source_mesh, target_mesh, (const BMFace*)source, (BMFace*)target);
 }
 
index 265c245359de1d3b73e26f99ecc07c2606a0c435..c9c17a738ab82d50c0fb0330bba6576192b0f069 100644 (file)
@@ -118,15 +118,15 @@ void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVe
        w[1] = 1.0f - fac;
        w[0] = fac;
 
-       if(!e1->l) return;
+       if (!e1->l) return;
        l = e1->l;
        do {
-               if(l->v == v1) {
+               if (l->v == v1) {
                        v1loop = l;
                        vloop = v1loop->next;
                        v2loop = vloop->next;
                }
-               else if(l->v == v) {
+               else if (l->v == v) {
                        v1loop = l->next;
                        vloop = l;
                        v2loop = l->prev;
@@ -140,7 +140,7 @@ void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVe
 
                CustomData_bmesh_interp(&bm->ldata, src,w, NULL, 2, vloop->head.data);                          
                l = l->radial_next;
-       } while(l!=e1->l);
+       } while (l!=e1->l);
 }
 
 void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
@@ -155,7 +155,7 @@ void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
        MLoopUV *mloopuv;
        int i, j;
 
-       for(i=0; i < numTex; i++) {
+       for (i=0; i < numTex; i++) {
                texface = CustomData_get_n(&me->fdata, CD_MTFACE, findex, i);
                texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i);
                
@@ -176,7 +176,7 @@ void BM_loops_to_corners(BMesh *bm, Mesh *me, int findex,
 
        }
 
-       for(i=0; i < numCol; i++) {
+       for (i=0; i < numCol; i++) {
                mcol = CustomData_get_n(&me->fdata, CD_MCOL, findex, i);
 
                j = 0;
@@ -265,11 +265,13 @@ static void UNUSED_FUNCTION(closest_to_line_segment_v3_d)(double *closest, doubl
 
        lambda= closest_to_line_v3_d(cp,v1, v2, v3);
 
-       if(lambda <= 0.0) {
+       if (lambda <= 0.0) {
                VECCOPY(closest, v2);
-       } else if(lambda >= 1.0) {
+       }
+       else if (lambda >= 1.0) {
                VECCOPY(closest, v3);
-       } else {
+       }
+       else {
                VECCOPY(closest, cp);
        }
 }
@@ -316,18 +318,18 @@ static double UNUSED_FUNCTION(dist_to_line_segment_v2_d)(double v1[3], double v2
        rc[0]= v3[0]-v2[0];
        rc[1]= v3[1]-v2[1];
        len= rc[0]*rc[0]+ rc[1]*rc[1];
-       if(len==0.0) {
+       if (len==0.0) {
                rc[0]= v1[0]-v2[0];
                rc[1]= v1[1]-v2[1];
                return sqrt(rc[0]*rc[0]+ rc[1]*rc[1]);
        }
        
        labda= (rc[0]*(v1[0]-v2[0]) + rc[1]*(v1[1]-v2[1]))/len;
-       if(labda<=0.0) {
+       if (labda<=0.0) {
                pt[0]= v2[0];
                pt[1]= v2[1];
        }
-       else if(labda>=1.0) {
+       else if (labda>=1.0) {
                pt[0]= v3[0];
                pt[1]= v3[1];
        }
@@ -359,7 +361,8 @@ static int isect_point_quad_v2_d(double pt[2], double v1[2], double v2[2], doubl
                                }
                        }
                }
-       } else {
+       }
+       else {
                if (! (line_point_side_v2_d(v2,v3,pt)>=0.0)) {
                        if (! (line_point_side_v2_d(v3,v4,pt)>=0.0)) {
                                if (! (line_point_side_v2_d(v4,v1,pt)>=0.0)) {
@@ -436,7 +439,8 @@ static double quad_coord(double aa[3], double bb[3], double cc[3], double dd[3],
                f2= fabs(f2);
                f1 = MIN2(f1, f2);
                CLAMP(f1, 0.0, 1.0+DBL_EPSILON);
-       } else {
+       }
+       else {
                f1 = -z/(y - 2*z);
                CLAMP(f1, 0.0, 1.0+DBL_EPSILON);
                
@@ -685,7 +689,8 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
                                
                                o1 = sides*y + sides-1;
                                o2 = (sides-1)*sides + y;
-                       } else {
+                       }
+                       else {
                                a1 = sides*y + sides-2;
                                a2 = sides*y + sides-2;
                                o1 = sides*y + sides-1;
index 4357f3ca8e396a25336b1cf803b6ce8377826294..9f446eec1f8de4490b25e5808ff1f9f9565495d5 100644 (file)
@@ -167,7 +167,7 @@ void  *bmiter__face_of_mesh_step(BMIter *iter)
 void  bmiter__edge_of_vert_begin(BMIter *iter)
 {
        init_iterator(iter);
-       if(iter->vdata->e) {
+       if (iter->vdata->e) {
                iter->firstedge = iter->vdata->e;
                iter->nextedge = iter->vdata->e;
        }
@@ -177,10 +177,10 @@ void  *bmiter__edge_of_vert_step(BMIter *iter)
 {
        BMEdge *current = iter->nextedge;
 
-       if(iter->nextedge)
+       if (iter->nextedge)
                iter->nextedge = bmesh_disk_nextedge(iter->nextedge, iter->vdata);
        
-       if(iter->nextedge == iter->firstedge) iter->nextedge = NULL; 
+       if (iter->nextedge == iter->firstedge) iter->nextedge = NULL;
 
        return current;
 }
@@ -194,9 +194,9 @@ void  bmiter__face_of_vert_begin(BMIter *iter)
 {
        init_iterator(iter);
        iter->count = 0;
-       if(iter->vdata->e)
+       if (iter->vdata->e)
                iter->count = bmesh_disk_count_facevert(iter->vdata);
-       if(iter->count) {
+       if (iter->count) {
                iter->firstedge = bmesh_disk_find_first_faceedge(iter->vdata->e, iter->vdata);
                iter->nextedge = iter->firstedge;
                iter->firstloop = bmesh_radial_find_first_facevert(iter->firstedge->l, iter->vdata);
@@ -207,20 +207,20 @@ void  *bmiter__face_of_vert_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->count && iter->nextloop) {
+       if (iter->count && iter->nextloop) {
                iter->count--;
                iter->nextloop = bmesh_radial_find_next_facevert(iter->nextloop, iter->vdata);
-               if(iter->nextloop == iter->firstloop) {
+               if (iter->nextloop == iter->firstloop) {
                        iter->nextedge = bmesh_disk_find_next_faceedge(iter->nextedge, iter->vdata);
                        iter->firstloop = bmesh_radial_find_first_facevert(iter->nextedge->l, iter->vdata);
                        iter->nextloop = iter->firstloop;
                }
        }
        
-       if(!iter->count) iter->nextloop = NULL;
+       if (!iter->count) iter->nextloop = NULL;
 
        
-       if(current) return current->f;
+       if (current) return current->f;
        return NULL;
 }
 
@@ -234,9 +234,9 @@ void  bmiter__loop_of_vert_begin(BMIter *iter)
 {
        init_iterator(iter);
        iter->count = 0;
-       if(iter->vdata->e)
+       if (iter->vdata->e)
                iter->count = bmesh_disk_count_facevert(iter->vdata);
-       if(iter->count) {
+       if (iter->count) {
                iter->firstedge = bmesh_disk_find_first_faceedge(iter->vdata->e, iter->vdata);
                iter->nextedge = iter->firstedge;
                iter->firstloop = bmesh_radial_find_first_facevert(iter->firstedge->l, iter->vdata);
@@ -247,20 +247,20 @@ void  *bmiter__loop_of_vert_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->count) {
+       if (iter->count) {
                iter->count--;
                iter->nextloop = bmesh_radial_find_next_facevert(iter->nextloop, iter->vdata);
-               if(iter->nextloop == iter->firstloop) {
+               if (iter->nextloop == iter->firstloop) {
                        iter->nextedge = bmesh_disk_find_next_faceedge(iter->nextedge, iter->vdata);
                        iter->firstloop = bmesh_radial_find_first_facevert(iter->nextedge->l, iter->vdata);
                        iter->nextloop = iter->firstloop;
                }
        }
        
-       if(!iter->count) iter->nextloop = NULL;
+       if (!iter->count) iter->nextloop = NULL;
 
        
-       if(current) return current;
+       if (current) return current;
        return NULL;
 }
 
@@ -281,13 +281,13 @@ void  *bmiter__loops_of_edge_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->nextloop)
+       if (iter->nextloop)
                iter->nextloop = bmesh_radial_nextloop(iter->nextloop);
 
-       if(iter->nextloop == iter->firstloop) 
+       if (iter->nextloop == iter->firstloop)
                iter->nextloop = NULL;
 
-       if(current) return current;
+       if (current) return current;
        return NULL;
 }
 
@@ -311,10 +311,10 @@ void  *bmiter__loops_of_loop_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
        
-       if(iter->nextloop) iter->nextloop = bmesh_radial_nextloop(iter->nextloop);
+       if (iter->nextloop) iter->nextloop = bmesh_radial_nextloop(iter->nextloop);
 
-       if(iter->nextloop == iter->firstloop) iter->nextloop = NULL;
-       if(current) return current;
+       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (current) return current;
        return NULL;
 }
 
@@ -327,7 +327,7 @@ void  bmiter__face_of_edge_begin(BMIter *iter)
 {
        init_iterator(iter);
        
-       if(iter->edata->l) {
+       if (iter->edata->l) {
                iter->firstloop = iter->edata->l;
                iter->nextloop = iter->edata->l;
        }
@@ -337,10 +337,10 @@ void  *bmiter__face_of_edge_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->nextloop) iter->nextloop = bmesh_radial_nextloop(iter->nextloop);
+       if (iter->nextloop) iter->nextloop = bmesh_radial_nextloop(iter->nextloop);
 
-       if(iter->nextloop == iter->firstloop) iter->nextloop = NULL;
-       if(current) return current->f;
+       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (current) return current->f;
        return NULL;
 }
 
@@ -359,10 +359,10 @@ void  *bmiter__vert_of_face_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->nextloop) iter->nextloop = iter->nextloop->next;
-       if(iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
 
-       if(current) return current->v;
+       if (current) return current->v;
        return NULL;
 }
 
@@ -381,10 +381,10 @@ void  *bmiter__edge_of_face_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->nextloop) iter->nextloop = iter->nextloop->next;
-       if(iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
        
-       if(current) return current->e;
+       if (current) return current->e;
        return NULL;
 }
 
@@ -403,8 +403,8 @@ void  *bmiter__loop_of_face_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if(iter->nextloop) iter->nextloop = iter->nextloop->next;
-       if(iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (iter->nextloop) iter->nextloop = iter->nextloop->next;
+       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
 
        return current;
 }
index 2e5a2a06e8402167feb050c2bfd597173ccbf1c9..cf621ee938f8fc3b2323fb7c50d24e66b350552a 100644 (file)
@@ -63,7 +63,7 @@ BM_INLINE void *BMIter_New(BMIter *iter, BMesh *bm, const char itype, void *data
        iter->bm = bm;
 
        /* inlining optimizes out this switch when called with the defined type */
-       switch(itype) {
+       switch (itype) {
                case BM_VERTS_OF_MESH:
                        iter->begin = bmiter__vert_of_mesh_begin;
                        iter->step =  bmiter__vert_of_mesh_step;
index 2c99599f797b51fb6a1b4b4fc49ce8fefac93a2e..7275648fd22e4f3cdb4a5e573c8762b0b537b236 100644 (file)
@@ -87,25 +87,25 @@ void BM_SelectMode_Flush(BMesh *bm)
 
        int totsel;
 
-       if(bm->selectmode & SCE_SELECT_VERTEX) {
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e= BMIter_Step(&edges)) {
-                       if(BM_TestHFlag(e->v1, BM_SELECT) && BM_TestHFlag(e->v2, BM_SELECT) && !BM_TestHFlag(e, BM_HIDDEN)) {
+       if (bm->selectmode & SCE_SELECT_VERTEX) {
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e= BMIter_Step(&edges)) {
+                       if (BM_TestHFlag(e->v1, BM_SELECT) && BM_TestHFlag(e->v2, BM_SELECT) && !BM_TestHFlag(e, BM_HIDDEN)) {
                                BM_SetHFlag(e, BM_SELECT);
                        }
                        else {
                                BM_ClearHFlag(e, BM_SELECT);
                        }
                }
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f= BMIter_Step(&faces)) {
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f= BMIter_Step(&faces)) {
                        totsel = 0;
                        l=(BMLoop*) bm_firstfaceloop(f);
                        do {
-                               if(BM_TestHFlag(l->v, BM_SELECT)) 
+                               if (BM_TestHFlag(l->v, BM_SELECT))
                                        totsel++;
                                l = l->next;
-                       } while(l != bm_firstfaceloop(f));
+                       } while (l != bm_firstfaceloop(f));
                        
-                       if(totsel == f->len && !BM_TestHFlag(f, BM_HIDDEN)) {
+                       if (totsel == f->len && !BM_TestHFlag(f, BM_HIDDEN)) {
                                BM_SetHFlag(f, BM_SELECT);
                        }
                        else {
@@ -113,17 +113,17 @@ void BM_SelectMode_Flush(BMesh *bm)
                        }
                }
        }
-       else if(bm->selectmode & SCE_SELECT_EDGE) {
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f= BMIter_Step(&faces)) {
+       else if (bm->selectmode & SCE_SELECT_EDGE) {
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f= BMIter_Step(&faces)) {
                        totsel = 0;
                        l = bm_firstfaceloop(f);
                        do {
-                               if(BM_TestHFlag(&(l->e->head), BM_SELECT)) 
+                               if (BM_TestHFlag(&(l->e->head), BM_SELECT))
                                        totsel++;
                                l = l->next;
-                       } while(l!=bm_firstfaceloop(f));
+                       } while (l!=bm_firstfaceloop(f));
                        
-                       if(totsel == f->len && !BM_TestHFlag(f, BM_HIDDEN)) {
+                       if (totsel == f->len && !BM_TestHFlag(f, BM_HIDDEN)) {
                                BM_SetHFlag(f, BM_SELECT);
                        }
                        else {
@@ -155,12 +155,13 @@ void BM_Select_Vert(BMesh *bm, BMVert *v, int select)
                return;
        }
 
-       if(select) {
+       if (select) {
                if (!BM_TestHFlag(v, BM_SELECT)) {
                        bm->totvertsel += 1;
                        BM_SetHFlag(v, BM_SELECT);
                }
-       } else {
+       }
+       else {
                if (BM_TestHFlag(v, BM_SELECT)) {
                        bm->totvertsel -= 1;
                        BM_ClearHFlag(v, BM_SELECT);
@@ -182,7 +183,7 @@ void BM_Select_Edge(BMesh *bm, BMEdge *e, int select)
                return;
        }
 
-       if(select) {
+       if (select) {
                if (!BM_TestHFlag(e, BM_SELECT)) bm->totedgesel += 1;
 
                BM_SetHFlag(&(e->head), BM_SELECT);
@@ -203,11 +204,11 @@ void BM_Select_Edge(BMesh *bm, BMEdge *e, int select)
                        BMEdge *e2;
                        int i;
 
-                       for(i = 0; i < 2; i++) {
+                       for (i = 0; i < 2; i++) {
                                int deselect = 1;
 
-                               for(e2 = BMIter_New(&iter, bm, BM_EDGES_OF_VERT, verts[i]); e2; e2 = BMIter_Step(&iter)) {
-                                       if(e2 == e) {
+                               for (e2 = BMIter_New(&iter, bm, BM_EDGES_OF_VERT, verts[i]); e2; e2 = BMIter_Step(&iter)) {
+                                       if (e2 == e) {
                                                continue;
                                        }
 
@@ -217,7 +218,7 @@ void BM_Select_Edge(BMesh *bm, BMEdge *e, int select)
                                        }
                                }
 
-                               if(deselect) BM_Select_Vert(bm, verts[i], FALSE);
+                               if (deselect) BM_Select_Vert(bm, verts[i], FALSE);
                        }
                }
                else {
@@ -245,7 +246,7 @@ void BM_Select_Face(BMesh *bm, BMFace *f, int select)
                return;
        }
 
-       if(select) {
+       if (select) {
                if (!BM_TestHFlag(f, BM_SELECT)) bm->totfacesel += 1;
 
                BM_SetHFlag(&(f->head), BM_SELECT);
@@ -254,7 +255,7 @@ void BM_Select_Face(BMesh *bm, BMFace *f, int select)
                        BM_Select_Vert(bm, l->v, TRUE);
                        BM_Select_Edge(bm, l->e, TRUE);
                        l = l->next;
-               } while(l != bm_firstfaceloop(f));
+               } while (l != bm_firstfaceloop(f));
        }
        else {
                BMIter liter;
@@ -313,28 +314,28 @@ void BM_Selectmode_Set(BMesh *bm, int selectmode)
        
        bm->selectmode = selectmode;
 
-       if(bm->selectmode & SCE_SELECT_VERTEX) {
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e= BMIter_Step(&edges))
+       if (bm->selectmode & SCE_SELECT_VERTEX) {
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e= BMIter_Step(&edges))
                        BM_ClearHFlag(e, 0);
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f= BMIter_Step(&faces))
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f= BMIter_Step(&faces))
                        BM_ClearHFlag(f, 0);
                BM_SelectMode_Flush(bm);
        }
-       else if(bm->selectmode & SCE_SELECT_EDGE) {
-               for(v= BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm ); v; v= BMIter_Step(&verts))
+       else if (bm->selectmode & SCE_SELECT_EDGE) {
+               for (v= BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v= BMIter_Step(&verts))
                        BM_ClearHFlag(v, 0);
-               for(e= BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e= BMIter_Step(&edges)) {
-                       if(BM_TestHFlag(&(e->head), BM_SELECT)) {
+               for (e= BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e= BMIter_Step(&edges)) {
+                       if (BM_TestHFlag(&(e->head), BM_SELECT)) {
                                BM_Select_Edge(bm, e, TRUE);
                        }
                }
                BM_SelectMode_Flush(bm);
        }
-       else if(bm->selectmode & SCE_SELECT_FACE) {
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e= BMIter_Step(&edges))
+       else if (bm->selectmode & SCE_SELECT_FACE) {
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e= BMIter_Step(&edges))
                        BM_ClearHFlag(e, 0);
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f= BMIter_Step(&faces)) {
-                       if(BM_TestHFlag(&(f->head), BM_SELECT)) {
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f= BMIter_Step(&faces)) {
+                       if (BM_TestHFlag(&(f->head), BM_SELECT)) {
                                BM_Select_Face(bm, f, TRUE);
                        }
                }
@@ -377,8 +378,8 @@ void BM_Select(struct BMesh *bm, void *element, int select)
        BMHeader *head = element;
 
        if     (head->htype == BM_VERT) BM_Select_Vert(bm, (BMVert*)element, select);
-       else if(head->htype == BM_EDGE) BM_Select_Edge(bm, (BMEdge*)element, select);
-       else if(head->htype == BM_FACE) BM_Select_Face(bm, (BMFace*)element, select);
+       else if (head->htype == BM_EDGE) BM_Select_Edge(bm, (BMEdge*)element, select);
+       else if (head->htype == BM_FACE) BM_Select_Face(bm, (BMFace*)element, select);
 }
 
 int BM_Selected(BMesh *UNUSED(bm), const void *element)
@@ -399,15 +400,16 @@ BMFace *BM_get_actFace(BMesh *bm, int sloppy)
 {
        if (bm->act_face) {
                return bm->act_face;
-       } else if (sloppy) {
+       }
+       else if (sloppy) {
                BMIter iter;
                BMFace *f= NULL;
                BMEditSelection *ese;
                
                /* Find the latest non-hidden face from the BMEditSelection */
                ese = bm->selected.last;
-               for (; ese; ese=ese->prev) {
-                       if(ese->htype == BM_FACE) {
+               for ( ; ese; ese=ese->prev) {
+                       if (ese->htype == BM_FACE) {
                                f= (BMFace *)ese->data;
                                
                                if (BM_TestHFlag(f, BM_HIDDEN)) {
@@ -499,7 +501,8 @@ void BM_editselection_plane(BMesh *bm, float r_plane[3], BMEditSelection *ese)
                if (ese->prev) { /*use previously selected data to make a useful vertex plane */
                        BM_editselection_center(bm, vec, ese->prev);
                        sub_v3_v3v3(r_plane, vec, eve->co);
-               } else {
+               }
+               else {
                        /* make a fake  plane thats at rightangles to the normal
                        we cant make a crossvec from a vec thats the same as the vec
                        unlikely but possible, so make sure if the normal is (0,0,1)
@@ -587,8 +590,8 @@ static int BM_check_selection(BMesh *bm, void *data)
 {
        BMEditSelection *ese;
        
-       for(ese = bm->selected.first; ese; ese = ese->next) {
-               if(ese->data == data) return 1;
+       for (ese = bm->selected.first; ese; ese = ese->next) {
+               if (ese->data == data) return 1;
        }
        
        return 0;
@@ -597,8 +600,8 @@ static int BM_check_selection(BMesh *bm, void *data)
 void BM_remove_selection(BMesh *bm, void *data)
 {
        BMEditSelection *ese;
-       for(ese=bm->selected.first; ese; ese = ese->next) {
-               if(ese->data == data) {
+       for (ese=bm->selected.first; ese; ese = ese->next) {
+               if (ese->data == data) {
                        BLI_freelinkN(&(bm->selected),ese);
                        break;
                }
@@ -614,8 +617,8 @@ void BM_clear_selection_history(BMesh *bm)
 void BM_store_selection(BMesh *bm, void *data)
 {
        BMEditSelection *ese;
-       if(!BM_check_selection(bm, data)) {
-               ese = (BMEditSelection*) MEM_callocN( sizeof(BMEditSelection), "BMEdit Selection");
+       if (!BM_check_selection(bm, data)) {
+               ese = (BMEditSelection*) MEM_callocN(sizeof(BMEditSelection), "BMEdit Selection");
                ese->htype = ((BMHeader*)data)->htype;
                ese->data = data;
                BLI_addtail(&(bm->selected),ese);
@@ -628,7 +631,7 @@ void BM_validate_selections(BMesh *bm)
 
        ese = bm->selected.first;
 
-       while(ese) {
+       while (ese) {
                nextese = ese->next;
                if (!BM_TestHFlag(ese->data, BM_SELECT)) {
                        BLI_freelinkN(&(bm->selected), ese);
index fe1a5ac9455ca365c571db18dff902f03ec038ae..202a2fe7cfa8a9e29b4ac0bf9ebc164539f9cfa3 100644 (file)
@@ -117,18 +117,18 @@ void BM_Free_Mesh_Data(BMesh *bm)
        BMIter faces;
        BMIter loops;
        
-       for(v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm ); v; v = BMIter_Step(&verts)) CustomData_bmesh_free_block( &(bm->vdata), &(v->head.data) );
-       for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm ); e; e = BMIter_Step(&edges)) CustomData_bmesh_free_block( &(bm->edata), &(e->head.data) );
-       for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm ); f; f = BMIter_Step(&faces)) {
-               CustomData_bmesh_free_block( &(bm->pdata), &(f->head.data) );
-               for(l = BMIter_New(&loops, bm, BM_LOOPS_OF_FACE, f ); l; l = BMIter_Step(&loops)) CustomData_bmesh_free_block( &(bm->ldata), &(l->head.data) );
+       for (v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) CustomData_bmesh_free_block(&(bm->vdata), &(v->head.data));
+       for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) CustomData_bmesh_free_block(&(bm->edata), &(e->head.data));
+       for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
+               CustomData_bmesh_free_block(&(bm->pdata), &(f->head.data));
+               for (l = BMIter_New(&loops, bm, BM_LOOPS_OF_FACE, f); l; l = BMIter_Step(&loops)) CustomData_bmesh_free_block(&(bm->ldata), &(l->head.data));
        }
 
        /*Free custom data pools, This should probably go in CustomData_free?*/
-       if(bm->vdata.totlayer) BLI_mempool_destroy(bm->vdata.pool);
-       if(bm->edata.totlayer) BLI_mempool_destroy(bm->edata.pool);
-       if(bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
-       if(bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
+       if (bm->vdata.totlayer) BLI_mempool_destroy(bm->vdata.pool);
+       if (bm->edata.totlayer) BLI_mempool_destroy(bm->edata.pool);
+       if (bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
+       if (bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
 
        /*free custom data*/
        CustomData_free(&bm->vdata,0);
@@ -232,11 +232,11 @@ void BM_Compute_Normals(BMesh *bm)
                if (BM_TestHFlag(f, BM_HIDDEN))
                        continue;
 
-               if(f->len > maxlength) maxlength = f->len;
+               if (f->len > maxlength) maxlength = f->len;
        }
        
        /*make sure we actually have something to do*/
-       if(maxlength < 3) return; 
+       if (maxlength < 3) return;
 
        /*allocate projectverts array*/
        projectverts = MEM_callocN(sizeof(float) * maxlength * 3, "BM normal computation array");
@@ -396,7 +396,8 @@ static void bmesh_set_mdisps_space(BMesh *bm, int from, int to)
                                
                                if (lmd->disps && lmd->totdisp == mdisps->totdisp) {
                                        memcpy(lmd->disps, mdisps->disps, sizeof(float)*3*lmd->totdisp);
-                               } else if (mdisps->disps) {
+                               }
+                               else if (mdisps->disps) {
                                        if (lmd->disps)
                                                MEM_freeN(lmd->disps);
                                        
@@ -447,7 +448,8 @@ void bmesh_begin_edit(BMesh *bm, int flag)
                /*ensure correct normals, if possible*/
                bmesh_rationalize_normals(bm, 0);
                BM_Compute_Normals(bm);
-       } else if (flag & BMOP_RATIONALIZE_NORMALS) {
+       }
+       else if (flag & BMOP_RATIONALIZE_NORMALS) {
                bmesh_rationalize_normals(bm, 0);
        }
 #else
@@ -466,7 +468,8 @@ void bmesh_end_edit(BMesh *bm, int flag)
                /*set normals to their previous winding*/
                bmesh_rationalize_normals(bm, 1);
                bmesh_set_mdisps_space(bm, MULTIRES_SPACE_ABSOLUTE, MULTIRES_SPACE_TANGENT);
-       } else if (flag & BMOP_RATIONALIZE_NORMALS) {
+       }
+       else if (flag & BMOP_RATIONALIZE_NORMALS) {
                bmesh_rationalize_normals(bm, 1);
        }
 #else
index 806a0eedecf4976e1b9176185dc73f9472354547..09cdc80a76e5f7f1df20e5b5da88827a2027aed6 100644 (file)
@@ -73,7 +73,7 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
        if (!v) return 0;
        
        e = BMIter_New(&iter, bm, BM_EDGES_OF_VERT, v);
-       for (; e; e=BMIter_Step(&iter)) {
+       for ( ; e; e=BMIter_Step(&iter)) {
                len++;
        }
        
@@ -84,12 +84,15 @@ int BM_Dissolve_Vert(BMesh *bm, BMVert *v)
                return 1;
        }
 
-       if(BM_Nonmanifold_Vert(bm, v)) {
+       if (BM_Nonmanifold_Vert(bm, v)) {
                if (!v->e) BM_Kill_Vert(bm, v);
                else if (!v->e->l) {
                        BM_Kill_Edge(bm, v->e);
                        BM_Kill_Vert(bm, v);
-               } else return 0;
+               }
+               else {
+                       return 0;
+               }
 
                return 1;
        }
@@ -103,22 +106,22 @@ int BM_Dissolve_Disk(BMesh *bm, BMVert *v)
        BMEdge *e, *keepedge=NULL, *baseedge=NULL;
        int len= 0;
 
-       if(BM_Nonmanifold_Vert(bm, v)) {
+       if (BM_Nonmanifold_Vert(bm, v)) {
                return 0;
        }
        
-       if(v->e) {
+       if (v->e) {
                /*v->e we keep, what else?*/
                e = v->e;
                do {
                        e = bmesh_disk_nextedge(e,v);
-                       if(!(BM_Edge_Share_Faces(e, v->e))) {
+                       if (!(BM_Edge_Share_Faces(e, v->e))) {
                                keepedge = e;
                                baseedge = v->e;
                                break;
                        }
                        len++;
-               } while(e != v->e);
+               } while (e != v->e);
        }
        
        /*this code for handling 2 and 3-valence verts
@@ -155,16 +158,16 @@ int BM_Dissolve_Disk(BMesh *bm, BMVert *v)
                return 1;
        }
 
-       if(keepedge) {
+       if (keepedge) {
                int done = 0;
 
-               while(!done) {
+               while (!done) {
                        done = 1;
                        e = v->e;
                        do {
                                f = NULL;
                                len = bmesh_radial_length(e->l);
-                               if(len == 2 && (e!=baseedge) && (e!=keepedge)) {
+                               if (len == 2 && (e!=baseedge) && (e!=keepedge)) {
                                        f = BM_Join_TwoFaces(bm, e->l->f, e->l->radial_next->f, e);
                                        /*return if couldn't join faces in manifold
                                          conditions.*/
@@ -172,12 +175,12 @@ int BM_Dissolve_Disk(BMesh *bm, BMVert *v)
                                        if (!f) return 0;
                                }
 
-                               if(f) {
+                               if (f) {
                                        done = 0;
                                        break;
                                }
                                e = bmesh_disk_nextedge(e, v);
-                       } while(e != v->e);
+                       } while (e != v->e);
                }
 
                /*collapse the vertex*/
@@ -209,9 +212,9 @@ void BM_Dissolve_Disk(BMesh *bm, BMVert *v)
        BMIter iter;
        int done, len;
        
-       if(v->e) {
+       if (v->e) {
                done = 0;
-               while(!done) {
+               while (!done) {
                        done = 1;
                        
                        /*loop the edges looking for an edge to dissolve*/
@@ -219,12 +222,12 @@ void BM_Dissolve_Disk(BMesh *bm, BMVert *v)
                             e = BMIter_Step(&iter)) {
                                f = NULL;
                                len = bmesh_cycle_length(&(e->l->radial));
-                               if(len == 2) {
+                               if (len == 2) {
                                        f = BM_Join_TwoFaces(bm,e->l->f,((BMLoop*)
                                              (e->l->radial_next))->f, 
                                               e);
                                }
-                               if(f) {
+                               if (f) {
                                        done = 0;
                                        break;
                                }
@@ -259,16 +262,16 @@ BMFace *BM_Join_TwoFaces(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
        BMFace *faces[2] = {f1, f2};
        
        jed = e;
-       if(!jed) {
+       if (!jed) {
                /*search for an edge that has both these faces in its radial cycle*/
                l1 = bm_firstfaceloop(f1);
                do {
-                       if(l1->radial_next->f == f2 ) {
+                       if (l1->radial_next->f == f2) {
                                jed = l1->e;
                                break;
                        }
                        l1 = l1->next;
-               } while(l1!=bm_firstfaceloop(f1));
+               } while (l1!=bm_firstfaceloop(f1));
        }
 
        if (!jed) {
@@ -431,7 +434,7 @@ BMEdge* BM_Collapse_Vert_Faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, con
        if (ke->l) {
                l = ke->l;
                do {
-                       if(l->v == tv && l->next->v == kv) {
+                       if (l->v == tv && l->next->v == kv) {
                                tvloop = l;
                                kvloop = l->next;
 
@@ -650,7 +653,7 @@ BMVert  *BM_Split_Edge_Multi(BMesh *bm, BMEdge *e, int numcuts)
        float percent;
        BMVert *nv = NULL;
        
-       for(i=0; i < numcuts; i++) {
+       for (i=0; i < numcuts; i++) {
                percent = 1.0f / (float)(numcuts + 1 - i);
                nv = BM_Split_Edge(bm, e->v2, e, NULL, percent);
        }
@@ -740,7 +743,8 @@ BMEdge *BM_Rotate_Edge(BMesh *bm, BMEdge *e, int ccw)
        if (ccw) {
                l1 = l1->prev;
                l2 = l2->prev;
-       } else {
+       }
+       else {
                l1 = l1->next;
                l2 = l2->next;
        }
index fba0f74c41f1d3b28194d498539b123c2de56510..56a24e0fd731f33a9127a584f37dc8c57b45d98a 100644 (file)
@@ -174,7 +174,7 @@ static BMLoop *bmesh_create_loop(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f, con
 
        bm->totloop++;
 
-       if(example)
+       if (example)
                CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, example->head.data, &l->head.data);
        else
                CustomData_bmesh_set_default(&bm->ldata, &l->head.data);
@@ -212,7 +212,8 @@ BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
                if (copyverts) {
                        BMVert *v = BM_Make_Vert(bm, l->v->co, l->v);
                        BLI_array_append(verts, v);
-               } else {        
+               }
+               else {
                        BLI_array_append(verts, l->v);
                }
                l = l->next;
@@ -228,14 +229,16 @@ BMFace *BM_Copy_Face(BMesh *bm, BMFace *f, int copyedges, int copyverts)
                        if (l->e->v1 == verts[i]) {
                                v1 = verts[i];
                                v2 = verts[(i+1)%f->len];
-                       } else {
+                       }
+                       else {
                                v2 = verts[i];
                                v1 = verts[(i+1)%f->len];
                        }
                        
                        e = BM_Make_Edge(bm,  v1, v2, l->e, 0);
                        BLI_array_append(edges, e);
-               } else {
+               }
+               else {
                        BLI_array_append(edges, l->e);
                }
                
@@ -648,14 +651,14 @@ static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst)
 
        len = bmesh_loop_length(l);
 
-       for(i=0, curloop = l; i< len; i++, curloop= curloop->next) {
+       for (i=0, curloop = l; i< len; i++, curloop= curloop->next) {
                BMEdge *curedge = curloop->e;
                bmesh_radial_remove_loop(curloop, curedge);
                BLI_array_append(edar, curedge);
        }
 
        /*actually reverse the loop.*/
-       for(i=0, curloop = l; i < len; i++) {
+       for (i=0, curloop = l; i < len; i++) {
                oldnext = curloop->next;
                oldprev = curloop->prev;
                curloop->next = oldprev;
@@ -681,17 +684,17 @@ static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst)
                }
        }
 
-       if(len == 2) { /* two edged face */
+       if (len == 2) { /* two edged face */
                /* do some verification here! */
                l->e = edar[1];
                l->next->e = edar[0];
        }
        else {
-               for(i=0, curloop = l; i < len; i++, curloop = curloop->next) {
+               for (i=0, curloop = l; i < len; i++, curloop = curloop->next) {
                        edok = 0;
-                       for(j=0; j < len; j++) {
+                       for (j=0; j < len; j++) {
                                edok = bmesh_verts_in_edge(curloop->v, curloop->next->v, edar[j]);
-                               if(edok) {
+                               if (edok) {
                                        curloop->e = edar[j];
                                        break;
                                }
@@ -699,11 +702,11 @@ static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst)
                }
        }
        /*rebuild radial*/
-       for(i=0, curloop = l; i < len; i++, curloop = curloop->next)
+       for (i=0, curloop = l; i < len; i++, curloop = curloop->next)
                bmesh_radial_append(curloop->e, curloop);
 
        /*validate radial*/
-       for(i=0, curloop = l; i < len; i++, curloop = curloop->next) {
+       for (i=0, curloop = l; i < len; i++, curloop = curloop->next) {
                BM_CHECK_ELEMENT(bm, curloop);
                BM_CHECK_ELEMENT(bm, curloop->e);
                BM_CHECK_ELEMENT(bm, curloop->v);
@@ -865,7 +868,8 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
                        if (rlen > 2) {
                                err = "Input faces do not form a contiguous manifold region";
                                goto error;
-                       } else if (rlen == 1) {
+                       }
+                       else if (rlen == 1) {
                                BLI_array_append(edges, l->e);
 
                                if (!v1) {
@@ -873,7 +877,8 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
                                        v2 = BM_OtherEdgeVert(l->e, l->v);
                                }
                                tote++;
-                       } else if (rlen == 2) {
+                       }
+                       else if (rlen == 2) {
                                int d1, d2;
 
                                d1 = disk_is_flagged(l->e->v1, _FLAG_JF);
@@ -882,7 +887,8 @@ BMFace *BM_Join_Faces(BMesh *bm, BMFace **faces, int totface)
                                if (!d1 && !d2 && !bmesh_api_getflag(l->e, _FLAG_JF)) {
                                        BLI_array_append(deledges, l->e);
                                        bmesh_api_setflag(l->e, _FLAG_JF);
-                               } else {
+                               }
+                               else {
                                        if (d1 && !bmesh_api_getflag(l->e->v1, _FLAG_JF)) {
                                                BLI_array_append(delverts, l->e->v1);
                                                bmesh_api_setflag(l->e->v1, _FLAG_JF);
@@ -1074,12 +1080,12 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
 
        /*verify that v1 and v2 are in face.*/
        len = f->len;
-       for(i = 0, curloop = bm_firstfaceloop(f); i < len; i++, curloop = curloop->next) {
-               if(curloop->v == v1) v1loop = curloop;
-               else if(curloop->v == v2) v2loop = curloop;
+       for (i = 0, curloop = bm_firstfaceloop(f); i < len; i++, curloop = curloop->next) {
+               if (curloop->v == v1) v1loop = curloop;
+               else if (curloop->v == v2) v2loop = curloop;
        }
 
-       if(!v1loop || !v2loop) return NULL;
+       if (!v1loop || !v2loop) return NULL;
 
        /*allocate new edge between v1 and v2*/
        e = BM_Make_Edge(bm, v1, v2, NULL, 0);
@@ -1132,12 +1138,13 @@ BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
 
        f->len = f1len;
 
-       if(rl) *rl = f2loop;
+       if (rl) *rl = f2loop;
 
        if (holes) {
                BLI_movelisttolist(&f2->loops, holes);
-       } else {
-               /*this code is not significant until holes actually work ;) */
+       }
+       else {
+               /* this code is not significant until holes actually work ;) */
                //printf("warning: call to split face euler without holes argument; holes will be tossed.\n");
                for (lst=f->loops.last; lst != f->loops.first; lst=lst2) {
                        lst2 = lst->prev;
@@ -1174,7 +1181,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
        BMVert *nv, *ov;
        int i, edok, valence1=0, valence2=0;
 
-       if(bmesh_vert_in_edge(e,tv) == 0) return NULL;
+       if (bmesh_vert_in_edge(e,tv) == 0) return NULL;
        ov = bmesh_edge_getothervert(e,tv);
 
        /*count valence of v1*/
@@ -1206,22 +1213,22 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
 
        /*verify disk cycles*/
        edok = bmesh_disk_validate(valence1, ov->e, ov);
-       if(!edok) bmesh_error();
+       if (!edok) bmesh_error();
        edok = bmesh_disk_validate(valence2, tv->e, tv);
-       if(!edok) bmesh_error();
+       if (!edok) bmesh_error();
        edok = bmesh_disk_validate(2, nv->e, nv);
-       if(!edok) bmesh_error();
+       if (!edok) bmesh_error();
 
        /*Split the radial cycle if present*/
        nextl = e->l;
        e->l = NULL;
-       if(nextl) {
+       if (nextl) {
                BMLoop *nl, *l;
                int radlen = bmesh_radial_length(nextl);
                int first1=0, first2=0;
 
                /*Take the next loop. Remove it from radial. Split it. Append to appropriate radials.*/
-               while(nextl) {
+               while (nextl) {
                        l=nextl;
                        l->f->len++;
                        nextl = nextl!=nextl->radial_next ? nextl->radial_next : NULL;
@@ -1235,17 +1242,17 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
                        nl->v = nv;
 
                        /*assign the correct edge to the correct loop*/
-                       if(bmesh_verts_in_edge(nl->v, nl->next->v, e)) {
+                       if (bmesh_verts_in_edge(nl->v, nl->next->v, e)) {
                                nl->e = e;
                                l->e = ne;
 
                                /*append l into ne's rad cycle*/
-                               if(!first1) {
+                               if (!first1) {
                                        first1 = 1;
                                        l->radial_next = l->radial_prev = NULL;
                                }
 
-                               if(!first2) {
+                               if (!first2) {
                                        first2 = 1;
                                        l->radial_next = l->radial_prev = NULL;
                                }
@@ -1253,17 +1260,17 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
                                bmesh_radial_append(nl->e, nl);
                                bmesh_radial_append(l->e, l);
                        }
-                       else if(bmesh_verts_in_edge(nl->v, nl->next->v, ne)) {
+                       else if (bmesh_verts_in_edge(nl->v, nl->next->v, ne)) {
                                nl->e = ne;
                                l->e = e;
 
                                /*append l into ne's rad cycle*/
-                               if(!first1) {
+                               if (!first1) {
                                        first1 = 1;
                                        l->radial_next = l->radial_prev = NULL;
                                }
 
-                               if(!first2) {
+                               if (!first2) {
                                        first2 = 1;
                                        l->radial_next = l->radial_prev = NULL;
                                }
@@ -1276,19 +1283,19 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
 
                /*verify length of radial cycle*/
                edok = bmesh_radial_validate(radlen, e->l);
-               if(!edok) bmesh_error();
+               if (!edok) bmesh_error();
                edok = bmesh_radial_validate(radlen, ne->l);
-               if(!edok) bmesh_error();
+               if (!edok) bmesh_error();
 
                /*verify loop->v and loop->next->v pointers for e*/
-               for(i=0,l=e->l; i < radlen; i++, l = l->radial_next) {
-                       if(!(l->e == e)) bmesh_error();
-                       //if(!(l->radial_next == l)) bmesh_error();
-                       if(l->prev->e != ne && l->next->e != ne) bmesh_error();
+               for (i=0,l=e->l; i < radlen; i++, l = l->radial_next) {
+                       if (!(l->e == e)) bmesh_error();
+                       //if (!(l->radial_next == l)) bmesh_error();
+                       if (l->prev->e != ne && l->next->e != ne) bmesh_error();
                        edok = bmesh_verts_in_edge(l->v, l->next->v, e);
-                       if(!edok) bmesh_error();
-                       if(l->v == l->next->v) bmesh_error();
-                       if(l->e == l->next->e) bmesh_error();
+                       if (!edok) bmesh_error();
+                       if (l->v == l->next->v) bmesh_error();
+                       if (l->e == l->next->e) bmesh_error();
 
                        /*verify loop cycle for kloop->f*/
                        BM_CHECK_ELEMENT(bm, l);
@@ -1297,14 +1304,14 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
                        BM_CHECK_ELEMENT(bm, l->f);
                }
                /*verify loop->v and loop->next->v pointers for ne*/
-               for(i=0,l=ne->l; i < radlen; i++, l = l->radial_next) {
-                       if(!(l->e == ne)) bmesh_error();
-                       //if(!(l->radial_next == l)) bmesh_error();
-                       ifl->prev->e != e && l->next->e != e) bmesh_error();
+               for (i=0,l=ne->l; i < radlen; i++, l = l->radial_next) {
+                       if (!(l->e == ne)) bmesh_error();
+                       //if (!(l->radial_next == l)) bmesh_error();
+                       if (l->prev->e != e && l->next->e != e) bmesh_error();
                        edok = bmesh_verts_in_edge(l->v, l->next->v, ne);
-                       if(!edok) bmesh_error();
-                       if(l->v == l->next->v) bmesh_error();
-                       if(l->e == l->next->e) bmesh_error();
+                       if (!edok) bmesh_error();
+                       if (l->v == l->next->v) bmesh_error();
+                       if (l->e == l->next->e) bmesh_error();
 
                        BM_CHECK_ELEMENT(bm, l);
                        BM_CHECK_ELEMENT(bm, l->v);
@@ -1319,7 +1326,7 @@ BMVert *bmesh_semv(BMesh *bm, BMVert *tv, BMEdge *e, BMEdge **re)
        BM_CHECK_ELEMENT(bm, e);
        BM_CHECK_ELEMENT(bm, tv);
 
-       if(re) *re = ne;
+       if (re) *re = ne;
        return nv;
 }
 
@@ -1361,16 +1368,16 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
        BMLoop *killoop, *l;
        int len,radlen=0, halt = 0, i, valence1, valence2,edok;
 
-       if(bmesh_vert_in_edge(ke,kv) == 0) return 0;
+       if (bmesh_vert_in_edge(ke,kv) == 0) return 0;
        len = bmesh_disk_count(kv);
        
-       if(len == 2) {
+       if (len == 2) {
                oe = bmesh_disk_nextedge(ke, kv);
                tv = bmesh_edge_getothervert(ke, kv);
                ov = bmesh_edge_getothervert(oe, kv);           
                halt = bmesh_verts_in_edge(kv, tv, oe); /*check for double edges*/
                
-               if(halt) {
+               if (halt) {
                        return 0;
                }
                else {
@@ -1389,11 +1396,11 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
                
                        /*deal with radial cycle of ke*/
                        radlen = bmesh_radial_length(ke->l);
-                       if(ke->l) {
+                       if (ke->l) {
                                /*first step, fix the neighboring loops of all loops in ke's radial cycle*/
-                               for(i=0,killoop = ke->l; i<radlen; i++, killoop = bmesh_radial_nextloop(killoop)) {
+                               for (i=0,killoop = ke->l; i<radlen; i++, killoop = bmesh_radial_nextloop(killoop)) {
                                        /*relink loops and fix vertex pointer*/
-                                       if( killoop->next->v == kv ) killoop->next->v = tv;
+                                       if (killoop->next->v == kv) killoop->next->v = tv;
 
                                        killoop->next->prev = killoop->prev;
                                        killoop->prev->next = killoop->next;
@@ -1428,7 +1435,7 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
 
                                /*Validate radial cycle of oe*/
                                edok = bmesh_radial_validate(radlen,oe->l);
-                               if(!edok) bmesh_error();
+                               if (!edok) bmesh_error();
 
                        }
 
@@ -1440,17 +1447,17 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
 
                        /*Validate disk cycle lengths of ov,tv are unchanged*/
                        edok = bmesh_disk_validate(valence1, ov->e, ov);
-                       if(!edok) bmesh_error();
+                       if (!edok) bmesh_error();
                        edok = bmesh_disk_validate(valence2, tv->e, tv);
-                       if(!edok) bmesh_error();
+                       if (!edok) bmesh_error();
 
                        /*Validate loop cycle of all faces attached to oe*/
-                       for(i=0,l = oe->l; i<radlen; i++, l = bmesh_radial_nextloop(l)) {
-                               if(l->e != oe) bmesh_error();
+                       for (i=0,l = oe->l; i<radlen; i++, l = bmesh_radial_nextloop(l)) {
+                               if (l->e != oe) bmesh_error();
                                edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
-                               if(!edok) bmesh_error();
+                               if (!edok) bmesh_error();
                                edok = bmesh_loop_validate(l->f);
-                               if(!edok) bmesh_error();
+                               if (!edok) bmesh_error();
 
                                BM_CHECK_ELEMENT(bm, l);
                                BM_CHECK_ELEMENT(bm, l->v);
@@ -1506,18 +1513,18 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
        BMIter iter;
 
        /*can't join a face to itself*/
-       if(f1 == f2) return NULL;
+       if (f1 == f2) return NULL;
        /*verify that e is in both f1 and f2*/
        f1len = f1->len;
        f2len = f2->len;
        BM_ITER(curloop, &iter, bm, BM_LOOPS_OF_FACE, f1) {
-               if(curloop->e == e) {
+               if (curloop->e == e) {
                        f1loop = curloop;
                        break;
                }
        }
        BM_ITER(curloop, &iter, bm, BM_LOOPS_OF_FACE, f2) {
-               if(curloop->e == e) {
+               if (curloop->e == e) {
                        f2loop = curloop;
                        break;
                }
@@ -1526,45 +1533,45 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
        
        /*validate that edge is 2-manifold edge*/
        radlen = bmesh_radial_length(f1loop);
-       if(radlen != 2) return NULL;
+       if (radlen != 2) return NULL;
 
        /*validate direction of f2's loop cycle is compatible.*/
-       if(f1loop->v == f2loop->v) return NULL;
+       if (f1loop->v == f2loop->v) return NULL;
 
        /*
                validate that for each face, each vertex has another edge in its disk cycle that is 
                not e, and not shared.
        */
-       if(bmesh_radial_find_face(f1loop->next->e,f2)) return NULL;
-       if(bmesh_radial_find_face(f1loop->prev->e,f2)) return NULL;
-       if(bmesh_radial_find_face(f2loop->next->e,f1)) return NULL;
-       if(bmesh_radial_find_face(f2loop->prev->e,f1)) return NULL;
+       if (bmesh_radial_find_face(f1loop->next->e,f2)) return NULL;
+       if (bmesh_radial_find_face(f1loop->prev->e,f2)) return NULL;
+       if (bmesh_radial_find_face(f2loop->next->e,f1)) return NULL;
+       if (bmesh_radial_find_face(f2loop->prev->e,f1)) return NULL;
        
        /*validate only one shared edge*/
        shared = BM_Face_Share_Edges(f1,f2);
-       if(shared > 1) return NULL;
+       if (shared > 1) return NULL;
 
        /*validate no internal joins*/
-       for(i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next)
+       for (i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next)
                bmesh_api_setindex(curloop->v, 0);
-       for(i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next)
+       for (i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next)
                bmesh_api_setindex(curloop->v, 0);
 
-       for(i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next) {
+       for (i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next) {
                if (curloop != f1loop)
                        bmesh_api_setindex(curloop->v, bmesh_api_getindex(curloop->v) + 1);
        }
-       for(i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next) {
+       for (i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next) {
                if (curloop != f2loop)
                        bmesh_api_setindex(curloop->v, bmesh_api_getindex(curloop->v) + 1);
        }
 
-       for(i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next) {
+       for (i=0, curloop = bm_firstfaceloop(f1); i < f1len; i++, curloop = curloop->next) {
                if (bmesh_api_getindex(curloop->v) > 1)
                        return NULL;
        }
        
-       for(i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next) {
+       for (i=0, curloop = bm_firstfaceloop(f2); i < f2len; i++, curloop = curloop->next) {
                if (bmesh_api_getindex(curloop->v) > 1)
                        return NULL;
        }
@@ -1577,7 +1584,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
        f2loop->prev->next = f1loop->next;
        
        /*if f1loop was baseloop, make f1loop->next the base.*/
-       if(bm_firstfaceloop(f1) == f1loop)
+       if (bm_firstfaceloop(f1) == f1loop)
                bm_firstfaceloop(f1) = f1loop->next;
 
        /*increase length of f1*/
@@ -1585,7 +1592,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
 
        /*make sure each loop points to the proper face*/
        newlen = f1->len;
-       for(i = 0, curloop = bm_firstfaceloop(f1); i < newlen; i++, curloop = curloop->next)
+       for (i = 0, curloop = bm_firstfaceloop(f1); i < newlen; i++, curloop = curloop->next)
                curloop->f = f1;
        
        /*remove edge from the disk cycle of its two vertices.*/
@@ -1610,7 +1617,7 @@ BMFace *bmesh_jfke(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
 
        /*validate the new loop cycle*/
        edok = bmesh_loop_validate(f1);
-       if(!edok) bmesh_error();
+       if (!edok) bmesh_error();
        
        return f1;
 }
index 7ebf686c9d81cb228a36f3e07d41fe95b9d1d793..4695cda4a3f8932b3a1d8c7b2f2e926b8106b169 100644 (file)
@@ -119,7 +119,7 @@ void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
  */
 void BMO_pop(BMesh *bm)
 {
-       if(bm->stackdepth > 1)
+       if (bm->stackdepth > 1)
                free_flag_layer(bm);
 
        bm->stackdepth--;
@@ -150,7 +150,7 @@ void BMO_Init_Op(BMesh *bm, BMOperator *op, const char *opname)
        op->flag = opdefines[opcode]->flag;
        
        /*initialize the operator slot types*/
-       for(i = 0; opdefines[opcode]->slottypes[i].type; i++) {
+       for (i = 0; opdefines[opcode]->slottypes[i].type; i++) {
                op->slots[i].slottype = opdefines[opcode]->slottypes[i].type;
                op->slots[i].index = i;
        }
@@ -177,11 +177,11 @@ void BMO_Exec_Op(BMesh *bm, BMOperator *op)
        
        BMO_push(bm, op);
 
-       if(bm->stackdepth == 2)
+       if (bm->stackdepth == 2)
                bmesh_begin_edit(bm, op->flag);
        op->exec(bm, op);
        
-       if(bm->stackdepth == 2)
+       if (bm->stackdepth == 2)
                bmesh_end_edit(bm, op->flag);
        
        BMO_pop(bm);    
@@ -254,10 +254,10 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
        BMOpSlot *source_slot = BMO_GetSlot(source_op, src);
        BMOpSlot *dest_slot = BMO_GetSlot(dest_op, dst);
 
-       if(source_slot == dest_slot)
+       if (source_slot == dest_slot)
                return;
 
-       if(source_slot->slottype != dest_slot->slottype)
+       if (source_slot->slottype != dest_slot->slottype)
                return;
        
        if (dest_slot->slottype > BMOP_OPSLOT_VEC) {
@@ -265,11 +265,12 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
                        /*do buffer copy*/
                        dest_slot->data.buf = NULL;
                        dest_slot->len = source_slot->len;
-                       if(dest_slot->len) {
+                       if (dest_slot->len) {
                                dest_slot->data.buf = BLI_memarena_alloc(dest_op->arena, BMOP_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len);
                                memcpy(dest_slot->data.buf, source_slot->data.buf, BMOP_OPSLOT_TYPEINFO[dest_slot->slottype] * dest_slot->len);
                        }
-               } else {
+               }
+               else {
                        GHashIterator it;
                        element_mapping *srcmap, *dstmap;
 
@@ -283,7 +284,7 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
                        }
 
                        BLI_ghashIterator_init(&it, source_slot->data.ghash);
-                       for (; (srcmap=BLI_ghashIterator_getValue(&it));
+                       for ( ; (srcmap=BLI_ghashIterator_getValue(&it));
                              BLI_ghashIterator_step(&it))
                        {
                                dstmap = BLI_memarena_alloc(dest_op->arena, 
@@ -297,7 +298,8 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
                                                dstmap->element, dstmap);                               
                        }
                }
-       } else {
+       }
+       else {
                dest_slot->data = source_slot->data;
        }
 }
@@ -313,7 +315,7 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
 void BMO_Set_Float(BMOperator *op, const char *slotname, float f)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_FLT) )
+       if (!(slot->slottype == BMOP_OPSLOT_FLT))
                return;
 
        slot->data.f = f;
@@ -322,7 +324,7 @@ void BMO_Set_Float(BMOperator *op, const char *slotname, float f)
 void BMO_Set_Int(BMOperator *op, const char *slotname, int i)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_INT) )
+       if (!(slot->slottype == BMOP_OPSLOT_INT))
                return;
 
        slot->data.i = i;
@@ -332,7 +334,7 @@ void BMO_Set_Int(BMOperator *op, const char *slotname, int i)
 void BMO_Set_Mat(struct BMOperator *op, const char *slotname, float *mat, int size)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_MAT) )
+       if (!(slot->slottype == BMOP_OPSLOT_MAT))
                return;
 
        slot->len = 4;
@@ -340,9 +342,11 @@ void BMO_Set_Mat(struct BMOperator *op, const char *slotname, float *mat, int si
        
        if (size == 4) {
                memcpy(slot->data.p, mat, sizeof(float)*4*4);
-       } else if (size == 3) {
+       }
+       else if (size == 3) {
                copy_m4_m3(slot->data.p, (float (*)[3])mat);
-       } else {
+       }
+       else {
                fprintf(stderr, "%s: invalid size argument %d (bmesh internal error)\n", __func__, size);
 
                memset(slot->data.p, 0, sizeof(float)*4*4);
@@ -353,7 +357,7 @@ void BMO_Set_Mat(struct BMOperator *op, const char *slotname, float *mat, int si
 void BMO_Get_Mat4(struct BMOperator *op, const char *slotname, float mat[4][4])
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_MAT) )
+       if (!(slot->slottype == BMOP_OPSLOT_MAT))
                return;
 
        memcpy(mat, slot->data.p, sizeof(float)*4*4);
@@ -362,7 +366,7 @@ void BMO_Get_Mat4(struct BMOperator *op, const char *slotname, float mat[4][4])
 void BMO_Get_Mat3(struct BMOperator *op, const char *slotname, float mat[3][3])
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_MAT) )
+       if (!(slot->slottype == BMOP_OPSLOT_MAT))
                return;
 
        copy_m3_m4(mat, slot->data.p);
@@ -371,7 +375,7 @@ void BMO_Get_Mat3(struct BMOperator *op, const char *slotname, float mat[3][3])
 void BMO_Set_Pnt(BMOperator *op, const char *slotname, void *p)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_PNT) )
+       if (!(slot->slottype == BMOP_OPSLOT_PNT))
                return;
 
        slot->data.p = p;
@@ -380,7 +384,7 @@ void BMO_Set_Pnt(BMOperator *op, const char *slotname, void *p)
 void BMO_Set_Vec(BMOperator *op, const char *slotname, const float vec[3])
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_VEC) )
+       if (!(slot->slottype == BMOP_OPSLOT_VEC))
                return;
 
        copy_v3_v3(slot->data.vec, vec);
@@ -390,7 +394,7 @@ void BMO_Set_Vec(BMOperator *op, const char *slotname, const float vec[3])
 float BMO_Get_Float(BMOperator *op, const char *slotname)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_FLT) )
+       if (!(slot->slottype == BMOP_OPSLOT_FLT))
                return 0.0f;
 
        return slot->data.f;
@@ -399,7 +403,7 @@ float BMO_Get_Float(BMOperator *op, const char *slotname)
 int BMO_Get_Int(BMOperator *op, const char *slotname)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_INT) )
+       if (!(slot->slottype == BMOP_OPSLOT_INT))
                return 0;
 
        return slot->data.i;
@@ -409,7 +413,7 @@ int BMO_Get_Int(BMOperator *op, const char *slotname)
 void *BMO_Get_Pnt(BMOperator *op, const char *slotname)
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_PNT) )
+       if (!(slot->slottype == BMOP_OPSLOT_PNT))
                return NULL;
 
        return slot->data.p;
@@ -418,7 +422,7 @@ void *BMO_Get_Pnt(BMOperator *op, const char *slotname)
 void BMO_Get_Vec(BMOperator *op, const char *slotname, float r_vec[3])
 {
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
-       if( !(slot->slottype == BMOP_OPSLOT_VEC) )
+       if (!(slot->slottype == BMOP_OPSLOT_VEC))
                return;
 
        copy_v3_v3(r_vec, slot->data.vec);
@@ -438,21 +442,21 @@ int BMO_CountFlag(BMesh *bm, int flag, const char htype)
        BMHeader *e;
        int count = 0;
 
-       if(htype & BM_VERT) {
-               for(e = BMIter_New(&elements, bm, BM_VERTS_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                       if(BMO_TestFlag(bm, e, flag))
+       if (htype & BM_VERT) {
+               for (e = BMIter_New(&elements, bm, BM_VERTS_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
+                       if (BMO_TestFlag(bm, e, flag))
                                count++;
                }
        }
-       if(htype & BM_EDGE) {
-               for(e = BMIter_New(&elements, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                       if(BMO_TestFlag(bm, e, flag))
+       if (htype & BM_EDGE) {
+               for (e = BMIter_New(&elements, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
+                       if (BMO_TestFlag(bm, e, flag))
                                count++;
                }
        }
-       if(htype & BM_FACE) {
-               for(e = BMIter_New(&elements, bm, BM_FACES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                       if(BMO_TestFlag(bm, e, flag))
+       if (htype & BM_FACE) {
+               for (e = BMIter_New(&elements, bm, BM_FACES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
+                       if (BMO_TestFlag(bm, e, flag))
                                count++;
                }
        }
@@ -485,7 +489,7 @@ int BMO_CountSlotBuf(struct BMesh *UNUSED(bm), struct BMOperator *op, const char
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
        
        /*check if its actually a buffer*/
-       if( !(slot->slottype > BMOP_OPSLOT_VEC) )
+       if (!(slot->slottype > BMOP_OPSLOT_VEC))
                return 0;
 
        return slot->len;
@@ -496,7 +500,7 @@ int BMO_CountSlotMap(BMesh *UNUSED(bm), BMOperator *op, const char *slotname)
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
        
        /*check if its actually a buffer*/
-       if( !(slot->slottype == BMOP_OPSLOT_MAPPING) )
+       if (!(slot->slottype == BMOP_OPSLOT_MAPPING))
                return 0;
 
        return slot->data.ghash ? BLI_ghash_size(slot->data.ghash) : 0;
@@ -509,7 +513,7 @@ void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
        void *tmp;
        
        /*check if its actually a buffer*/
-       if( !(slot->slottype > BMOP_OPSLOT_VEC) )
+       if (!(slot->slottype > BMOP_OPSLOT_VEC))
                return NULL;
 
        if (slot->flag & BMOS_DYNAMIC_ARRAY) {
@@ -523,7 +527,8 @@ void *BMO_Grow_Array(BMesh *bm, BMOperator *op, int slotcode, int totadd)
                }
 
                slot->len += totadd;
-       } else {
+       }
+       else {
                slot->flag |= BMOS_DYNAMIC_ARRAY;
                slot->len += totadd;
                slot->size = slot->len+2;
@@ -558,11 +563,11 @@ static void *alloc_slot_buffer(BMOperator *op, const char *slotname, int len)
        BMOpSlot *slot = BMO_GetSlot(op, slotname);
 
        /*check if its actually a buffer*/
-       if( !(slot->slottype > BMOP_OPSLOT_VEC) )
+       if (!(slot->slottype > BMOP_OPSLOT_VEC))
                return NULL;
        
        slot->len = len;
-       if(len)
+       if (len)
                slot->data.buf = BLI_memarena_alloc(op->arena, BMOP_OPSLOT_TYPEINFO[slot->slottype] * len);
        return slot->data.buf;
 }
@@ -587,7 +592,7 @@ static void BMO_All_To_Slot(BMesh *bm, BMOperator *op, const char *slotname, con
        if (htype & BM_EDGE) totelement += bm->totedge;
        if (htype & BM_FACE) totelement += bm->totface;
 
-       if(totelement) {
+       if (totelement) {
                alloc_slot_buffer(op, slotname, totelement);
 
                if (htype & BM_VERT) {
@@ -632,12 +637,12 @@ void BMO_HeaderFlag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
        
        totelement = BM_CountFlag(bm, htype, hflag, 1);
 
-       if(totelement) {
+       if (totelement) {
                alloc_slot_buffer(op, slotname, totelement);
 
                if (htype & BM_VERT) {
                        for (e = BMIter_New(&elements, bm, BM_VERTS_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
+                               if (!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
@@ -646,7 +651,7 @@ void BMO_HeaderFlag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
 
                if (htype & BM_EDGE) {
                        for (e = BMIter_New(&elements, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
+                               if (!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
@@ -655,13 +660,14 @@ void BMO_HeaderFlag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
 
                if (htype & BM_FACE) {
                        for (e = BMIter_New(&elements, bm, BM_FACES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
+                               if (!BM_TestHFlag(e, BM_HIDDEN) && BM_TestHFlag(e, hflag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
                        }
                }
-       } else {
+       }
+       else {
                output->len = 0;
        }
 }
@@ -681,12 +687,12 @@ void BMO_Flag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
        BMOpSlot *output = BMO_GetSlot(op, slotname);
        int totelement = BMO_CountFlag(bm, flag, htype), i=0;
 
-       if(totelement) {
+       if (totelement) {
                alloc_slot_buffer(op, slotname, totelement);
 
                if (htype & BM_VERT) {
                        for (e = BMIter_New(&elements, bm, BM_VERTS_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(BMO_TestFlag(bm, e, flag)) {
+                               if (BMO_TestFlag(bm, e, flag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
@@ -695,7 +701,7 @@ void BMO_Flag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
 
                if (htype & BM_EDGE) {
                        for (e = BMIter_New(&elements, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(BMO_TestFlag(bm, e, flag)) {
+                               if (BMO_TestFlag(bm, e, flag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
@@ -704,13 +710,14 @@ void BMO_Flag_To_Slot(BMesh *bm, BMOperator *op, const char *slotname,
 
                if (htype & BM_FACE) {
                        for (e = BMIter_New(&elements, bm, BM_FACES_OF_MESH, bm); e; e = BMIter_Step(&elements)) {
-                               if(BMO_TestFlag(bm, e, flag)) {
+                               if (BMO_TestFlag(bm, e, flag)) {
                                        ((BMHeader**)output->data.p)[i] = e;
                                        i++;
                                }
                        }
                }
-       } else {
+       }
+       else {
                output->len = 0;
        }
 }
@@ -729,7 +736,7 @@ void BMO_HeaderFlag_Buffer(BMesh *bm, BMOperator *op, const char *slotname,
        BMHeader **data =  slot->data.p;
        int i;
        
-       for(i = 0; i < slot->len; i++) {
+       for (i = 0; i < slot->len; i++) {
                if (!(htype & data[i]->htype))
                        continue;
 
@@ -754,7 +761,7 @@ void BMO_UnHeaderFlag_Buffer(BMesh *bm, BMOperator *op, const char *slotname,
        BMHeader **data =  slot->data.p;
        int i;
        
-       for(i = 0; i < slot->len; i++) {
+       for (i = 0; i < slot->len; i++) {
                if (!(htype & data[i]->htype))
                        continue;
 
@@ -769,12 +776,12 @@ int BMO_Vert_CountEdgeFlags(BMesh *bm, BMVert *v, int toolflag)
 {
        int count= 0;
 
-       if(v->e) {
+       if (v->e) {
                BMEdge *curedge;
                const int len= bmesh_disk_count(v);
                int i;
                
-               for(i = 0, curedge=v->e; i<len; i++) {
+               for (i = 0, curedge=v->e; i<len; i++) {
                        if (BMO_TestFlag(bm, curedge, toolflag))
                                count++;
                        curedge = bmesh_disk_nextedge(curedge, v);
@@ -797,7 +804,7 @@ void BMO_Flag_Buffer(BMesh *bm, BMOperator *op, const char *slotname,
        BMHeader **data =  slot->data.p;
        int i;
        
-       for(i = 0; i < slot->len; i++) {
+       for (i = 0; i < slot->len; i++) {
                if (!(htype & data[i]->htype))
                        continue;
 
@@ -818,7 +825,7 @@ void BMO_Unflag_Buffer(BMesh *bm, BMOperator *op, const char *slotname,
        BMHeader **data =  slot->data.p;
        int i;
        
-       for(i = 0; i < slot->len; i++) {
+       for (i = 0; i < slot->len; i++) {
                if (!(htype & data[i]->htype))
                        continue;
 
@@ -942,13 +949,13 @@ static void clear_flag_layer(BMesh *bm)
        BMIter faces;
        
        /*now go through and memcpy all the flags*/
-       for(v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
+       for (v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
                memset(v->head.flags+(bm->totflags-1), 0, sizeof(BMFlagLayer));
        }
-       for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
+       for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
                memset(e->head.flags+(bm->totflags-1), 0, sizeof(BMFlagLayer));
        }
-       for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
+       for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
                memset(f->head.flags+(bm->totflags-1), 0, sizeof(BMFlagLayer));
        }
 }
@@ -997,7 +1004,8 @@ void *BMO_IterStep(BMOIter *iter)
                }
 
                return h;
-       } else if (iter->slot->slottype == BMOP_OPSLOT_MAPPING) {
+       }
+       else if (iter->slot->slottype == BMOP_OPSLOT_MAPPING) {
                struct element_mapping *map; 
                void *ret = BLI_ghashIterator_getKey(&iter->giter);
                map = BLI_ghashIterator_getValue(&iter->giter);
@@ -1227,7 +1235,8 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
                        
                        state = 0;
                        fmt += i;
-               } else {
+               }
+               else {
                        switch (*fmt) {
                        case ' ':
                        case '\t':
@@ -1290,7 +1299,8 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
                                    nextc(fmt)==0) 
                                {
                                        BMO_Set_Float(op,slotname,va_arg(vlist,double));
-                               } else {
+                               }
+                               else {
                                        ret = 0;
                                        stop = 0;
                                        while (1) {
@@ -1434,7 +1444,7 @@ static void BMO_ClearFlag(BMesh *bm, void *element, const int flag)
 static int BMO_TestFlag(BMesh *bm, void *element, int flag)
 {
        BMHeader *head = element;
-       if(head->flags[bm->stackdepth-1].f & flag)
+       if (head->flags[bm->stackdepth-1].f & flag)
                return 1;
        return 0;
 }
index 62755d6b55845c32c8ceb9661af103adf9e744a2..dd163d3e248667fdc85ee85f965ca69006a23873 100644 (file)
@@ -66,10 +66,10 @@ static short testedgeside(const double v1[2], const double v2[2], const double v
        //inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
        inp= (v2[0]-v1[0])*(v1[1]-v3[1]) +(v1[1]-v2[1])*(v1[0]-v3[0]);
 
-       if(inp<0.0) return 0;
-       else if(inp==0) {
-               if(v1[0]==v3[0] && v1[1]==v3[1]) return 0;
-               if(v2[0]==v3[0] && v2[1]==v3[1]) return 0;
+       if (inp<0.0) return 0;
+       else if (inp==0) {
+               if (v1[0]==v3[0] && v1[1]==v3[1]) return 0;
+               if (v2[0]==v3[0] && v2[1]==v3[1]) return 0;
        }
        return 1;
 }
@@ -82,17 +82,17 @@ static short testedgesidef(const float v1[2], const float v2[2], const float v3[
        //inp= (v2[cox]-v1[cox])*(v1[coy]-v3[coy]) +(v1[coy]-v2[coy])*(v1[cox]-v3[cox]);
        inp= (v2[0]-v1[0])*(v1[1]-v3[1]) +(v1[1]-v2[1])*(v1[0]-v3[0]);
 
-       if(inp<0.0) return 0;
-       else if(inp==0) {
-               if(v1[0]==v3[0] && v1[1]==v3[1]) return 0;
-               if(v2[0]==v3[0] && v2[1]==v3[1]) return 0;
+       if (inp<0.0) return 0;
+       else if (inp==0) {
+               if (v1[0]==v3[0] && v1[1]==v3[1]) return 0;
+               if (v2[0]==v3[0] && v2[1]==v3[1]) return 0;
        }
        return 1;
 }
 
 static int point_in_triangle(const double v1[2], const double v2[2], const double v3[2], const double pt[2])
 {
-       if(testedgeside(v1,v2,pt) && testedgeside(v2,v3,pt) && testedgeside(v3,v1,pt))
+       if (testedgeside(v1,v2,pt) && testedgeside(v2,v3,pt) && testedgeside(v3,v1,pt))
                return 1;
        return 0;
 }
@@ -117,7 +117,7 @@ static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
        /*this fixes some weird numerical error*/
        add_v3_fl(verts[0], 0.0001f);
 
-       for(i = 0; i < nverts; i++) {
+       for (i = 0; i < nverts; i++) {
                copy_v3_v3(u, verts[i]);
                copy_v3_v3(v, verts[(i+1) % nverts]);
                copy_v3_v3(w, verts[(i+2) % nverts]);
@@ -150,7 +150,7 @@ static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
                n[2] += (u[0] - v[0]) * (u[1] + v[1]);
        }
 
-       if(normalize_v3_v3(normal, n) == 0.0f) {
+       if (normalize_v3_v3(normal, n) == 0.0f) {
                normal[2] = 1.0f; /* other axis set to 0.0 */
        }
 
@@ -170,7 +170,10 @@ static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
                normal[2] = 1.0f;
 
                return;
-       } else l = 1.0f / l;
+       }
+       else {
+               l = 1.0f / l;
+       }
 
        mul_v3_fl(n, l);
 
@@ -194,13 +197,13 @@ static int compute_poly_center(float center[3], float *r_area, float (*verts)[3]
 
        zero_v3(center);
 
-       if(nverts < 3) 
+       if (nverts < 3)
                return 0;
 
        i = nverts-1;
        j = 0;
        
-       while(j < nverts) {
+       while (j < nverts) {
                ai = verts[i][0] * verts[j][1] - verts[j][0] * verts[i][1];                             
                atmp += ai;
                xtmp += (verts[j][0] + verts[i][0]) * ai;
@@ -209,7 +212,7 @@ static int compute_poly_center(float center[3], float *r_area, float (*verts)[3]
                j += 1;
        }
 
-       if(r_area)
+       if (r_area)
                *r_area = atmp / 2.0f;
        
        if (atmp != 0) {
@@ -295,17 +298,17 @@ void compute_poly_plane(float (*verts)[3], int nverts)
        float *v1, *v2, *v3;
        int i;
        
-       if(nverts < 3) 
+       if (nverts < 3)
                return;
 
        zero_v3(avgn);
        zero_v3(avgc);
 
-       for(i = 0; i < nverts; i++) {
+       for (i = 0; i < nverts; i++) {
                v1 = verts[i];
                v2 = verts[(i+1) % nverts];
                v3 = verts[(i+2) % nverts];
-               normal_tri_v3( norm,v1, v2, v3);        
+               normal_tri_v3(norm,v1, v2, v3);
 
                add_v3_v3(avgn, norm);
        }
@@ -315,7 +318,8 @@ void compute_poly_plane(float (*verts)[3], int nverts)
                avgn[0] = 0.0f;
                avgn[1] = 0.0f;
                avgn[2] = 1.0f;
-       } else {
+       }
+       else {
                /* XXX, why is this being divided and _then_ normalized
                 * division could be removed? - campbell */
                avgn[0] /= nverts;
@@ -324,7 +328,7 @@ void compute_poly_plane(float (*verts)[3], int nverts)
                normalize_v3(avgn);
        }
        
-       for(i = 0; i < nverts; i++) {
+       for (i = 0; i < nverts; i++) {
                v1 = verts[i];
                mag = dot_v3v3(v1, avgn);
                madd_v3_v3fl(v1, avgn, -mag);
@@ -398,7 +402,7 @@ void poly_rotate_plane(const float normal[3], float (*verts)[3], const int nvert
        axis_angle_to_quat(q, axis, (float)angle);
        quat_to_mat3(mat, q);
 
-       for(i = 0;  i < nverts;  i++)
+       for (i = 0;  i < nverts;  i++)
                mul_m3_v3(mat, verts[i]);
 }
 
@@ -445,7 +449,7 @@ void BM_Edge_UpdateNormals(BMesh *bm, BMEdge *e)
        BMFace *f;
        
        f = BMIter_New(&iter, bm, BM_FACES_OF_EDGE, e);
-       for (; f; f=BMIter_Step(&iter)) {
+       for ( ; f; f=BMIter_Step(&iter)) {
                BM_Face_UpdateNormal(bm, f);
        }
 
@@ -493,7 +497,7 @@ void BM_Vert_UpdateAllNormals(BMesh *bm, BMVert *v)
        int len=0;
 
        f = BMIter_New(&iter, bm, BM_FACES_OF_VERT, v);
-       for (; f; f=BMIter_Step(&iter), len++) {
+       for ( ; f; f=BMIter_Step(&iter), len++) {
                BM_Face_UpdateNormal(bm, f);
        }
 
@@ -795,9 +799,9 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3],
                                       BM_GetIndex(v3), nvert))
                        isear = 0;
                
-               if(isear) {
+               if (isear) {
                        /*angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]);
-                       if(!bestear || ABS(angle-45.0f) < bestangle) {
+                       if (!bestear || ABS(angle-45.0f) < bestangle) {
                                bestear = l;
                                bestangle = ABS(45.0f-angle);
                        }
@@ -810,7 +814,7 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3],
                }
                l = l->next;
        }
-       while(l != bm_firstfaceloop(f));
+       while (l != bm_firstfaceloop(f));
 
        return bestear;
 }
@@ -846,7 +850,7 @@ void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
                BM_SetIndex(l->v, i); /* set dirty! */
                i++;
                l = l->next;
-       } while(l != bm_firstfaceloop(f));
+       } while (l != bm_firstfaceloop(f));
 
        bm->elem_index_dirty |= BM_VERT; /* see above */
 
@@ -863,10 +867,10 @@ void BM_Triangulate_Face(BMesh *bm, BMFace *f, float (*projectverts)[3],
        }
 
        done = 0;
-       while(!done && f->len > 3) {
+       while (!done && f->len > 3) {
                done = 1;
                l = find_ear(bm, f, projectverts, nvert);
-               if(l) {
+               if (l) {
                        done = 0;
                        /* v = l->v; */ /* UNUSED */
                        f = BM_Split_Face(bm, l->f, l->prev->v,
@@ -943,7 +947,7 @@ void BM_LegalSplits(BMesh *bm, BMFace *f, BMLoop *(*loops)[2], int len)
        
        i = 0;
        l = BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, f);
-       for (; l; l=BMIter_Step(&iter)) {
+       for ( ; l; l=BMIter_Step(&iter)) {
                BM_SetIndex(l, i); /* set_loop */
                copy_v3_v3(projverts[i], l->v->co);
                i++;
index e2ed7043bbb32745ecdaa6973bb28712da797941..aea7a7ab908fdf36afa1676fcb1eb44998745e48 100644 (file)
@@ -54,9 +54,9 @@
 
 int BM_Count_Element(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;
+       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;
 }
@@ -112,7 +112,7 @@ int BM_Vert_In_Face(BMFace *f, BMVert *v)
        for (lst=f->loops.first; lst; lst=lst->next) {
                l = lst->first;
                do {
-                       if(l->v == v) return 1;
+                       if (l->v == v) return 1;
                        l = l->next;
                } while (l != lst->first);
        }
@@ -133,20 +133,20 @@ int BM_Verts_In_Face(BMesh *bm, BMFace *f, BMVert **varr, int len)
        BMLoop *curloop = NULL;
        int i, count = 0;
        
-       for(i=0; i < len; i++) BMO_SetFlag(bm, varr[i], BM_OVERLAP);
+       for (i=0; i < len; i++) BMO_SetFlag(bm, varr[i], BM_OVERLAP);
        
        for (lst=f->loops.first; lst; lst=lst->next) {
                curloop = lst->first;
 
                do {
-                       if(BMO_TestFlag(bm, curloop->v, BM_OVERLAP))
+                       if (BMO_TestFlag(bm, curloop->v, BM_OVERLAP))
                                count++;
 
                        curloop = curloop->next;
                } while (curloop != lst->first);
        }
 
-       for(i=0; i < len; i++) BMO_ClearFlag(bm, varr[i], BM_OVERLAP);
+       for (i=0; i < len; i++) BMO_ClearFlag(bm, varr[i], BM_OVERLAP);
 
        return count;
 }
@@ -166,9 +166,9 @@ int BM_Edge_In_Face(BMFace *f, BMEdge *e)
        l = bm_firstfaceloop(f);
        do {
 
-               if(l->e == e) return 1;
+               if (l->e == e) return 1;
                l = l->next;
-       } while(l != bm_firstfaceloop(f));
+       } while (l != bm_firstfaceloop(f));
 
        return 0;
 }
@@ -221,12 +221,12 @@ int BM_Edge_FaceCount(BMEdge *e)
        int count = 0;
        BMLoop *curloop = NULL;
 
-       if(e->l) {
+       if (e->l) {
                curloop = e->l;
                do {
                        count++;
                        curloop = bmesh_radial_nextloop(curloop);
-               } while(curloop != e->l);
+               } while (curloop != e->l);
        }
 
        return count;
@@ -251,12 +251,12 @@ int BM_Vert_FaceCount(BMVert *v)
 #if 0 //this code isn't working
        BMEdge *curedge = NULL;
 
-       if(v->e) {
+       if (v->e) {
                curedge = v->e;
                do {
-                       if(curedge->l) count += BM_Edge_FaceCount(curedge);
+                       if (curedge->l) count += BM_Edge_FaceCount(curedge);
                        curedge = bmesh_disk_nextedge(curedge,v);
-               } while(curedge != v->e);
+               } while (curedge != v->e);
        }
        return count;
 #endif
@@ -276,13 +276,13 @@ int BM_Wire_Vert(BMesh *UNUSED(bm), BMVert *v)
 {
        BMEdge *curedge;
 
-       if(!(v->e)) return 0;
+       if (!(v->e)) return 0;
        
        curedge = v->e;
        do {
-               if(curedge->l) return 0;
+               if (curedge->l) return 0;
                curedge = bmesh_disk_nextedge(curedge, v);
-       } while(curedge != v->e);
+       } while (curedge != v->e);
 
        return 1;
 }
@@ -299,7 +299,7 @@ int BM_Wire_Vert(BMesh *UNUSED(bm), BMVert *v)
 
 int BM_Wire_Edge(BMesh *UNUSED(bm), BMEdge *e)
 {
-       if(e->l) return 0;
+       if (e->l) return 0;
        return 1;
 }
 
@@ -346,7 +346,7 @@ int BM_Nonmanifold_Vert(BMesh *UNUSED(bm), BMVert *v)
        e = NULL;
        oe = v->e;
        l = oe->l;
-       while(e != oe) {
+       while (e != oe) {
                l = (l->v == v) ? l->prev : l->next;
                e = l->e;
                count++; /* count the edges */
@@ -390,7 +390,7 @@ int BM_Nonmanifold_Vert(BMesh *UNUSED(bm), BMVert *v)
 int BM_Nonmanifold_Edge(BMesh *UNUSED(bm), BMEdge *e)
 {
        int count = BM_Edge_FaceCount(e);
-       if(count != 2 && count != 1) return 1;
+       if (count != 2 && count != 1) return 1;
        return 0;
 }
 
@@ -407,7 +407,7 @@ int BM_Nonmanifold_Edge(BMesh *UNUSED(bm), BMEdge *e)
 int BM_Boundary_Edge(BMEdge *e)
 {
        int count = BM_Edge_FaceCount(e);
-       if(count == 1) return 1;
+       if (count == 1) return 1;
        return 0;
 }
 
@@ -430,9 +430,9 @@ int BM_Face_Share_Edges(BMFace *f1, BMFace *f2)
        
        l = bm_firstfaceloop(f1);
        do {
-               if(bmesh_radial_find_face(l->e,f2)) count++;
+               if (bmesh_radial_find_face(l->e,f2)) count++;
                l = l->next;
-       } while(l != bm_firstfaceloop(f1));
+       } while (l != bm_firstfaceloop(f1));
        
        return count;
 }
@@ -450,15 +450,15 @@ int BM_Edge_Share_Faces(BMEdge *e1, BMEdge *e2)
        BMLoop *l;
        BMFace *f;
 
-       if(e1->l && e2->l) {
+       if (e1->l && e2->l) {
                l = e1->l;
                do {
                        f = l->f;
-                       if(bmesh_radial_find_face(e2,f)) {
+                       if (bmesh_radial_find_face(e2,f)) {
                                return 1;
                        }
                        l = l->radial_next;
-               } while(l != e1->l);
+               } while (l != e1->l);
        }
        return 0;
 }
@@ -551,11 +551,11 @@ int BM_Exist_Face_Overlaps(BMesh *bm, BMVert **varr, int len, BMFace **overlapfa
 
        if (overlapface) *overlapface = NULL;
 
-       for(i=0; i < len; i++) {
-               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i] );
-               while(f) {
+       for (i=0; i < len; i++) {
+               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i]);
+               while (f) {
                        amount = BM_Verts_In_Face(bm, f, varr, len);
-                       if(amount >= len) {
+                       if (amount >= len) {
                                if (overlapface) *overlapface = f;
                                return 1;                               
                        }
@@ -587,11 +587,11 @@ int BM_Face_Exists(BMesh *bm, BMVert **varr, int len, BMFace **existface)
 
        if (existface) *existface = NULL;
 
-       for(i=0; i < len; i++) {
-               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i] );
-               while(f) {
+       for (i=0; i < len; i++) {
+               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i]);
+               while (f) {
                        amount = BM_Verts_In_Face(bm, f, varr, len);
-                       if(amount == len && amount == f->len) {
+                       if (amount == len && amount == f->len) {
                                if (existface) *existface = f;
                                return 1;                               
                        }
index e17206518cb8be6bbfd887097ec01960cf08b39a..b022a7f88538ccc43df7cc5811c4f3b4c800a3b3 100644 (file)
  
 int bmesh_vert_in_edge(BMEdge *e, BMVert *v)
 {
-       if(e->v1 == v || e->v2 == v) return 1;
+       if (e->v1 == v || e->v2 == v) return 1;
        return 0;
 }
 int bmesh_verts_in_edge(BMVert *v1, BMVert *v2, BMEdge *e)
 {
-       if(e->v1 == v1 && e->v2 == v2) return 1;
-       else if(e->v1 == v2 && e->v2 == v1) return 1;
+       if (e->v1 == v1 && e->v2 == v2) return 1;
+       else if (e->v1 == v2 && e->v2 == v1) return 1;
        return 0;
 }
 
 BMVert *bmesh_edge_getothervert(BMEdge *e, BMVert *v) {
-       if(e->v1 == v) return e->v2;
-       else if(e->v2 == v) return e->v1;
+       if (e->v1 == v) return e->v2;
+       else if (e->v2 == v) return e->v1;
        return NULL;
 }
 
 int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
 {
-       if(e->v1 == orig) {
+       if (e->v1 == orig) {
                e->v1 = newv;
                e->dlink1.next = e->dlink1.prev = NULL;
                return 1;
        }
-       else if(e->v2 == orig) {
+       else if (e->v2 == orig) {
                e->v2 = newv;
                e->dlink2.next = e->dlink2.prev = NULL;
                return 1;
@@ -163,7 +163,8 @@ int bmesh_disk_append_edge(struct BMEdge *e, struct BMVert *v)
 
                v->e = e;
                e1->next = e1->prev = (Link*)e;
-       } else {
+       }
+       else {
                Link *e1, *e2, *e3;
 
                e1 = bm_get_edge_link(e, v);
@@ -224,7 +225,7 @@ BMEdge *bmesh_disk_existedge(BMVert *v1, BMVert *v2)
 {
        BMEdge *curedge, *startedge;
        
-       if(v1->e) {
+       if (v1->e) {
                startedge = v1->e;
                curedge = startedge;
                do {
@@ -296,15 +297,15 @@ int bmesh_disk_count_facevert(BMVert *v)
        int count = 0;
 
        /*is there an edge on this vert at all?*/
-       if(!v->e)
+       if (!v->e)
                return count;
 
        /*first, loop around edges*/
        curedge = v->e;
        do {
-               if(curedge->l) count += bmesh_radial_count_facevert(curedge->l, v);
+               if (curedge->l) count += bmesh_radial_count_facevert(curedge->l, v);
                curedge = bmesh_disk_nextedge(curedge, v);
-       } while(curedge != v->e);
+       } while (curedge != v->e);
 
        return count;
 }
@@ -314,9 +315,9 @@ struct BMEdge *bmesh_disk_find_first_faceedge(struct BMEdge *e, struct BMVert *v
        BMEdge *searchedge = NULL;
        searchedge = e;
        do {
-               if(searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
+               if (searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
                searchedge = bmesh_disk_nextedge(searchedge,v);
-       } while(searchedge != e);
+       } while (searchedge != e);
 
        return NULL;
 }
@@ -326,9 +327,9 @@ struct BMEdge *bmesh_disk_find_next_faceedge(struct BMEdge *e, struct BMVert *v)
        BMEdge *searchedge = NULL;
        searchedge = bmesh_disk_nextedge(e,v);
        do {
-               if(searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
+               if (searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
                searchedge = bmesh_disk_nextedge(searchedge,v);
-       } while(searchedge !=e);
+       } while (searchedge !=e);
        return e;
 }
 
@@ -385,7 +386,8 @@ void bmesh_radial_remove_loop(BMLoop *l, BMEdge *e)
 
                l->radial_next->radial_prev = l->radial_prev;
                l->radial_prev->radial_next = l->radial_next;
-       } else {
+       }
+       else {
                if (e) {
                        if (l == e->l) {
                                e->l = NULL;
@@ -415,9 +417,9 @@ BMLoop *bmesh_radial_find_first_facevert(BMLoop *l, BMVert *v)
        BMLoop *curloop;
        curloop = l;
        do {
-               if(curloop->v == v) return curloop;
+               if (curloop->v == v) return curloop;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop != l);
+       } while (curloop != l);
        return NULL;
 }
 
@@ -426,9 +428,9 @@ BMLoop *bmesh_radial_find_next_facevert(BMLoop *l, BMVert *v)
        BMLoop *curloop;
        curloop = bmesh_radial_nextloop(l);
        do {
-               if(curloop->v == v) return curloop;
+               if (curloop->v == v) return curloop;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop !=l);
+       } while (curloop !=l);
        return l;
 }
 
@@ -465,10 +467,11 @@ int bmesh_radial_length(BMLoop *l)
 
 void bmesh_radial_append(BMEdge *e, BMLoop *l)
 {
-       if(e->l == NULL) {
+       if (e->l == NULL) {
                e->l = l;
                l->radial_next = l->radial_prev = l;
-       } else {
+       }
+       else {
                l->radial_prev = e->l;
                l->radial_next = e->l->radial_next;
 
@@ -492,8 +495,8 @@ int bmesh_radial_find_face(BMEdge *e, BMFace *f)
        int i, len;
 
        len = bmesh_radial_length(e->l);
-       for(i = 0, curloop = e->l; i < len; i++, curloop = curloop->radial_next) {
-               if(curloop->f == f)
+       for (i = 0, curloop = e->l; i < len; i++, curloop = curloop->radial_next) {
+               if (curloop->f == f)
                        return 1;
        }
        return 0;
@@ -513,9 +516,9 @@ int bmesh_radial_count_facevert(BMLoop *l, BMVert *v)
        int count = 0;
        curloop = l;
        do {
-               if(curloop->v == v) count++;
+               if (curloop->v == v) count++;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop != l);
+       } while (curloop != l);
        return count;
 }
 
@@ -531,17 +534,17 @@ int bmesh_loop_validate(BMFace *f)
                return 0;
 
        /* Validate that the face loop cycle is the length specified by f->len */
-       for(i = 1, curloop = head->next; i < len; i++, curloop = curloop->next) {
+       for (i = 1, curloop = head->next; i < len; i++, curloop = curloop->next) {
                if (curloop->f != f) return 0;
                if (curloop == head) return 0;
        }
-       if(curloop != head) return 0;
+       if (curloop != head) return 0;
        
        /* Validate the loop->prev links also form a cycle of length f->len */
-       for(i = 1, curloop = head->prev; i < len; i++, curloop = curloop->prev) {
+       for (i = 1, curloop = head->prev; i < len; i++, curloop = curloop->prev) {
                if (curloop == head) return 0;
        }
-       if(curloop != head) return 0;
+       if (curloop != head) return 0;
        
        return 1;
 }
@@ -555,7 +558,7 @@ void bmesh_cycle_append(void *h, void *nt)
        head = (BMNode*)h;
        newtail = (BMNode*)nt;
        
-       if(head->next == NULL) {
+       if (head->next == NULL) {
                head->next = newtail;
                head->prev = newtail;
                newtail->next = head;
@@ -619,14 +622,14 @@ int bmesh_cycle_remove(void *h, void *remn)
        remnode = (BMNode*)remn;
        len = bmesh_cycle_length(h);
        
-       if(len == 1 && head == remnode) {
+       if (len == 1 && head == remnode) {
                head->next = NULL;
                head->prev = NULL;
                return 1;
        }
        else {
-               for(i=0, curnode = head; i < len; curnode = curnode->next) {
-                       if(curnode == remnode) {
+               for (i=0, curnode = head; i < len; curnode = curnode->next) {
+                       if (curnode == remnode) {
                                remnode->prev->next = remnode->next;
                                remnode->next->prev = remnode->prev;
                                /*zero out remnode pointers, important!*/
@@ -658,12 +661,12 @@ int bmesh_cycle_validate(int len, void *h)
        head = (BMNode*)h;
        
        /*forward validation*/
-       for(i = 0, curnode = head; i < len; i++, curnode = curnode->next);
-       if(curnode != head) return 0;
+       for (i = 0, curnode = head; i < len; i++, curnode = curnode->next);
+       if (curnode != head) return 0;
        
        /*reverse validation*/
-       for(i = 0, curnode = head; i < len; i++, curnode = curnode->prev);
-       if(curnode != head) return 0;
+       for (i = 0, curnode = head; i < len; i++, curnode = curnode->prev);
+       if (curnode != head) return 0;
        
        return 1;
 }
@@ -681,9 +684,9 @@ int bmesh_cycle_validate(int len, void *h)
  
 BMEdge *bmesh_disk_nextedge(BMEdge *e, BMVert *v)
 {      
-       if(bmesh_vert_in_edge(e, v)) {
-               if(e->v1 == v) return e->d1.next->data;
-               else if(e->v2 == v) return e->d2.next->data;
+       if (bmesh_vert_in_edge(e, v)) {
+               if (e->v1 == v) return e->d1.next->data;
+               else if (e->v2 == v) return e->d2.next->data;
        }
        return NULL;
 }
@@ -699,7 +702,7 @@ BMEdge *bmesh_disk_nextedge(BMEdge *e, BMVert *v)
 BMNode *bmesh_disk_getpointer(BMEdge *e, BMVert *v)
 {
        /*returns pointer to the cycle node for the appropriate vertex in this disk*/
-       if(e->v1 == v) return &(e->d1);
+       if (e->v1 == v) return &(e->d1);
        else if (e->v2 == v) return &(e->d2);
        return NULL;
 }
@@ -718,10 +721,10 @@ int bmesh_disk_append_edge(BMEdge *e, BMVert *v)
        
        BMNode *base, *tail;
        
-       if(bmesh_vert_in_edge(e, v) == 0) return 0; /*check to make sure v is in e*/
+       if (bmesh_vert_in_edge(e, v) == 0) return 0; /*check to make sure v is in e*/
        
        /*check for loose vert first*/
-       if(v->e == NULL) {
+       if (v->e == NULL) {
                v->e = e;
                base = tail = bmesh_disk_getpointer(e, v);
                bmesh_cycle_append(base, tail); /*circular reference is ok!*/
@@ -757,8 +760,8 @@ void bmesh_disk_remove_edge(BMEdge *e, BMVert *v)
        
        /*first deal with v->e pointer...*/
        len = bmesh_cycle_length(base);
-       if(len == 1) newbase = NULL;
-       else if(v->e == e) newbase = base->next-> data;
+       if (len == 1) newbase = NULL;
+       else if (v->e == e) newbase = base->next-> data;
        else newbase = v->e;
        
        /*remove and rebase*/
@@ -782,16 +785,16 @@ BMEdge *bmesh_disk_next_edgeflag(BMEdge *e, BMVert *v, int eflag, int tflag)
        BMEdge *curedge;
        int len, ok;
        
-       if(eflag && tflag) return NULL;
+       if (eflag && tflag) return NULL;
        
        ok = bmesh_vert_in_edge(e,v);
-       if(ok) {
+       if (ok) {
                diskbase = bmesh_disk_getpointer(e, v);
                len = bmesh_cycle_length(diskbase);
                curedge = bmesh_disk_nextedge(e,v);
-               while(curedge != e) {
-                       if(eflag) {
-                               if(curedge->head.eflag1 == eflag) return curedge;
+               while (curedge != e) {
+                       if (eflag) {
+                               if (curedge->head.eflag1 == eflag) return curedge;
                        }
                        curedge = bmesh_disk_nextedge(curedge, v);
                }
@@ -815,14 +818,14 @@ int bmesh_disk_count_edgeflag(BMVert *v, int eflag, int tflag)
        BMEdge *curedge;
        int i, len=0, count=0;
        
-       if(v->e) {
-               if(eflag && tflag) return 0; /*tflag and eflag are reserved for different functions!*/
+       if (v->e) {
+               if (eflag && tflag) return 0; /*tflag and eflag are reserved for different functions!*/
                diskbase = bmesh_disk_getpointer(v->e, v);
                len = bmesh_cycle_length(diskbase);
                
-               for(i = 0, curedge=v->e; i<len; i++) {
-                       if(eflag) {
-                               if(curedge->head.eflag1 == eflag) count++;
+               for (i = 0, curedge=v->e; i<len; i++) {
+                       if (eflag) {
+                               if (curedge->head.eflag1 == eflag) count++;
                        }
                        curedge = bmesh_disk_nextedge(curedge, v);
                }
@@ -837,12 +840,12 @@ int bmesh_disk_hasedge(BMVert *v, BMEdge *e)
        BMEdge *curedge;
        int i, len=0;
        
-       if(v->e) {
+       if (v->e) {
                diskbase = bmesh_disk_getpointer(v->e,v);
                len = bmesh_cycle_length(diskbase);
                
-               for(i = 0, curedge=v->e; i<len; i++) {
-                       if(curedge == e) return 1;
+               for (i = 0, curedge=v->e; i<len; i++) {
+                       if (curedge == e) return 1;
                        else curedge=bmesh_disk_nextedge(curedge, v);
                }
        }
@@ -855,12 +858,12 @@ BMEdge *bmesh_disk_existedge(BMVert *v1, BMVert *v2)
        BMEdge *curedge;
        int i, len=0;
        
-       if(v1->e) {
+       if (v1->e) {
                diskbase = bmesh_disk_getpointer(v1->e,v1);
                len = bmesh_cycle_length(diskbase);
                
-               for(i=0,curedge=v1->e;i<len;i++,curedge = bmesh_disk_nextedge(curedge,v1)) {
-                       if(bmesh_verts_in_edge(v1,v2,curedge)) return curedge;
+               for (i=0,curedge=v1->e;i<len;i++,curedge = bmesh_disk_nextedge(curedge,v1)) {
+                       if (bmesh_verts_in_edge(v1,v2,curedge)) return curedge;
                }
        }
        
@@ -875,7 +878,7 @@ BMLoop *bmesh_radial_nextloop(BMLoop *l)
 
 void bmesh_radial_append(BMEdge *e, BMLoop *l)
 {
-       if(e->l == NULL) e->l = l;
+       if (e->l == NULL) e->l = l;
        bmesh_cycle_append(&(e->l->radial), &(l->radial));
 }
 
@@ -886,8 +889,8 @@ void bmesh_radial_remove_loop(BMLoop *l, BMEdge *e)
        
        /*deal with edge->l pointer*/
        len = bmesh_cycle_length(&(e->l->radial));
-       if(len == 1) newbase = NULL;
-       else if(e->l == l) newbase = e->l->radial_next;
+       if (len == 1) newbase = NULL;
+       else if (e->l == l) newbase = e->l->radial_next;
        else newbase = e->l;
        
        /*remove and rebase*/
@@ -902,8 +905,8 @@ int bmesh_radial_find_face(BMEdge *e,BMFace *f)
        int i, len;
        
        len = bmesh_cycle_length(&(e->l->radial));
-       for(i = 0, curloop = e->l; i < len; i++, curloop = curloop->radial_next) {
-               if(curloop->f == f) return 1;
+       for (i = 0, curloop = e->l; i < len; i++, curloop = curloop->radial_next) {
+               if (curloop->f == f) return 1;
        }
        return 0;
 }
@@ -923,9 +926,9 @@ int bmesh_radial_count_facevert(BMLoop *l, BMVert *v)
        int count = 0;
        curloop = l;
        do {
-               if(curloop->v == v) count++;
+               if (curloop->v == v) count++;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop != l);
+       } while (curloop != l);
        return count;
 }
 
@@ -945,15 +948,15 @@ int bmesh_disk_count_facevert(BMVert *v)
        int count = 0;
 
        /*is there an edge on this vert at all?*/
-       if(!v->e)
+       if (!v->e)
                return count;
 
        /*first, loop around edges*/
        curedge = v->e;
        do {
-               if(curedge->l) count += bmesh_radial_count_facevert(curedge->l, v); 
+               if (curedge->l) count += bmesh_radial_count_facevert(curedge->l, v);
                curedge = bmesh_disk_nextedge(curedge, v);
-       } while(curedge != v->e);
+       } while (curedge != v->e);
 
        return count;
 }
@@ -970,9 +973,9 @@ BMLoop *bmesh_radial_find_first_facevert(BMLoop *l, BMVert *v)
        BMLoop *curloop;
        curloop = l;
        do {
-               if(curloop->v == v) return curloop;
+               if (curloop->v == v) return curloop;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop != l);
+       } while (curloop != l);
        return NULL;
 }
 
@@ -981,9 +984,9 @@ BMLoop *bmesh_radial_find_next_facevert(BMLoop *l, BMVert *v)
        BMLoop *curloop;
        curloop = bmesh_radial_nextloop(l);
        do {
-               if(curloop->v == v) return curloop;
+               if (curloop->v == v) return curloop;
                curloop = bmesh_radial_nextloop(curloop);
-       } while(curloop !=l);
+       } while (curloop !=l);
        return l;
 }
 
@@ -1004,9 +1007,9 @@ BMEdge *bmesh_disk_find_first_faceedge(BMEdge *e, BMVert *v)
        BMEdge *searchedge = NULL;
        searchedge = e;
        do {
-               if(searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
+               if (searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
                searchedge = bmesh_disk_nextedge(searchedge,v);
-       } while(searchedge != e);
+       } while (searchedge != e);
        
        return NULL;
 }
@@ -1016,9 +1019,9 @@ BMEdge *bmesh_disk_find_next_faceedge(BMEdge *e, BMVert *v)
        BMEdge *searchedge = NULL;
        searchedge = bmesh_disk_nextedge(e,v);
        do {
-               if(searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
+               if (searchedge->l && bmesh_radial_count_facevert(searchedge->l,v)) return searchedge;
                searchedge = bmesh_disk_nextedge(searchedge,v);
-       } while(searchedge !=e);
+       } while (searchedge !=e);
        return e;
 }
 
index 5c57ab5968bea661979bb6f2c567880332bd513c..e29b8ccdd7961278465fed0f3e28eca7adb033a0 100644 (file)
@@ -182,9 +182,9 @@ void *BMW_walk(BMWalker *walker)
 {
        void *current = NULL;
 
-       while(BMW_currentstate(walker)) {
+       while (BMW_currentstate(walker)) {
                current = walker->step(walker);
-               if(current) return current;
+               if (current) return current;
        }
        return NULL;
 }
index 213b63995ecbc657a9610dc25e082e943bdacb1a..b8a3ed778ff9bc35901156fe4bc997cd672ab1e0 100644 (file)
@@ -151,7 +151,7 @@ static void *shellWalker_step(BMWalker *walker)
        curedge = shellWalk.curedge;
        do {
                if (!BLI_ghash_haskey(walker->visithash, curedge)) { 
-                       if(!walker->restrictflag || (walker->restrictflag &&
+                       if (!walker->restrictflag || (walker->restrictflag &&
                           BMO_TestFlag(walker->bm, curedge, walker->restrictflag)))
                        {
                                shellWalker *newstate;
@@ -169,7 +169,7 @@ static void *shellWalker_step(BMWalker *walker)
                        }
                }
                curedge = bmesh_disk_nextedge(curedge, shellWalk.base);
-       } while(curedge != shellWalk.curedge);
+       } while (curedge != shellWalk.curedge);
        
        return shellWalk.curedge;
 }
@@ -297,11 +297,12 @@ static void *islandboundWalker_step(BMWalker *walker)
                        l = bmesh_radial_nextloop(l);
                        f = l->f;
                        e = l->e;
-                       if(walker->mask_face && !BMO_TestFlag(walker->bm, f, walker->mask_face)) {
+                       if (walker->mask_face && !BMO_TestFlag(walker->bm, f, walker->mask_face)) {
                                l = l->radial_next;
                                break;
                        }
-               } else {
+               }
+               else {
                        f = l->f;
                        e = l->e;
                        break;
@@ -366,14 +367,14 @@ static void *islandWalker_step(BMWalker *walker)
        BMW_removestate(walker);
 
        l = BMIter_New(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
-       for (; l; l=BMIter_Step(&liter)) {
+       for ( ; l; l=BMIter_Step(&liter)) {
                /* could skip loop here too, but dont add unless we need it */
                if (walker->mask_edge && !BMO_TestFlag(walker->bm, l->e, walker->mask_edge)) {
                        continue;
                }
 
                f = BMIter_New(&iter, walker->bm, BM_FACES_OF_EDGE, l->e);
-               for (; f; f=BMIter_Step(&iter)) {
+               for ( ; f; f=BMIter_Step(&iter)) {
                        if (walker->mask_face && !BMO_TestFlag(walker->bm, f, walker->mask_face)) {
                                continue;
                        }
@@ -638,8 +639,10 @@ static void *faceloopWalker_step(BMWalker *walker)
                if (l->f->len != 4) {
                        lwalk->nocalc = 1;
                        lwalk->l = origl;
-               } else
+               }
+               else {
                        lwalk->nocalc = 0;
+               }
 
                BLI_ghash_insert(walker->visithash, l->f, NULL);
        }
@@ -666,7 +669,8 @@ static void edgeringWalker_begin(BMWalker *walker, void *data)
        if (!lwalk->l) {
                lwalk->wireedge = e;
                return;
-       } else {
+       }
+       else {
                lwalk->wireedge = NULL;
        }
 
index b2be4d74f7fa31342bf2d9afd1197a278a61453b..b3ba6e154fdfdf056f9578772cc940781cad64e3 100644 (file)
@@ -230,7 +230,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                BMO_SetFlag(bm, l->f, BEVEL_FLAG);
                                BLI_array_append(faces, l->f);
                        }
-               } else {
+               }
+               else {
                        BM_SetIndex(e, -1); /* set_dirty! */
                }
        }
@@ -333,7 +334,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                        tag = tags + BM_GetIndex(l);
                                        calc_corner_co(bm, l, fac, co, do_dist, do_even);
                                        tag->newv = BM_Make_Vert(bm, co, l->v);
-                               } else {
+                               }
+                               else {
                                        tag = tags + BM_GetIndex(l);
                                        tag->newv = ETAG_GET(l->prev->e, l->v);
                                        
@@ -354,7 +356,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                                ETAG_SET(l->prev->e, l->v, tag->newv);
                                        }
                                }
-                       } else if (BMO_TestFlag(bm, l->v, BEVEL_FLAG)) {
+                       }
+                       else if (BMO_TestFlag(bm, l->v, BEVEL_FLAG)) {
                                tag = tags + BM_GetIndex(l);
                                tag->newv = ETAG_GET(l->e, l->v);                               
                
@@ -375,7 +378,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                        
                                        ETAG_SET(l->e, l->v, tag->newv);
                                }                                       
-                       } else {
+                       }
+                       else {
                                tag = tags + BM_GetIndex(l);
                                tag->newv = l->v;
                                BMO_ClearFlag(bm, l->v, BEVEL_DEL);
@@ -458,10 +462,12 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                if (l->radial_next->next->v == l->next->v) {
                                        v4 = v3;
                                        v3 = tags[BM_GetIndex(l->radial_next->next)].newv;
-                               } else {
+                               }
+                               else {
                                        v4 = tags[BM_GetIndex(l->radial_next->next)].newv;
                                }
-                       } else {
+                       }
+                       else {
                                /*the loop is on a boundary*/
                                v3 = l->next->v;
                                v4 = l->v;
@@ -518,7 +524,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                        if (l->radial_next->v == l->v) {
                                                l2 = l->radial_next->prev;
                                                l3 = l->radial_next->next;
-                                       } else {
+                                       }
+                                       else {
                                                l2 = l->radial_next->next;
                                                l3 = l->radial_next->prev;
                                        }
@@ -551,7 +558,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                BM_ITER(l2, &liter2, bm, BM_LOOPS_OF_FACE, f) {
                                        BMO_ClearFlag(bm, l2->e, BEVEL_DEL);
                                }
-                       } else {
+                       }
+                       else {
                                f = NULL;
                        }
                }       
@@ -720,7 +728,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                        f = BM_Make_Ngon(bm, lastv, vstart, edges, BLI_array_count(edges), 0);
                        if (!f) {
                                fprintf(stderr, "%s: in bevel vert fill! (bmesh internal error)\n", __func__);
-                       } else {
+                       }
+                       else {
                                BMO_SetFlag(bm, f, FACE_NEW|FACE_HOLE);
                        }
                }
@@ -748,7 +757,8 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
                                if (tag->newv != l->v || HasMDisps) {
                                        BM_Copy_Attributes(bm, bm, l->f, l2->f);
                                        BM_loop_interp_from_face(bm, l2, l->f, 1, 1);
-                               } else {
+                               }
+                               else {
                                        BM_Copy_Attributes(bm, bm, l->f, l2->f);
                                        BM_Copy_Attributes(bm, bm, l, l2);
                                }
index 4dd9960d6c5bc81d781d620fe0cfc9e6acc92700..b3610ea8bfba925d48a51ffb6d1ea5152c8cd8da 100644 (file)
@@ -180,8 +180,8 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
        vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v");
        ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e");
        
-       for(v = BMIter_New(&verts, source, BM_VERTS_OF_MESH, source); v; v = BMIter_Step(&verts)) {
-               if(BMO_TestFlag(source, (BMHeader*)v, DUPE_INPUT) && (!BMO_TestFlag(source, (BMHeader*)v, DUPE_DONE))) {
+       for (v = BMIter_New(&verts, source, BM_VERTS_OF_MESH, source); v; v = BMIter_Step(&verts)) {
+               if (BMO_TestFlag(source, (BMHeader*)v, DUPE_INPUT) && (!BMO_TestFlag(source, (BMHeader*)v, DUPE_DONE))) {
                        BMIter iter;
                        int iso = 1;
 
@@ -211,14 +211,14 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
        }
 
        /*now we dupe all the edges*/
-       for(e = BMIter_New(&edges, source, BM_EDGES_OF_MESH, source); e; e = BMIter_Step(&edges)) {
-               if(BMO_TestFlag(source, (BMHeader*)e, DUPE_INPUT) && (!BMO_TestFlag(source, (BMHeader*)e, DUPE_DONE))) {
+       for (e = BMIter_New(&edges, source, BM_EDGES_OF_MESH, source); e; e = BMIter_Step(&edges)) {
+               if (BMO_TestFlag(source, (BMHeader*)e, DUPE_INPUT) && (!BMO_TestFlag(source, (BMHeader*)e, DUPE_DONE))) {
                        /*make sure that verts are copied*/
-                       if(!BMO_TestFlag(source, (BMHeader*)e->v1, DUPE_DONE)) {
+                       if (!BMO_TestFlag(source, (BMHeader*)e->v1, DUPE_DONE)) {
                                copy_vertex(source, e->v1, target, vhash);
                                BMO_SetFlag(source, (BMHeader*)e->v1, DUPE_DONE);
                        }
-                       if(!BMO_TestFlag(source, (BMHeader*)e->v2, DUPE_DONE)) {
+                       if (!BMO_TestFlag(source, (BMHeader*)e->v2, DUPE_DONE)) {
                                copy_vertex(source, e->v2, target, vhash);
                                BMO_SetFlag(source, (BMHeader*)e->v2, DUPE_DONE);
                        }
@@ -229,19 +229,19 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
        }
 
        /*first we dupe all flagged faces and their elements from source*/
-       for(f = BMIter_New(&faces, source, BM_FACES_OF_MESH, source); f; f= BMIter_Step(&faces)) {
-               if(BMO_TestFlag(source, (BMHeader*)f, DUPE_INPUT)) {
+       for (f = BMIter_New(&faces, source, BM_FACES_OF_MESH, source); f; f= BMIter_Step(&faces)) {
+               if (BMO_TestFlag(source, (BMHeader*)f, DUPE_INPUT)) {
                        /*vertex pass*/
-                       for(v = BMIter_New(&verts, source, BM_VERTS_OF_FACE, f); v; v = BMIter_Step(&verts)) {
-                               if(!BMO_TestFlag(source, (BMHeader*)v, DUPE_DONE)) {
+                       for (v = BMIter_New(&verts, source, BM_VERTS_OF_FACE, f); v; v = BMIter_Step(&verts)) {
+                               if (!BMO_TestFlag(source, (BMHeader*)v, DUPE_DONE)) {
                                        copy_vertex(source,v, target, vhash);
                                        BMO_SetFlag(source, (BMHeader*)v, DUPE_DONE);
                                }
                        }
 
                        /*edge pass*/
-                       for(e = BMIter_New(&edges, source, BM_EDGES_OF_FACE, f); e; e = BMIter_Step(&edges)) {
-                               if(!BMO_TestFlag(source, (BMHeader*)e, DUPE_DONE)) {
+                       for (e = BMIter_New(&edges, source, BM_EDGES_OF_FACE, f); e; e = BMIter_Step(&edges)) {
+                               if (!BMO_TestFlag(source, (BMHeader*)e, DUPE_DONE)) {
                                        copy_edge(op, source, e, target,  vhash,  ehash);
                                        BMO_SetFlag(source, (BMHeader*)e, DUPE_DONE);
                                }
@@ -370,7 +370,7 @@ void splitop_exec(BMesh *bm, BMOperator *op)
        for (e= BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL);e;e=BMIter_Step(&iter)) {
                found = 0;
                f = BMIter_New(&iter2, bm, BM_FACES_OF_EDGE, e);
-               for (; f; f=BMIter_Step(&iter2)) {
+               for ( ; f; f=BMIter_Step(&iter2)) {
                        if (!BMO_TestFlag(bm, f, SPLIT_INPUT)) {
                                found = 1;
                                break;
@@ -382,7 +382,7 @@ void splitop_exec(BMesh *bm, BMOperator *op)
        for (v= BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);v;v=BMIter_Step(&iter)) {
                found = 0;
                e = BMIter_New(&iter2, bm, BM_EDGES_OF_VERT, v);
-               for (; e; e=BMIter_Step(&iter2)) {
+               for ( ; e; e=BMIter_Step(&iter2)) {
                        if (!BMO_TestFlag(bm, e, SPLIT_INPUT)) {
                                found = 1;
                                break;
@@ -436,13 +436,13 @@ static void delete_verts(BMesh *bm)
        BMIter edges;
        BMIter faces;
        
-       for(v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
-               if(BMO_TestFlag(bm, (BMHeader*)v, DEL_INPUT)) {
+       for (v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
+               if (BMO_TestFlag(bm, (BMHeader*)v, DEL_INPUT)) {
                        /*Visit edges*/
-                       for(e = BMIter_New(&edges, bm, BM_EDGES_OF_VERT, v); e; e = BMIter_Step(&edges))
+                       for (e = BMIter_New(&edges, bm, BM_EDGES_OF_VERT, v); e; e = BMIter_Step(&edges))
                                BMO_SetFlag(bm, (BMHeader*)e, DEL_INPUT);
                        /*Visit faces*/
-                       for(f = BMIter_New(&faces, bm, BM_FACES_OF_VERT, v); f; f = BMIter_Step(&faces))
+                       for (f = BMIter_New(&faces, bm, BM_FACES_OF_VERT, v); f; f = BMIter_Step(&faces))
                                BMO_SetFlag(bm, (BMHeader*)f, DEL_INPUT);
                }
        }
@@ -460,9 +460,9 @@ static void delete_edges(BMesh *bm)
        BMIter edges;
        BMIter faces;
 
-       for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
-               if(BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
-                       for(f = BMIter_New(&faces, bm, BM_FACES_OF_EDGE, e); f; f = BMIter_Step(&faces)) {
+       for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
+               if (BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
+                       for (f = BMIter_New(&faces, bm, BM_FACES_OF_EDGE, e); f; f = BMIter_Step(&faces)) {
                                        BMO_SetFlag(bm, (BMHeader*)f, DEL_INPUT);
                        }
                }
@@ -491,53 +491,54 @@ static void delete_context(BMesh *bm, int type)
        BMIter edges;
        BMIter faces;
        
-       if(type == DEL_VERTS) delete_verts(bm);
-       else if(type == DEL_EDGES) {
+       if (type == DEL_VERTS) delete_verts(bm);
+       else if (type == DEL_EDGES) {
                /*flush down to verts*/
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
-                       if(BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
+                       if (BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
                                BMO_SetFlag(bm, (BMHeader*)(e->v1), DEL_INPUT);
                                BMO_SetFlag(bm, (BMHeader*)(e->v2), DEL_INPUT);
                        }
                }
                delete_edges(bm);
                /*remove loose vertices*/
-               for(v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
-                       if(BMO_TestFlag(bm, (BMHeader*)v, DEL_INPUT) && (!(v->e)))
+               for (v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts)) {
+                       if (BMO_TestFlag(bm, (BMHeader*)v, DEL_INPUT) && (!(v->e)))
                                BMO_SetFlag(bm, (BMHeader*)v, DEL_WIREVERT);
                }
                BM_remove_tagged_verts(bm, DEL_WIREVERT);
        }
-       else if(type == DEL_EDGESFACES) delete_edges(bm);
-       else if(type == DEL_ONLYFACES) BM_remove_tagged_faces(bm, DEL_INPUT);
+       else if (type == DEL_EDGESFACES) delete_edges(bm);
+       else if (type == DEL_ONLYFACES) BM_remove_tagged_faces(bm, DEL_INPUT);
        else if (type == DEL_ONLYTAGGED) {
                BM_remove_tagged_faces(bm, DEL_INPUT);
                BM_remove_tagged_edges(bm, DEL_INPUT);
                BM_remove_tagged_verts(bm, DEL_INPUT);
-       } else if(type == DEL_FACES) {
+       }
+       else if (type == DEL_FACES) {
                /*go through and mark all edges and all verts of all faces for delete*/
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
-                       if(BMO_TestFlag(bm, (BMHeader*)f, DEL_INPUT)) {
-                               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_FACE, f); e; e = BMIter_Step(&edges))
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
+                       if (BMO_TestFlag(bm, (BMHeader*)f, DEL_INPUT)) {
+                               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_FACE, f); e; e = BMIter_Step(&edges))
                                        BMO_SetFlag(bm, (BMHeader*)e, DEL_INPUT);
-                               for(v = BMIter_New(&verts, bm, BM_VERTS_OF_FACE, f); v; v = BMIter_Step(&verts))
+                               for (v = BMIter_New(&verts, bm, BM_VERTS_OF_FACE, f); v; v = BMIter_Step(&verts))
                                        BMO_SetFlag(bm, (BMHeader*)v, DEL_INPUT);
                        }
                }
                /*now go through and mark all remaining faces all edges for keeping.*/
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
-                       if(!BMO_TestFlag(bm, (BMHeader*)f, DEL_INPUT)) {
-                               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_FACE, f); e; e= BMIter_Step(&edges)) {
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces)) {
+                       if (!BMO_TestFlag(bm, (BMHeader*)f, DEL_INPUT)) {
+                               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_FACE, f); e; e= BMIter_Step(&edges)) {
                                        BMO_ClearFlag(bm, (BMHeader*)e, DEL_INPUT);
                                }
-                               for(v = BMIter_New(&verts, bm, BM_VERTS_OF_FACE, f); v; v= BMIter_Step(&verts)) {
+                               for (v = BMIter_New(&verts, bm, BM_VERTS_OF_FACE, f); v; v= BMIter_Step(&verts)) {
                                        BMO_ClearFlag(bm, (BMHeader*)v, DEL_INPUT);
                                }
                        }
                }
                /*also mark all the vertices of remaining edges for keeping.*/
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
-                       if(!BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges)) {
+                       if (!BMO_TestFlag(bm, (BMHeader*)e, DEL_INPUT)) {
                                BMO_ClearFlag(bm, (BMHeader*)e->v1, DEL_INPUT);
                                BMO_ClearFlag(bm, (BMHeader*)e->v2, DEL_INPUT);
                        }
@@ -550,12 +551,12 @@ static void delete_context(BMesh *bm, int type)
                BM_remove_tagged_verts(bm, DEL_INPUT);
        }
        /*does this option even belong in here?*/
-       else if(type == DEL_ALL) {
-               for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces))
+       else if (type == DEL_ALL) {
+               for (f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces))
                        BMO_SetFlag(bm, (BMHeader*)f, DEL_INPUT);
-               for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges))
+               for (e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges))
                        BMO_SetFlag(bm, (BMHeader*)e, DEL_INPUT);
-               for(v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts))
+               for (v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts))
                        BMO_SetFlag(bm, (BMHeader*)v, DEL_INPUT);
                
                BM_remove_tagged_faces(bm, DEL_INPUT);
@@ -598,15 +599,16 @@ void spinop_exec(BMesh *bm, BMOperator *op)
        quat_to_mat3(rmat, q);
 
        BMO_CopySlot(op, op, "geom", "lastout");
-       for(a=0; a<steps; a++) {
-               if(dupli) {
+       for (a=0; a<steps; a++) {
+               if (dupli) {
                        BMO_InitOpf(bm, &dupop, "dupe geom=%s", op, "lastout");
                        BMO_Exec_Op(bm, &dupop);
                        BMO_CallOpf(bm, "rotate cent=%v mat=%m3 verts=%s",
                                cent, rmat, &dupop, "newout");
                        BMO_CopySlot(&dupop, op, "newout", "lastout");
                        BMO_Finish_Op(bm, &dupop);
-               } else {
+               }
+               else {
                        BMO_InitOpf(bm, &extop, "extrudefaceregion edgefacein=%s",
                                op, "lastout");
                        BMO_Exec_Op(bm, &extop);
@@ -616,7 +618,7 @@ void spinop_exec(BMesh *bm, BMOperator *op)
                        BMO_Finish_Op(bm, &extop);
                }
 
-               if(usedvec)
+               if (usedvec)
                        BMO_CallOpf(bm, "translate vec=%v verts=%s", dvec, op, "lastout");
        }
 }
index 73592985f2acad89e2a89af63af7ec6b44876998..a24fdbe901e92811542ed35ec0d44bdee6d1921a 100644 (file)
@@ -38,7 +38,7 @@ void connectverts_exec(BMesh *bm, BMOperator *op)
 
                l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
                lastl = NULL;
-               for (; l; l=BMIter_Step(&liter)) {
+               for ( ; l; l=BMIter_Step(&liter)) {
                        if (BMO_TestFlag(bm, l->v, VERT_INPUT)) {
                                if (!lastl) {
                                        lastl = l;
@@ -207,7 +207,8 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
                                if (c==0) {
                                        BLI_array_append(ee1, e2);
                                        BLI_array_append(vv1, v);
-                               } else {
+                               }
+                               else {
                                        BLI_array_append(ee2, e2);
                                        BLI_array_append(vv2, v);
                                }
@@ -230,7 +231,8 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
                                                printf("%s: internal state waning *TODO DESCRIPTION!*\n", __func__);
                                        }
                                        BLI_array_append(vv1, v);
-                               } else {
+                               }
+                               else {
                                        BLI_array_append(vv2, v);
                                }
                        }
index 8f608d4196eda46716cb9c459d1ebf38670adf20..d81122e42fb96eae8e24d53dbf109f7a218aa3e4 100644 (file)
@@ -78,7 +78,8 @@ static int rotsys_append_edge(struct BMEdge *e, struct BMVert *v,
 
                vd->e = e;
                e1->next = e1->prev = (Link*)e;
-       } else {
+       }
+       else {
                Link *e1, *e2, *e3;
                EdgeData *ved = &edata[BM_GetIndex(vd->e)];
 
@@ -448,7 +449,8 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
                                        i = 0;
                                        k++;
                                        continue;
-                               } else {
+                               }
+                               else {
                                        k++;
                                        continue;
                                }
@@ -499,7 +501,8 @@ static void init_rotsys(BMesh *bm, EdgeData *edata, VertData *vdata)
                                if (dot_v3v3(n1, n2) < 0.0f) {
                                        if (dot_v3v3(n1, n3) >= 0.0f + FLT_EPSILON*10) {
                                                SWAP(BMEdge*, edges[i], edges[(i+1)%totedge]);
-                                       } else {
+                                       }
+                                       else {
                                                SWAP(BMEdge*, edges[(i+totedge-1)%totedge], edges[(i+1)%totedge])
                                                SWAP(BMEdge*, edges[i], edges[(i+1)%totedge])
                                        }
@@ -742,7 +745,8 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
                while (1) {             
                        if (!last->cure) {
                                last->cure = e = vdata[BM_GetIndex(last->v)].e;
-                       } else {
+                       }
+                       else {
                                last->cure = e = rotsys_nextedge(last->cure, last->v, edata, vdata);
                                if (last->cure == vdata[BM_GetIndex(last->v)].e) {
                                        v2 = NULL;
@@ -1083,7 +1087,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op)
                if (!count) {
                        edges1 = edges;
                        BLI_array_set_length(edges1, BLI_array_count(edges));
-               } else {
+               }
+               else {
                        edges2 = edges;
                        BLI_array_set_length(edges2, BLI_array_count(edges));
                }
@@ -1097,7 +1102,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op)
                        BLI_array_free(edges1);
                        BLI_array_free(edges2);
                        return;
-               } else {
+               }
+               else {
                        edges1 = edges2;
                        edges2 = NULL;
                }
@@ -1114,7 +1120,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op)
                if (BLI_array_count(edges1)==1) {
                        v1 = edges1[0]->v1;
                        v2 = edges1[0]->v2;
-               } else {
+               }
+               else {
                        if (BM_Vert_In_Edge(edges1[1], edges1[0]->v1))
                                v1 = edges1[0]->v2;
                        else v1 = edges1[0]->v1;
@@ -1128,7 +1135,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op)
                if (BLI_array_count(edges2)==1) {
                        v3 = edges2[0]->v1;
                        v4 = edges2[0]->v2;
-               } else {
+               }
+               else {
                        if (BM_Vert_In_Edge(edges2[1], edges2[0]->v1))
                                v3 = edges2[0]->v2;
                        else v3 = edges2[0]->v1;
@@ -1153,7 +1161,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op)
                BMO_SetFlag(bm, e, ELE_NEW);
                e = BM_Make_Edge(bm, v2, v4, NULL, 1);
                BMO_SetFlag(bm, e, ELE_NEW);
-       } else if (edges1) {
+       }
+       else if (edges1) {
                BMVert *v1, *v2;
                
                if (BLI_array_count(edges1) > 1) {
@@ -1317,29 +1326,31 @@ void bmesh_contextual_create_exec(BMesh *bm, BMOperator *op)
                /*create edge*/
                e = BM_Make_Edge(bm, verts[0], verts[1], NULL, 1);
                BMO_SetFlag(bm, e, ELE_OUT);            
-       } else if (amount == 3) {
+       }
+       else if (amount == 3) {
                /*create triangle*/
                BM_Make_Face_QuadTri(bm, verts[0], verts[1], verts[2], NULL, NULL, 1);
-       } else if (amount == 4) {
+       }
+       else if (amount == 4) {
                f = NULL;
 
                /* the order of vertices can be anything, 6 cases to check */
-               if( is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[2]->co, verts[3]->co) ) {
+               if (is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[2]->co, verts[3]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[1], verts[2], verts[3], NULL, 1);
                }
-               else if( is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[3]->co, verts[1]->co) ) {
+               else if (is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[3]->co, verts[1]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[2], verts[3], verts[1], NULL, 1);
                }
-               else if( is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[1]->co, verts[3]->co) ) {
+               else if (is_quad_convex_v3(verts[0]->co, verts[2]->co, verts[1]->co, verts[3]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[2], verts[1], verts[3], NULL, 1);
                }
-               else if( is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[3]->co, verts[2]->co) ) {
+               else if (is_quad_convex_v3(verts[0]->co, verts[1]->co, verts[3]->co, verts[2]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[1], verts[3], verts[2], NULL, 1);
                }
-               else if( is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[2]->co, verts[1]->co) ) {
+               else if (is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[2]->co, verts[1]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[3], verts[2], verts[1], NULL, 1);
                }
-               else if( is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[1]->co, verts[2]->co) ) {
+               else if (is_quad_convex_v3(verts[0]->co, verts[3]->co, verts[1]->co, verts[2]->co)) {
                        f= BM_Make_Face_QuadTri(bm, verts[0], verts[3], verts[1], verts[2], NULL, 1);
                }
                else {
index dce3fe554e37cd2e928acffe11fac3c27e8071d9..f247c89b0af0e3aa09068c22d2d29c4364f5819f 100644 (file)
@@ -30,9 +30,9 @@ static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
 
        BMW_Init(&regwalker, bm, BMW_ISLAND,  0,0,0,FACE_MARK,  BMW_NIL_LAY);
        f2 = BMW_Begin(&regwalker, f);
-       for (; f2; f2=BMW_Step(&regwalker)) {
+       for ( ; f2; f2=BMW_Step(&regwalker)) {
                l2 = BMIter_New(&liter2, bm, BM_LOOPS_OF_FACE, f2);
-               for (; l2; l2=BMIter_Step(&liter2)) {                   
+               for ( ; l2; l2=BMIter_Step(&liter2)) {                  
                        l3 = bmesh_radial_nextloop(l2);
                        if (BMO_TestFlag(bm, l3->f, FACE_MARK) 
                            != BMO_TestFlag(bm, l2->f, FACE_MARK))
@@ -71,7 +71,7 @@ void dissolvefaces_exec(BMesh *bm, BMOperator *op)
                /*yay, walk!*/
                BMW_Init(&regwalker, bm, BMW_ISLAND,  0,0,0,FACE_MARK,  BMW_NIL_LAY);
                f2 = BMW_Begin(&regwalker, f);
-               for (; f2; f2=BMW_Step(&regwalker)) {
+               for ( ; f2; f2=BMW_Step(&regwalker)) {
                        BLI_array_append(faces, f2);
                }                               
                BMW_End(&regwalker);
@@ -253,9 +253,9 @@ static int test_extra_verts(BMesh *bm, BMVert *v)
        /*test faces around verts for verts that would be wronly killed
          by dissolve faces.*/
        f = BMIter_New(&iter, bm, BM_FACES_OF_VERT, v);
-       for (; f; f=BMIter_Step(&iter)) {
+       for ( ; f; f=BMIter_Step(&iter)) {
                l=BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
-               for (; l; l=BMIter_Step(&liter)) {
+               for ( ; l; l=BMIter_Step(&liter)) {
                        if (!BMO_TestFlag(bm, l->v, VERT_MARK)) {
                                /*if an edge around a vert is a boundary edge,
                                   then dissolve faces won't destroy it.
@@ -263,10 +263,10 @@ static int test_extra_verts(BMesh *bm, BMVert *v)
                                   of the face regions*/
                                found = 0;
                                e = BMIter_New(&iter2, bm, BM_EDGES_OF_VERT, l->v);
-                               for (; e; e=BMIter_Step(&iter2)) {
+                               for ( ; e; e=BMIter_Step(&iter2)) {
                                        if (BM_Edge_FaceCount(e)==1) found = 1;
                                        f2 = BMIter_New(&iter3, bm, BM_FACES_OF_EDGE, e);
-                                       for (; f2; f2=BMIter_Step(&iter3)) {
+                                       for ( ; f2; f2=BMIter_Step(&iter3)) {
                                                if (!BMO_TestFlag(bm, f2, FACE_MARK)) {
                                                        found = 1;
                                                        break;
@@ -303,7 +303,7 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
                        }
 
                        f=BMIter_New(&fiter, bm, BM_FACES_OF_VERT, v);
-                       for (; f; f=BMIter_Step(&fiter)) {
+                       for ( ; f; f=BMIter_Step(&fiter)) {
                                BMO_SetFlag(bm, f, FACE_ORIG);
                                BMO_SetFlag(bm, f, FACE_MARK);
                        }
@@ -312,15 +312,16 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
                          will destroy nonmarked vertices.*/
                        if (!test_extra_verts(bm, v)) {
                                f=BMIter_New(&fiter, bm, BM_FACES_OF_VERT, v);
-                               for (; f; f=BMIter_Step(&fiter)) {
+                               for ( ; f; f=BMIter_Step(&fiter)) {
                                        if (BMO_TestFlag(bm, f, FACE_ORIG)) {
                                                BMO_ClearFlag(bm, f, FACE_MARK);
                                                BMO_ClearFlag(bm, f, FACE_ORIG);
                                        }
                                }
-                       } else {
+                       }
+                       else {
                                f=BMIter_New(&fiter, bm, BM_FACES_OF_VERT, v);
-                               for (; f; f=BMIter_Step(&fiter)) {
+                               for ( ; f; f=BMIter_Step(&fiter)) {
                                        BMO_ClearFlag(bm, f, FACE_ORIG);
                                }
                        }
@@ -373,10 +374,10 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
                                        found2 = 0;
                                        l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
                                        fe = l->e;
-                                       for (; l; l=BMIter_Step(&liter)) {
+                                       for ( ; l; l=BMIter_Step(&liter)) {
                                                f2 = BMIter_New(&fiter, bm,
                                                                BM_FACES_OF_EDGE, l->e);
-                                               for (; f2; f2=BMIter_Step(&fiter)) {
+                                               for ( ; f2; f2=BMIter_Step(&fiter)) {
                                                        if (f2 != f) {
                                                                BM_Join_TwoFaces(bm, f, f2, l->e);
                                                                found2 = 1;
@@ -398,7 +399,7 @@ void dissolveverts_exec(BMesh *bm, BMOperator *op)
 
                                        //check for duplicate edges
                                        l = BMIter_New(&liter, bm, BM_LOOPS_OF_FACE, f);
-                                       for (; l; l=BMIter_Step(&liter)) {
+                                       for ( ; l; l=BMIter_Step(&liter)) {
                                                ed[i] = l->e;   
                                                lp[i] = l;
                                                vt[i++] = l->v;
index 6c35fa924527ee4d7d6526c6284ef6a667e2bc4b..3d9acb98b50ab2432220edb02c50b08181bc7d3d 100644 (file)
@@ -94,7 +94,7 @@ static BMFace *remake_face(BMesh *bm, EdgeTag *etags, BMFace *f, BMVert **verts,
 
        l = BMIter_New(&liter1, bm, BM_LOOPS_OF_FACE, f);
        l2 = BMIter_New(&liter2, bm, BM_LOOPS_OF_FACE, f2);
-       for (; l && l2; l=BMIter_Step(&liter1), l2=BMIter_Step(&liter2)) {
+       for ( ; l && l2; l=BMIter_Step(&liter1), l2=BMIter_Step(&liter2)) {
                BM_Copy_Attributes(bm, bm, l, l2);
                if (l->e != l2->e) {
                        /*set up data for figuring out the two sides of
@@ -368,14 +368,14 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op)
                /* debugging code, quick way to find the face/vert combination
                 * which is failing assuming quads start planer - campbell */
 #if 0
-               if(f->len == 4) {
+               if (f->len == 4) {
                        float no1[3];
                        float no2[3];
                        float angle_error;
                        printf(" ** found QUAD\n");
                        normal_tri_v3(no1, verts[0]->co, verts[1]->co, verts[2]->co);
                        normal_tri_v3(no2, verts[0]->co, verts[2]->co, verts[3]->co);
-                       if((angle_error= angle_v3v3(no1, no2)) > 0.05) {
+                       if ((angle_error= angle_v3v3(no1, no2)) > 0.05) {
                                printf("     ERROR %.4f\n", angle_error);
                                print_v3("0", verts[0]->co);
                                print_v3("1", verts[1]->co);
index fde240d70de50c5322877200da7475aab541056d..6d454ac34ac2ccc0dc6c0798d645f61ebf81be64 100644 (file)
@@ -114,7 +114,7 @@ void bmesh_extrude_onlyedge_exec(BMesh *bm, BMOperator *op)
        BMO_Exec_Op(bm, &dupeop);
 
        e = BMO_IterNew(&siter, bm, &dupeop, "boundarymap", 0);
-       for (; e; e=BMO_IterStep(&siter)) {
+       for ( ; e; e=BMO_IterStep(&siter)) {
                e2 = BMO_IterMapVal(&siter);
                e2 = *(BMEdge**)e2;
 
@@ -123,7 +123,8 @@ void bmesh_extrude_onlyedge_exec(BMesh *bm, BMOperator *op)
                        v2 = e->v2;
                        v3 = e2->v2;
                        v4 = e2->v1;
-               } else {
+               }
+               else {
                        v1 = e2->v1;
                        v2 = e2->v2;
                        v3 = e->v2;
@@ -154,7 +155,7 @@ void extrude_vert_indiv_exec(BMesh *bm, BMOperator *op)
        BMEdge *e;
 
        v = BMO_IterNew(&siter, bm, op, "verts", BM_VERT);
-       for (; v; v=BMO_IterStep(&siter)) {
+       for ( ; v; v=BMO_IterStep(&siter)) {
                dupev = BM_Make_Vert(bm, v->co, v);
 
                e = BM_Make_Edge(bm, v, dupev, NULL, 0);
@@ -255,7 +256,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
        
        BMO_CopySlot(&dupeop, op, "newout", "geomout");
        e = BMO_IterNew(&siter, bm, &dupeop, "boundarymap", 0);
-       for (; e; e=BMO_IterStep(&siter)) {
+       for ( ; e; e=BMO_IterStep(&siter)) {
                if (BMO_InMap(bm, op, "exclude", e)) continue;
 
                newedge = BMO_IterMapVal(&siter);
@@ -276,7 +277,8 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
                        verts[1] = e->v2;
                        verts[2] = newedge->v2;
                        verts[3] = newedge->v1;
-               } else {
+               }
+               else {
                        verts[3] = e->v1;
                        verts[2] = e->v2;
                        verts[1] = newedge->v2;
@@ -288,7 +290,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
 
                /*copy attributes*/
                l=BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, f);
-               for (; l; l=BMIter_Step(&iter)) {
+               for ( ; l; l=BMIter_Step(&iter)) {
                        if (l->e != e && l->e != newedge) continue;
                        l2 = l->radial_next;
                        
@@ -300,7 +302,8 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
                                l2 = l2->next;
                                l = l->next;
                                BM_Copy_Attributes(bm, bm, l2, l);
-                       } else {
+                       }
+                       else {
                                BM_Copy_Attributes(bm, bm, l2->f, l->f);
 
                                /*copy data*/
@@ -309,7 +312,8 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
                                        l2 = l2->next;
                                        l = l->next;
                                        BM_Copy_Attributes(bm, bm, l2, l);
-                               } else {
+                               }
+                               else {
                                        l2 = l2->next;
                                        BM_Copy_Attributes(bm, bm, l2, l);
                                        l2 = l2->prev;
@@ -322,7 +326,7 @@ void extrude_edge_context_exec(BMesh *bm, BMOperator *op)
 
        /*link isolated verts*/
        v = BMO_IterNew(&siter, bm, &dupeop, "isovertmap", 0);
-       for (; v; v=BMO_IterStep(&siter)) {
+       for ( ; v; v=BMO_IterStep(&siter)) {
                v2 = *((void**)BMO_IterMapVal(&siter));
                BM_Make_Edge(bm, v, v2, v->e, 1);
        }
@@ -507,7 +511,7 @@ static void solidify_add_thickness(BMesh *bm, float dist)
        BM_ElemIndex_Ensure(bm, BM_VERT);
 
        BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
-               if(!BMO_TestFlag(bm, f, FACE_MARK)) {
+               if (!BMO_TestFlag(bm, f, FACE_MARK)) {
                        continue;
                }
 
@@ -534,7 +538,7 @@ static void solidify_add_thickness(BMesh *bm, float dist)
 
        BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) {
                index = BM_GetIndex(v);
-               if(vert_accum[index]) { /* zero if unselected */
+               if (vert_accum[index]) { /* zero if unselected */
                        float vdist = MIN2(maxdist, dist * vert_angles[index] / vert_accum[index]);
                        madd_v3_v3fl(v->co, v->no, vdist);
                }
index e27d1ecec29524000dbfb675e369f757adc528f2..49fb696796532a7ca0e35c5803f33772773a9919 100644 (file)
@@ -55,17 +55,17 @@ static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
        normal_tri_v3(n1, v1->co, v2->co, v3->co);
        normal_tri_v3(n2, v1->co, v3->co, v4->co);
 
-       if(n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle1 = 0.0f;
+       if (n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle1 = 0.0f;
        else angle1 = angle_v3v3(n1, n2);
 
        normal_tri_v3(n1, v2->co, v3->co, v4->co);
        normal_tri_v3(n2, v4->co, v1->co, v2->co);
 
-       if(n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle2 = 0.0f;
+       if (n1[0] == n2[0] && n1[1] == n2[1] && n1[2] == n2[2]) angle2 = 0.0f;
        else angle2 = angle_v3v3(n1, n2);
 
        measure += (angle1 + angle2) * 0.5f;
-       if(measure > limit) return measure;
+       if (measure > limit) return measure;
 
        /*Second test: Colinearity*/
        sub_v3_v3v3(edgeVec1, v1->co, v2->co);
@@ -79,22 +79,22 @@ static float measure_facepair(BMesh *UNUSED(bm), BMVert *v1, BMVert *v2,
                fabsf(angle_v3v3(edgeVec2, edgeVec3) - (float)M_PI_2) +
                fabsf(angle_v3v3(edgeVec3, edgeVec4) - (float)M_PI_2) +
                fabsf(angle_v3v3(edgeVec4, edgeVec1) - (float)M_PI_2));
-       if(!diff) return 0.0;
+       if (!diff) return 0.0;
 
        measure +=  diff;
-       if(measure > limit) return measure;
+       if (measure > limit) return measure;
 
        /*Third test: Concavity*/
        areaA = area_tri_v3(v1->co, v2->co, v3->co) + area_tri_v3(v1->co, v3->co, v4->co);
        areaB = area_tri_v3(v2->co, v3->co, v4->co) + area_tri_v3(v4->co, v1->co, v2->co);
 
-       if(areaA <= areaB) minarea = areaA;
+       if (areaA <= areaB) minarea = areaA;
        else minarea = areaB;
 
-       if(areaA >= areaB) maxarea = areaA;
+       if (areaA >= areaB) maxarea = areaA;
        else maxarea = areaB;
 
-       if(!maxarea) measure += 1;
+       if (!maxarea) measure += 1;
        else measure += (1 - (minarea / maxarea));
 
        return measure;
@@ -118,7 +118,8 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
        if (l1->v == l3->v) {
                l2 = l1->next;
                l4 = l2->next;
-       } else {
+       }
+       else {
                l2 = l1->next;
 
                l4 = l3;
@@ -147,7 +148,7 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
        /*compare faceedges for each face attribute. Additional per face attributes can be added later*/
 
        /*do VCOLs*/
-       if(lcol1 && dovcols) {
+       if (lcol1 && dovcols) {
                char *cols[4] = {(char*)lcol1, (char*)lcol2, (char*)lcol3, (char*)lcol4};
                int i;
 
@@ -164,15 +165,15 @@ static int compareFaceAttribs(BMesh *bm, BMEdge *e, int douvs, int dovcols)
 
        /*do UVs*/
        if (luv1 && douvs) {
-               if(tp1->tpage != tp2->tpage); /*do nothing*/
+               if (tp1->tpage != tp2->tpage); /*do nothing*/
                else {
                        int i;
 
-                       for(i = 0; i < 2; i++) {
-                               if(luv1->uv[0] + T2QUV_LIMIT > luv3->uv[0] && luv1->uv[0] - T2QUV_LIMIT < luv3->uv[0] &&
+                       for (i = 0; i < 2; i++) {
+                               if (luv1->uv[0] + T2QUV_LIMIT > luv3->uv[0] && luv1->uv[0] - T2QUV_LIMIT < luv3->uv[0] &&
                                        luv1->uv[1] + T2QUV_LIMIT > luv3->uv[1] && luv1->uv[1] - T2QUV_LIMIT < luv3->uv[1])
                                {
-                                       if(luv2->uv[0] + T2QUV_LIMIT > luv4->uv[0] && luv2->uv[0] - T2QUV_LIMIT < luv4->uv[0] &&
+                                       if (luv2->uv[0] + T2QUV_LIMIT > luv4->uv[0] && luv2->uv[0] - T2QUV_LIMIT < luv4->uv[0] &&
                                                luv2->uv[1] + T2QUV_LIMIT > luv4->uv[1] && luv2->uv[1] - T2QUV_LIMIT < luv4->uv[1])
                                        {
                                                mergeok_uvs = 1;
@@ -202,8 +203,8 @@ static int fplcmp(const void *v1, const void *v2)
 {
        const JoinEdge *e1= ((JoinEdge*)v1), *e2=((JoinEdge*)v2);
 
-       ife1->weight > e2->weight) return 1;
-       else ife1->weight < e2->weight) return -1;
+       if (e1->weight > e2->weight) return 1;
+       else if (e1->weight < e2->weight) return -1;
 
        return 0;
 }
@@ -281,7 +282,7 @@ void bmesh_jointriangles_exec(BMesh *bm, BMOperator *op)
                        continue;
 
                measure = measure_facepair(bm, v1, v2, v3, v4, limit);
-               if(measure < limit) {
+               if (measure < limit) {
                        BLI_array_growone(jedges);
 
                        jedges[i].e = e;
index 39f312c72f8e144143373e35b03e2b1cf64b4f94..6bc9fdda1160b3b4bbb69d11f870abf595c18869 100644 (file)
@@ -94,7 +94,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
        }
 
        actkey = ob_get_keyblock(ob);
-       if(actkey && actkey->totelem == me->totvert) {
+       if (actkey && actkey->totelem == me->totvert) {
                CustomData_add_layer(&bm->vdata, CD_SHAPE_KEYINDEX, CD_ASSIGN, NULL, 0);
                
                /*check if we need to generate unique ids for the shapekeys.
@@ -117,7 +117,8 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
                        j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
                        bm->vdata.layers[j].uid = block->uid;
                }
-       } else if (actkey) {
+       }
+       else if (actkey) {
                printf("shapekey<->mesh mismatch!\n");
        }
        
@@ -296,31 +297,33 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
                BMFace **face_array = MEM_callocN(sizeof(BMFace *) * bm->totface,
                                                "Selection Conversion Face Pointer Array");
 
-               for(i = 0, vertex = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
+               for (i = 0, vertex = BMIter_New(&iter, bm, BM_VERTS_OF_MESH, NULL);
                    vertex; i++, vertex = BMIter_Step(&iter))
                {
                        vertex_array[i] = vertex;
                }
 
-               for(i = 0, edge = BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL);
+               for (i = 0, edge = BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL);
                    edge; i++, edge = BMIter_Step(&iter))
                {
                        edge_array[i] = edge;
                }
 
-               for(i = 0, face = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
+               for (i = 0, face = BMIter_New(&iter, bm, BM_FACES_OF_MESH, NULL);
                    face; i++, face = BMIter_Step(&iter))
                {
                        face_array[i] = face;
                }
 
-               if(me->mselect) {
-                       for(i = 0; i < me->totselect; i++) {
-                               if(me->mselect[i].type == ME_VSEL) {
+               if (me->mselect) {
+                       for (i = 0; i < me->totselect; i++) {
+                               if (me->mselect[i].type == ME_VSEL) {
                                        BM_store_selection(bm, vertex_array[me->mselect[i].index]);
-                               }else if(me->mselect[i].type == ME_ESEL) {
+                               }
+                               else if (me->mselect[i].type == ME_ESEL) {
                                        BM_store_selection(bm, edge_array[me->mselect[i].index]);
-                               }else if(me->mselect[i].type == ME_FSEL) {
+                               }
+                               else if (me->mselect[i].type == ME_FSEL) {
                                        BM_store_selection(bm, face_array[me->mselect[i].index]);
                                }
                        }
@@ -370,17 +373,17 @@ static BMVert **bmesh_to_mesh_vertex_map(BMesh *bm, int ototvert)
        BLI_assert(ototvert > 0);
 
        vertMap = MEM_callocN(sizeof(*vertMap)*ototvert, "vertMap");
-       if(CustomData_has_layer(&bm->vdata, CD_SHAPE_KEYINDEX)) {
+       if (CustomData_has_layer(&bm->vdata, CD_SHAPE_KEYINDEX)) {
                int *keyi;
                BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
                        keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
-                       if(keyi) {
+                       if (keyi) {
                                if (((index= *keyi) != ORIGINDEX_NONE) && (index < ototvert)) {
                                        vertMap[index] = eve;
                                }
                        }
                        else {
-                               if(i < ototvert) {
+                               if (i < ototvert) {
                                        vertMap[i] = eve;
                                }
                        }
@@ -389,7 +392,7 @@ static BMVert **bmesh_to_mesh_vertex_map(BMesh *bm, int ototvert)
        }
        else {
                BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
-                       if(i < ototvert) {
+                       if (i < ototvert) {
                                vertMap[i] = eve;
                        }
                        else {
@@ -436,16 +439,16 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
        ototvert = me->totvert;
 
        /* new Vertex block */
-       if(bm->totvert==0) mvert= NULL;
+       if (bm->totvert==0) mvert= NULL;
        else mvert= MEM_callocN(bm->totvert*sizeof(MVert), "loadeditbMesh vert");
 
        /* new Edge block */
-       if(bm->totedge==0) medge= NULL;
+       if (bm->totedge==0) medge= NULL;
        else medge= MEM_callocN(bm->totedge*sizeof(MEdge), "loadeditbMesh edge");
        
        /*build ngon data*/
        /* new Ngon Face block */
-       if(bm->totface==0) mpoly = NULL;
+       if (bm->totface==0) mpoly = NULL;
        else mpoly= MEM_callocN(bm->totface*sizeof(MPoly), "loadeditbMesh poly");
        
        /*find number of loops to allocate*/
@@ -587,17 +590,17 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                        vertMap= bmesh_to_mesh_vertex_map(bm, ototvert);
                                }
 
-                               if(ob->par1 < ototvert) {
+                               if (ob->par1 < ototvert) {
                                        eve = vertMap[ob->par1];
-                                       if(eve) ob->par1= BM_GetIndex(eve);
+                                       if (eve) ob->par1= BM_GetIndex(eve);
                                }
-                               if(ob->par2 < ototvert) {
+                               if (ob->par2 < ototvert) {
                                        eve = vertMap[ob->par2];
-                                       if(eve) ob->par2= BM_GetIndex(eve);
+                                       if (eve) ob->par2= BM_GetIndex(eve);
                                }
-                               if(ob->par3 < ototvert) {
+                               if (ob->par3 < ototvert) {
                                        eve = vertMap[ob->par3];
-                                       if(eve) ob->par3= BM_GetIndex(eve);
+                                       if (eve) ob->par3= BM_GetIndex(eve);
                                }
                                
                        }
@@ -611,7 +614,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                                }
                                                
                                                for (i=j=0; i<hmd->totindex; i++) {
-                                                       if(hmd->indexar[i] < ototvert) {
+                                                       if (hmd->indexar[i] < ototvert) {
                                                                eve = vertMap[hmd->indexar[i]];
                                                                
                                                                if (eve) {
@@ -640,19 +643,21 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                BMEditSelection *selected;
                me->totselect = BLI_countlist(&(bm->selected));
 
-               if(me->mselect) MEM_freeN(me->mselect);
+               if (me->mselect) MEM_freeN(me->mselect);
 
                me->mselect = MEM_callocN(sizeof(MSelect) * me->totselect, "Mesh selection history");
 
 
-               for(i = 0, selected = bm->selected.first; selected; i++, selected = selected->next) {
-                       if(selected->htype == BM_VERT) {
+               for (i = 0, selected = bm->selected.first; selected; i++, selected = selected->next) {
+                       if (selected->htype == BM_VERT) {
                                me->mselect[i].type = ME_VSEL;
 
-                       }else if(selected->htype == BM_EDGE) {
+                       }
+                       else if (selected->htype == BM_EDGE) {
                                me->mselect[i].type = ME_ESEL;
 
-                       }else if(selected->htype == BM_FACE) {
+                       }
+                       else if (selected->htype == BM_FACE) {
                                me->mselect[i].type = ME_FSEL;
                        }
 
@@ -696,17 +701,17 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
 
 
                /* editing the base key should update others */
-               if(me->key->type==KEY_RELATIVE && oldverts) {
+               if (me->key->type==KEY_RELATIVE && oldverts) {
                        int act_is_basis = 0;
                        /* find if this key is a basis for any others */
-                       for(currkey = me->key->block.first; currkey; currkey= currkey->next) {
-                               if(bm->shapenr-1 == currkey->relative) {
+                       for (currkey = me->key->block.first; currkey; currkey= currkey->next) {
+                               if (bm->shapenr-1 == currkey->relative) {
                                        act_is_basis = 1;
                                        break;
                                }
                        }
 
-                       if(act_is_basis) { /* active key is a base */
+                       if (act_is_basis) { /* active key is a base */
                                float (*fp)[3]= actkey->data;
                                int *keyi;
                                i=0;
@@ -714,7 +719,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                mvert = me->mvert;
                                BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
                                        keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
-                                       if(keyi && *keyi != ORIGINDEX_NONE) {
+                                       if (keyi && *keyi != ORIGINDEX_NONE) {
                                                sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
                                        }
                                        i++;
@@ -747,7 +752,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                                copy_v3_v3(fp, co);
 
                                                /* propagate edited basis offsets to other shapes */
-                                               if(apply_offset) {
+                                               if (apply_offset) {
                                                        add_v3_v3(fp, *ofs_pt++);
                                                }
 
@@ -766,7 +771,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                        }
                }
 
-               if(ofs) MEM_freeN(ofs);
+               if (ofs) MEM_freeN(ofs);
        }
 
        /* XXX, code below is from trunk and a duplicate functionality
@@ -777,7 +782,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
        /* old method of reconstructing keys via vertice's original key indices,
           currently used if the new method above fails (which is theoretically
           possible in certain cases of undo).*/
-       if(me->key) {
+       if (me->key) {
                float *fp, *newkey, *oldkey;
                KeyBlock *currkey;
                KeyBlock *actkey= BLI_findlink(&me->key->block, bm->shapenr-1);
@@ -785,17 +790,17 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                float (*ofs)[3] = NULL;
 
                /* editing the base key should update others */
-               if(me->key->type==KEY_RELATIVE && oldverts) {
+               if (me->key->type==KEY_RELATIVE && oldverts) {
                        int act_is_basis = 0;
                        /* find if this key is a basis for any others */
-                       for(currkey = me->key->block.first; currkey; currkey= currkey->next) {
-                               if(bm->shapenr-1 == currkey->relative) {
+                       for (currkey = me->key->block.first; currkey; currkey= currkey->next) {
+                               if (bm->shapenr-1 == currkey->relative) {
                                        act_is_basis = 1;
                                        break;
                                }
                        }
 
-                       if(act_is_basis) { /* active key is a base */
+                       if (act_is_basis) { /* active key is a base */
                                float (*fp)[3]= actkey->data;
                                int *keyi;
                                i=0;
@@ -803,7 +808,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                mvert = me->mvert;
                                BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
                                        keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
-                                       if(keyi && *keyi != ORIGINDEX_NONE) {
+                                       if (keyi && *keyi != ORIGINDEX_NONE) {
                                                sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
                                        }
                                        i++;
@@ -815,7 +820,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                /* Lets reorder the key data so that things line up roughly
                 * with the way things were before editmode */
                currkey = me->key->block.first;
-               while(currkey) {
+               while (currkey) {
                        int apply_offset = (ofs && (currkey != actkey) && (bm->shapenr-1 == currkey->relative));
 
                        if (!(currkey->flag & KEYBLOCK_MISSING)) {
@@ -835,25 +840,25 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
 
                        i = 0;
                        mvert = me->mvert;
-                       while(eve) {
+                       while (eve) {
                                keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
                                if (!keyi) {
                                        break;
                                }
                                if (*keyi >= 0 && *keyi < currkey->totelem) { // valid old vertex
-                                       if(currkey == actkey) {
-                                               if(actkey == me->key->refkey) {
+                                       if (currkey == actkey) {
+                                               if (actkey == me->key->refkey) {
                                                        copy_v3_v3(fp, mvert->co);
                                                }
                                                else {
                                                        copy_v3_v3(fp, mvert->co);
-                                                       if(oldverts) {
+                                                       if (oldverts) {
                                                                copy_v3_v3(mvert->co, oldverts[*keyi].co);
                                                        }
                                                }
                                        }
                                        else {
-                                               if(oldkey) {
+                                               if (oldkey) {
                                                        copy_v3_v3(fp, oldkey + 3 * *keyi);
                                                }
                                        }
@@ -863,7 +868,7 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                }
 
                                /* propagate edited basis offsets to other shapes */
-                               if(apply_offset) {
+                               if (apply_offset) {
                                        add_v3_v3(fp, ofs[i]);
                                }
 
@@ -873,14 +878,14 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op)
                                eve= BMIter_Step(&iter);
                        }
                        currkey->totelem= bm->totvert;
-                       if(currkey->data) MEM_freeN(currkey->data);
+                       if (currkey->data) MEM_freeN(currkey->data);
                        currkey->data = newkey;
                        
                        currkey= currkey->next;
                }
 
-               if(ofs) MEM_freeN(ofs);
+               if (ofs) MEM_freeN(ofs);
        }
 
-       if(oldverts) MEM_freeN(oldverts);
+       if (oldverts) MEM_freeN(oldverts);
 }
index d78e0e1c18a22340234abd0065fbf27d172f5a5b..10d8319fda5e338f16ee3df640f5ac8595f2941c 100644 (file)
@@ -230,7 +230,7 @@ void bmesh_create_grid_exec(BMesh *bm, BMOperator *op)
        /* one segment first: the X axis */
        phi= 1.0f;
        phid= 2.0f/((float)tot-1);
-       for(a=0;a<tot;a++) {
+       for (a=0;a<tot;a++) {
                vec[0]= dia*phi;
                vec[1]= - dia;
                vec[2]= 0.0f;
@@ -253,14 +253,15 @@ void bmesh_create_grid_exec(BMesh *bm, BMOperator *op)
        vec[1]= dia*phid;
        mul_mat3_m4_v3(mat, vec);
                
-       for(a=0;a<seg-1;a++) {
+       for (a=0;a<seg-1;a++) {
                if (a) {
                        BMO_InitOpf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
                        BMO_Exec_Op(bm, &bmop);
                        BMO_Finish_Op(bm, &prevop);
 
                        BMO_Flag_Buffer(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
-               } else {
+               }
+               else {
                        BMO_InitOpf(bm, &bmop, "extrude_edge_only edges=%fe", EDGE_ORIG);
                        BMO_Exec_Op(bm, &bmop);
                        BMO_Flag_Buffer(bm, &bmop, "geomout", VERT_MARK, BM_VERT);
@@ -289,12 +290,12 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
        BMO_Get_Mat4(op, "mat", mat);
 
        phid= 2.0f*(float)M_PI/tot;
-       phi= .25f*(float)M_PI;
+       phi= 0.25f*(float)M_PI;
 
        /* one segment first */
        phi= 0; 
        phid/=2;
-       for(a=0; a<=tot; a++) {
+       for (a=0; a<=tot; a++) {
                /* Going in this direction, then edge extruding, makes normals face outward */
                vec[0]= -dia*sinf(phi);
                vec[1]= 0.0;
@@ -302,7 +303,7 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
                eve= BM_Make_Vert(bm, vec, NULL);
                BMO_SetFlag(bm, eve, VERT_MARK);
 
-               if(a != 0) {
+               if (a != 0) {
                        e = BM_Make_Edge(bm, preveve, eve, NULL, 0);
                        BMO_SetFlag(bm, e, EDGE_ORIG);
                }
@@ -318,12 +319,13 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
        q[1]=q[2]= 0;
        quat_to_mat3(cmat, q);
 
-       for(a=0; a<seg; a++) {
+       for (a=0; a<seg; a++) {
                if (a) {
                        BMO_InitOpf(bm, &bmop, "extrude_edge_only edges=%s", &prevop, "geomout");
                        BMO_Exec_Op(bm, &bmop);
                        BMO_Finish_Op(bm, &prevop);
-               } else {
+               }
+               else {
                        BMO_InitOpf(bm, &bmop, "extrude_edge_only edges=%fe", EDGE_ORIG);
                        BMO_Exec_Op(bm, &bmop);
                }
@@ -341,7 +343,7 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op)
 
        /* and now do imat */
        BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
-               if(BMO_TestFlag(bm, eve, VERT_MARK)) {
+               if (BMO_TestFlag(bm, eve, VERT_MARK)) {
                        mul_m4_v3(mat, eve->co);
                }
        }
@@ -364,7 +366,7 @@ void bmesh_create_icosphere_exec(BMesh *bm, BMOperator *op)
        /* phi= .25f*(float)M_PI; */         /* UNUSED */
 
        dia/=200;
-       for(a=0;a<12;a++) {
+       for (a=0;a<12;a++) {
                vec[0]= dia*icovert[a][0];
                vec[1]= dia*icovert[a][1];
                vec[2]= dia*icovert[a][2];
@@ -374,7 +376,7 @@ void bmesh_create_icosphere_exec(BMesh *bm, BMOperator *op)
                BM_Select(bm, eva[a], TRUE);
        }
 
-       for(a=0;a<20;a++) {
+       for (a=0;a<20;a++) {
                BMFace *eftemp;
                BMVert *v1, *v2, *v3;
 
@@ -393,7 +395,7 @@ void bmesh_create_icosphere_exec(BMesh *bm, BMOperator *op)
 
        dia*=200;
 
-       for(a=1; a<subdiv; a++) {
+       for (a=1; a<subdiv; a++) {
                BMOperator bmop;
 
                BMO_InitOpf(bm, &bmop, 
@@ -575,7 +577,8 @@ void bmesh_create_cone_exec(BMesh *bm, BMOperator *op)
                                BMO_SetFlag(bm, f, FACE_NEW);
                        }
                        BM_Make_Face_QuadTri(bm, lastv1, lastv2, v2, v1, NULL, 0);
-               } else {
+               }
+               else {
                        firstv1 = v1;
                        firstv2 = v2;
                }
index a6dd09752deee221f3040239add5a99d2db58a99..00aaaf0527ad02e56b980f139ac19d8bc1376aed 100644 (file)
@@ -66,11 +66,11 @@ int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
 
        if (overlapface) *overlapface = NULL;
 
-       for(i=0; i < len; i++) {
-               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i] );
-               while(f) {
+       for (i=0; i < len; i++) {
+               f = BMIter_New(&vertfaces, bm, BM_FACES_OF_VERT, varr[i]);
+               while (f) {
                        amount = BM_Verts_In_Face(bm, f, varr, len);
-                       if(amount >= len) {
+                       if (amount >= len) {
                                if (overlapface) *overlapface = f;
                                return 1;                               
                        }
@@ -323,7 +323,8 @@ void bmesh_pointmerge_exec(BMesh *bm, BMOperator *op)
                if (!snapv) {
                        snapv = v;
                        copy_v3_v3(snapv->co, vec);
-               } else {
+               }
+               else {
                        BMO_Insert_MapPointer(bm, &weldop, "targetmap", v, snapv);
                }               
        }
index 5d8eb6688763782905ab56d0c80d055f40440db8..97e4e34059f4be10e204c5157fbe5c8a09933036 100644 (file)
@@ -96,9 +96,11 @@ NOTE: beauty has been renamed to flag!
        while (1) {
                if (d > dp) {
                        d -= wid;
-               } else if (d < dp) {
+               }
+               else if (d < dp) {
                        d += wid;
-               } else {
+               }
+               else {
                        break;
                }
 
@@ -176,7 +178,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar
        co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, params->origkey);
        copy_v3_v3(prev_co, co);
 
-       if(params->beauty & B_SMOOTH) {
+       if (params->beauty & B_SMOOTH) {
                /* we calculate an offset vector vec1[], to be added to *co */
                float len, nor[3], nor1[3], nor2[3], smooth=params->smooth;
 
@@ -201,12 +203,12 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar
 
                add_v3_v3(co, tvec);
        }
-       else if(params->beauty & B_SPHERE) { /* subdivide sphere */
+       else if (params->beauty & B_SPHERE) { /* subdivide sphere */
                normalize_v3(co);
                mul_v3_fl(co, params->smooth);
        }
 
-       if(params->beauty & B_FRACTAL) {
+       if (params->beauty & B_FRACTAL) {
                float len = len_v3v3(vsta->co, vend->co);
                float vec2[3] = {0.0f, 0.0f, 0.0f}, co2[3];
 
@@ -263,13 +265,13 @@ static BMVert *bm_subdivide_edge_addvert(BMesh *bm, BMEdge *edge,BMEdge *oedge,
 #if 0 //BMESH_TODO
        /* clip if needed by mirror modifier */
        if (edge->v1->f2) {
-               if ( edge->v1->f2 & edge->v2->f2 & 1) {
+               if (edge->v1->f2 & edge->v2->f2 & 1) {
                        co[0]= 0.0f;
                }
-               if ( edge->v1->f2 & edge->v2->f2 & 2) {
+               if (edge->v1->f2 & edge->v2->f2 & 2) {
                        co[1]= 0.0f;
                }
-               if ( edge->v1->f2 & edge->v2->f2 & 4) {
+               if (edge->v1->f2 & edge->v2->f2 & 4) {
                        co[2]= 0.0f;
                }
        }
@@ -309,7 +311,7 @@ static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const subdparams *par
        temp.v1 = &ov1;
        temp.v2 = &ov2;
        
-       for(i=0;i<numcuts;i++) {
+       for (i=0;i<numcuts;i++) {
                v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params, 
                                     &newe, vsta, vend);
 
@@ -358,7 +360,8 @@ static void quad_1edge_split(BMesh *bm, BMFace *UNUSED(face),
                        connect_smallest_face(bm, verts[i], verts[numcuts+add], 
                                           &nf);
                }
-       } else {
+       }
+       else {
                add = 2;
                for (i=0; i<numcuts; i++) {
                        connect_smallest_face(bm, verts[i], verts[numcuts+add], 
@@ -802,7 +805,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
        if (singleedge) {
                patterns[0] = &quad_1edge;
                patterns[2] = &tri_1edge;
-       } else {
+       }
+       else {
                patterns[0] = NULL;
                patterns[2] = NULL;
        }
@@ -810,7 +814,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
        if (gridfill) {
                patterns[3] = &quad_4edge;
                patterns[5] = &tri_3edge;
-       } else {
+       }
+       else {
                patterns[3] = NULL;
                patterns[5] = NULL;
        }
@@ -1004,7 +1009,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
                        
                        if (BMO_TestFlag(bmesh, loops[(a+numcuts+1)%vlen]->v, ELE_INNER)) {
                                b = (a+numcuts+1)%vlen;
-                       } else {
+                       }
+                       else {
                                /*find the boundary of the other edge.*/
                                for (j=0; j<vlen; j++) {
                                        b = (j + a + numcuts + 1) % vlen;
@@ -1037,7 +1043,8 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
                        }
 
                        continue;
-               } else if (!pat) {
+               }
+               else if (!pat) {
                        continue;
                }
 
@@ -1112,10 +1119,11 @@ void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth
                // int i;
                
                ele = BMO_IterNew(&iter, bm, &op, "outinner", BM_EDGE|BM_VERT);
-               for (; ele; ele=BMO_IterStep(&iter)) {
+               for ( ; ele; ele=BMO_IterStep(&iter)) {
                        BM_Select(bm, ele, TRUE);
                }
-       } else if (seltype == SUBDIV_SELECT_LOOPCUT) {
+       }
+       else if (seltype == SUBDIV_SELECT_LOOPCUT) {
                BMOIter iter;
                BMHeader *ele;
                // int i;
@@ -1124,7 +1132,7 @@ void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth
                BM_clear_flag_all(bm, BM_SELECT);
 
                ele = BMO_IterNew(&iter, bm, &op, "outinner", BM_EDGE|BM_VERT);
-               for (; ele; ele=BMO_IterStep(&iter)) {
+               for ( ; ele; ele=BMO_IterStep(&iter)) {
                        BM_Select(bm, ele, TRUE);
 
                        if (ele->htype == BM_VERT) {
@@ -1136,7 +1144,8 @@ void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth
                                                                                                        && BM_TestHFlag(e->v2, BM_SELECT)) {
                                                BM_Select(bm, e, TRUE);
                                                bm->totedgesel += 1;
-                                       } else if (BM_TestHFlag(e, BM_SELECT) && (!BM_TestHFlag(e->v1, BM_SELECT) 
+                                       }
+                                       else if (BM_TestHFlag(e, BM_SELECT) && (!BM_TestHFlag(e->v1, BM_SELECT)
                                                                                                                  || !BM_TestHFlag(e->v2, BM_SELECT))) {
                                                BM_Select(bm, e, FALSE);
                                                bm->totedgesel -= 1;
index 5fb5ceddb63ace8093df44fcfe2ead9fbf5bd350..c1f31bcbd79af507fb3899efe3666bdbb71ad02d 100644 (file)
@@ -32,7 +32,7 @@ void triangulate_exec(BMesh *bm, BMOperator *op)
        int i, lastlen=0 /* , count = 0 */;
        
        face = BMO_IterNew(&siter, bm, op, "faces", BM_FACE);
-       for (; face; face=BMO_IterStep(&siter)) {
+       for ( ; face; face=BMO_IterStep(&siter)) {
                if (lastlen < face->len) {
                        BLI_array_empty(projectverts);
                        BLI_array_empty(newfaces);
index b4de92a30882dd902e033bb21c68274515792d61..b535fa1eb4b741879e64e031cda4ba56a68ed893 100644 (file)
@@ -154,7 +154,8 @@ static void bmesh_regionextend_extend(BMesh *bm, BMOperator *op, int usefaces)
                                }
                        }
                }
-       } else {
+       }
+       else {
                BMIter liter, fiter;
                BMFace *f, *f2;
                BMLoop *l;
@@ -192,7 +193,8 @@ static void bmesh_regionextend_constrict(BMesh *bm, BMOperator *op, int usefaces
                                }
                        }
                }
-       } else {
+       }
+       else {
                BMIter liter, fiter;
                BMFace *f, *f2;
                BMLoop *l;
@@ -331,7 +333,8 @@ void bmesh_righthandfaces_exec(BMesh *bm, BMOperator *op)
                                                BMO_ToggleFlag(bm, l2->f, FACE_FLIP);
                                                if (flagflip)
                                                        BM_ToggleHFlag(l2->f, BM_TMP_TAG);
-                                       } else if (BM_TestHFlag(l2->f, BM_TMP_TAG) || BM_TestHFlag(l->f, BM_TMP_TAG)) {
+                                       }
+                                       else if (BM_TestHFlag(l2->f, BM_TMP_TAG) || BM_TestHFlag(l->f, BM_TMP_TAG)) {
                                                if (flagflip) {
                                                        BM_ClearHFlag(l->f, BM_TMP_TAG);
                                                        BM_ClearHFlag(l2->f, BM_TMP_TAG);
@@ -429,10 +432,11 @@ static float ngon_perimeter(BMesh *bm, BMFace *f)
        float   perimeter = 0.0f;
 
        BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
-               if( num_verts == 0 ) {
+               if (num_verts == 0) {
                        copy_v3_v3(v, l->v->co);
                        copy_v3_v3(sv, l->v->co);
-               } else {
+               }
+               else {
                        perimeter += len_v3v3(v, l->v->co);
                        copy_v3_v3(v, l->v->co);
                }
@@ -462,11 +466,12 @@ static float ngon_fake_area(BMesh *bm, BMFace *f)
        BM_Compute_Face_CenterMean(bm, f, c);
 
        BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
-               if( num_verts == 0 ) {
+               if (num_verts == 0) {
                        copy_v3_v3(v, l->v->co);
                        copy_v3_v3(sv, l->v->co);
                        num_verts++;
-               } else {
+               }
+               else {
                        area += area_tri_v3(v, c, l->v->co);
                        copy_v3_v3(v, l->v->co);
                        num_verts++;
@@ -543,9 +548,9 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
        ** Save us some computation burden: In case of perimeter/area/coplanar selection we compute
        ** only once.
        */
-       if( type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE ) {
-               for( i = 0; i < num_total; i++ ) {
-                       switch( type ) {
+       if (type == SIMFACE_PERIMETER || type == SIMFACE_AREA || type == SIMFACE_COPLANAR || type == SIMFACE_IMAGE) {
+               for (i = 0; i < num_total; i++) {
+                       switch (type) {
                        case SIMFACE_PERIMETER:
                                /* set the perimeter */
                                f_ext[i].perim = ngon_perimeter(bm, f_ext[i].f);
@@ -569,7 +574,7 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
 
                        case SIMFACE_IMAGE:
                                f_ext[i].t = NULL;
-                               if( CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY) ) {
+                               if (CustomData_has_layer(&(bm->pdata), CD_MTEXPOLY)) {
                                        MTexPoly *mtpoly = CustomData_bmesh_get(&bm->pdata, f_ext[i].f->head.data, CD_MTEXPOLY);
                                        f_ext[i].t = mtpoly->tpage;
                                }
@@ -579,22 +584,22 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
        }
 
        /* now select the rest (if any) */
-       for( i = 0; i < num_total; i++ ) {
+       for (i = 0; i < num_total; i++) {
                fm = f_ext[i].f;
-               if( !BMO_TestFlag(bm, fm, FACE_MARK)  && !BM_TestHFlag(fm, BM_HIDDEN) ) {
+               if (!BMO_TestFlag(bm, fm, FACE_MARK)  && !BM_TestHFlag(fm, BM_HIDDEN)) {
                        int cont = 1;
-                       for( idx = 0; idx < num_sels && cont == 1; idx++ ) {
+                       for (idx = 0; idx < num_sels && cont == 1; idx++) {
                                fs = f_ext[indices[idx]].f;
-                               switch( type ) {
+                               switch (type) {
                                case SIMFACE_MATERIAL:
-                                       if( fm->mat_nr == fs->mat_nr ) {
+                                       if (fm->mat_nr == fs->mat_nr) {
                                                BMO_SetFlag(bm, fm, FACE_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMFACE_IMAGE:
-                                       if( f_ext[i].t == f_ext[indices[idx]].t ) {
+                                       if (f_ext[i].t == f_ext[indices[idx]].t) {
                                                BMO_SetFlag(bm, fm, FACE_MARK);
                                                cont = 0;
                                        }
@@ -602,7 +607,7 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
 
                                case SIMFACE_NORMAL:
                                        angle = RAD2DEGF(angle_v3v3(fs->no, fm->no));   /* if the angle between the normals -> 0 */
-                                       if( angle / 180.0f <= thresh ) {
+                                       if (angle / 180.0f <= thresh) {
                                                BMO_SetFlag(bm, fm, FACE_MARK);
                                                cont = 0;
                                        }
@@ -610,8 +615,8 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
 
                                case SIMFACE_COPLANAR:
                                        angle = RAD2DEGF(angle_v3v3(fs->no, fm->no)); /* angle -> 0 */
-                                       if( angle / 180.0f <= thresh ) { /* and dot product difference -> 0 */
-                                               if( fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh ) {
+                                       if (angle / 180.0f <= thresh) { /* and dot product difference -> 0 */
+                                               if (fabsf(f_ext[i].d - f_ext[indices[idx]].d) <= thresh) {
                                                        BMO_SetFlag(bm, fm, FACE_MARK);
                                                        cont = 0;
                                                }
@@ -619,14 +624,14 @@ void bmesh_similarfaces_exec(BMesh *bm, BMOperator *op)
                                        break;
 
                                case SIMFACE_AREA:
-                                       if( fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh ) {
+                                       if (fabsf(f_ext[i].area - f_ext[indices[idx]].area) <= thresh) {
                                                BMO_SetFlag(bm, fm, FACE_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMFACE_PERIMETER:
-                                       if( fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh ) {
+                                       if (fabsf(f_ext[i].perim - f_ext[indices[idx]].perim) <= thresh) {
                                                BMO_SetFlag(bm, fm, FACE_MARK);
                                                cont = 0;
                                        }
@@ -659,7 +664,7 @@ static float edge_angle(BMesh *bm, BMEdge *e)
        /* first edge faces, dont account for 3+ */
 
        BM_ITER(f, &fiter, bm, BM_FACES_OF_EDGE, e) {
-               if(f_prev == NULL) {
+               if (f_prev == NULL) {
                        f_prev= f;
                }
                else {
@@ -728,10 +733,9 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
        }
 
        /* save us some computation time by doing heavy computation once */
-       if( type == SIMEDGE_LENGTH || type == SIMEDGE_FACE || type == SIMEDGE_DIR ||
-               type == SIMEDGE_FACE_ANGLE ) {
-               for( i = 0; i < num_total; i++ ) {
-                       switch( type ) {
+       if (type == SIMEDGE_LENGTH || type == SIMEDGE_FACE || type == SIMEDGE_DIR || type == SIMEDGE_FACE_ANGLE) {
+               for (i = 0; i < num_total; i++) {
+                       switch (type) {
                        case SIMEDGE_LENGTH:    /* compute the length of the edge */
                                e_ext[i].length = len_v3v3(e_ext[i].e->v1->co, e_ext[i].e->v2->co);
                                break;
@@ -746,7 +750,7 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
 
                        case SIMEDGE_FACE_ANGLE:
                                e_ext[i].faces  = BM_Edge_FaceCount(e_ext[i].e);
-                               if( e_ext[i].faces == 2 )
+                               if (e_ext[i].faces == 2)
                                        e_ext[i].angle = edge_angle(bm, e_ext[i].e);
                                break;
                        }
@@ -754,15 +758,15 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
        }
 
        /* select the edges if any */
-       for( i = 0; i < num_total; i++ ) {
+       for (i = 0; i < num_total; i++) {
                e = e_ext[i].e;
-               if( !BMO_TestFlag(bm, e, EDGE_MARK) && !BM_TestHFlag(e, BM_HIDDEN) ) {
+               if (!BMO_TestFlag(bm, e, EDGE_MARK) && !BM_TestHFlag(e, BM_HIDDEN)) {
                        int cont = 1;
-                       for( idx = 0; idx < num_sels && cont == 1; idx++ ) {
+                       for (idx = 0; idx < num_sels && cont == 1; idx++) {
                                es = e_ext[indices[idx]].e;
-                               switch( type ) {
+                               switch (type) {
                                case SIMEDGE_LENGTH:
-                                       if( fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh ) {
+                                       if (fabsf(e_ext[i].length - e_ext[indices[idx]].length) <= thresh) {
                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                cont = 0;
                                        }
@@ -772,31 +776,34 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
                                        /* compute the angle between the two edges */
                                        angle = RAD2DEGF(angle_v3v3(e_ext[i].dir, e_ext[indices[idx]].dir));
 
-                                       if( angle > 90.0f ) /* use the smallest angle between the edges */
+                                       if (angle > 90.0f) /* use the smallest angle between the edges */
                                                angle = fabsf(angle - 180.0f);
 
-                                       if( angle / 90.0f <= thresh ) {
+                                       if (angle / 90.0f <= thresh) {
                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMEDGE_FACE:
-                                       if( e_ext[i].faces == e_ext[indices[idx]].faces ) {
+                                       if (e_ext[i].faces == e_ext[indices[idx]].faces) {
                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMEDGE_FACE_ANGLE:
-                                       if( e_ext[i].faces == 2 ) {
-                                               if( e_ext[indices[idx]].faces == 2 ) {
-                                                       if( fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh ) {
+                                       if (e_ext[i].faces == 2) {
+                                               if (e_ext[indices[idx]].faces == 2) {
+                                                       if (fabsf(e_ext[i].angle - e_ext[indices[idx]].angle) <= thresh) {
                                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                                cont = 0;
                                                        }
                                                }
-                                       } else cont = 0;
+                                       }
+                                       else {
+                                               cont = 0;
+                                       }
                                        break;
 
                                case SIMEDGE_CREASE:
@@ -806,7 +813,7 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
                                                c1 = CustomData_bmesh_get(&bm->edata, e->head.data, CD_CREASE);
                                                c2 = CustomData_bmesh_get(&bm->edata, es->head.data, CD_CREASE);
 
-                                               if( c1&&c2 && fabsf(*c1 - *c2) <= thresh ) {
+                                               if (c1 && c2 && fabsf(*c1 - *c2) <= thresh) {
                                                        BMO_SetFlag(bm, e, EDGE_MARK);
                                                        cont = 0;
                                                }
@@ -814,14 +821,14 @@ void bmesh_similaredges_exec(BMesh *bm, BMOperator *op)
                                        break;
 
                                case SIMEDGE_SEAM:
-                                       if( BM_TestHFlag(e, BM_SEAM) == BM_TestHFlag(es, BM_SEAM) ) {
+                                       if (BM_TestHFlag(e, BM_SEAM) == BM_TestHFlag(es, BM_SEAM)) {
                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMEDGE_SHARP:
-                                       if( BM_TestHFlag(e, BM_SHARP) == BM_TestHFlag(es, BM_SHARP) ) {
+                                       if (BM_TestHFlag(e, BM_SHARP) == BM_TestHFlag(es, BM_SHARP)) {
                                                BMO_SetFlag(bm, e, EDGE_MARK);
                                                cont = 0;
                                        }
@@ -887,16 +894,19 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op)
                        idx++;
                }
 
-               switch( type ) {
+               switch (type) {
                case SIMVERT_FACE:
                        /* calling BM_Vert_FaceCount every time is time consumming, so call it only once per vertex */
                        v_ext[i].num_faces      = BM_Vert_FaceCount(v);
                        break;
 
                case SIMVERT_VGROUP:
-                       if( CustomData_has_layer(&(bm->vdata),CD_MDEFORMVERT) ) {
+                       if (CustomData_has_layer(&(bm->vdata),CD_MDEFORMVERT)) {
                                v_ext[i].dvert = CustomData_bmesh_get(&bm->vdata, v_ext[i].v->head.data, CD_MDEFORMVERT);
-                       } else v_ext[i].dvert = NULL;
+                       }
+                       else {
+                               v_ext[i].dvert = NULL;
+                       }
                        break;
                }
 
@@ -904,34 +914,34 @@ void bmesh_similarverts_exec(BMesh *bm, BMOperator *op)
        }
 
        /* select the vertices if any */
-       for( i = 0; i < num_total; i++ ) {
+       for (i = 0; i < num_total; i++) {
                v = v_ext[i].v;
-               if( !BMO_TestFlag(bm, v, VERT_MARK) && !BM_TestHFlag(v, BM_HIDDEN) ) {
+               if (!BMO_TestFlag(bm, v, VERT_MARK) && !BM_TestHFlag(v, BM_HIDDEN)) {
                        int cont = 1;
-                       for( idx = 0; idx < num_sels && cont == 1; idx++ ) {
+                       for (idx = 0; idx < num_sels && cont == 1; idx++) {
                                vs = v_ext[indices[idx]].v;
-                               switch( type ) {
+                               switch (type) {
                                case SIMVERT_NORMAL:
                                        /* compare the angle between the normals */
-                                       if( RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh ) {
+                                       if (RAD2DEGF(angle_v3v3(v->no, vs->no)) / 180.0f <= thresh) {
                                                BMO_SetFlag(bm, v, VERT_MARK);
                                                cont = 0;
                                        }
                                        break;
                                case SIMVERT_FACE:
                                        /* number of adjacent faces */
-                                       if( v_ext[i].num_faces == v_ext[indices[idx]].num_faces ) {
+                                       if (v_ext[i].num_faces == v_ext[indices[idx]].num_faces) {
                                                BMO_SetFlag(bm, v, VERT_MARK);
                                                cont = 0;
                                        }
                                        break;
 
                                case SIMVERT_VGROUP:
-                                       if( v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL ) {
+                                       if (v_ext[i].dvert != NULL && v_ext[indices[idx]].dvert != NULL) {
                                                int v1, v2;
-                                               for( v1 = 0; v1 < v_ext[i].dvert->totweight && cont == 1; v1++ ) {
-                                                       for( v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++ ) {
-                                                               if( v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr ) {
+                                               for (v1 = 0; v1 < v_ext[i].dvert->totweight && cont == 1; v1++) {
+                                                       for (v2 = 0; v2 < v_ext[indices[idx]].dvert->totweight; v2++) {
+                                                               if (v_ext[i].dvert->dw[v1].def_nr == v_ext[indices[idx]].dvert->dw[v2].def_nr) {
                                                                        BMO_SetFlag(bm, v, VERT_MARK);
                                                                        cont = 0;
                                                                        break;
@@ -965,8 +975,8 @@ void bmesh_rotateuvs_exec(BMesh *bm, BMOperator *op)
        int dir = BMO_Get_Int(op, "dir");
 
        BMO_ITER(fs, &fs_iter, bm, op, "faces", BM_FACE) {
-               if( CustomData_has_layer(&(bm->ldata), CD_MLOOPUV) ) {
-                       if( dir == DIRECTION_CW ) { /* same loops direction */
+               if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
+                       if (dir == DIRECTION_CW) { /* same loops direction */
                                BMLoop *lf;     /* current face loops */
                                MLoopUV *f_luv; /* first face loop uv */
                                float p_uv[2];  /* previous uvs */
@@ -976,24 +986,21 @@ void bmesh_rotateuvs_exec(BMesh *bm, BMOperator *op)
                                BM_ITER(lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) {
                                        /* current loop uv is the previous loop uv */
                                        MLoopUV *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
-                                       if( n == 0 ) {
+                                       if (n == 0) {
                                                f_luv = luv;
-                                               p_uv[0] = luv->uv[0];
-                                               p_uv[1] = luv->uv[1];
-                                       } else {
-                                               t_uv[0] = luv->uv[0];
-                                               t_uv[1] = luv->uv[1];
-                                               luv->uv[0] = p_uv[0];
-                                               luv->uv[1] = p_uv[1];
-                                               p_uv[0] = t_uv[0];
-                                               p_uv[1] = t_uv[1];
+                                               copy_v2_v2(p_uv, luv->uv);
+                                       }
+                                       else {
+                                               copy_v2_v2(t_uv, luv->uv);
+                                               copy_v2_v2(luv->uv, p_uv);
+                                               copy_v2_v2(p_uv, t_uv);
                                        }
                                        n++;
                                }
 
-                               f_luv->uv[0] = p_uv[0];
-                               f_luv->uv[1] = p_uv[1];
-                       } else if( dir == DIRECTION_CCW ) { /* counter loop direction */
+                               copy_v2_v2(f_luv->uv, p_uv);
+                       }
+                       else if (dir == DIRECTION_CCW) { /* counter loop direction */
                                BMLoop *lf;     /* current face loops */
                                MLoopUV *p_luv; /*previous loop uv */
                                MLoopUV *luv;
@@ -1003,20 +1010,18 @@ void bmesh_rotateuvs_exec(BMesh *bm, BMOperator *op)
                                BM_ITER(lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) {
                                        /* previous loop uv is the current loop uv */
                                        luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPUV);
-                                       if( n == 0 ) {
+                                       if (n == 0) {
                                                p_luv = luv;
-                                               t_uv[0] = luv->uv[0];
-                                               t_uv[1] = luv->uv[1];
-                                       } else {
-                                               p_luv->uv[0] = luv->uv[0];
-                                               p_luv->uv[1] = luv->uv[1];
+                                               copy_v2_v2(t_uv, luv->uv);
+                                       }
+                                       else {
+                                               copy_v2_v2(p_luv->uv, luv->uv);
                                                p_luv = luv;
                                        }
                                        n++;
                                }
 
-                               luv->uv[0] = t_uv[0];
-                               luv->uv[1] = t_uv[1];
+                               copy_v2_v2(luv->uv, t_uv);
                        }
                }
        }
@@ -1036,7 +1041,7 @@ void bmesh_reverseuvs_exec(BMesh *bm, BMOperator *op)
        float (*uvs)[2] = NULL;
 
        BMO_ITER(fs, &fs_iter, bm, op, "faces", BM_FACE) {
-               if( CustomData_has_layer(&(bm->ldata), CD_MLOOPUV) ) {
+               if (CustomData_has_layer(&(bm->ldata), CD_MLOOPUV)) {
                        BMLoop *lf;     /* current face loops */
                        int i = 0;
 
@@ -1080,8 +1085,8 @@ void bmesh_rotatecolors_exec(BMesh *bm, BMOperator *op)
        int dir = BMO_Get_Int(op, "dir");
 
        BMO_ITER(fs, &fs_iter, bm, op, "faces", BM_FACE) {
-               if( CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL) ) {
-                       if( dir == DIRECTION_CW ) { /* same loops direction */
+               if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
+                       if (dir == DIRECTION_CW) { /* same loops direction */
                                BMLoop *lf;     /* current face loops */
                                MLoopCol *f_lcol; /* first face loop color */
                                MLoopCol p_col; /* previous color */
@@ -1091,10 +1096,11 @@ void bmesh_rotatecolors_exec(BMesh *bm, BMOperator *op)
                                BM_ITER(lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) {
                                        /* current loop color is the previous loop color */
                                        MLoopCol *luv = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL);
-                                       if( n == 0 ) {
+                                       if (n == 0) {
                                                f_lcol = luv;
                                                p_col = *luv;
-                                       } else {
+                                       }
+                                       else {
                                                t_col = *luv;
                                                *luv = p_col;
                                                p_col = t_col;
@@ -1103,7 +1109,8 @@ void bmesh_rotatecolors_exec(BMesh *bm, BMOperator *op)
                                }
 
                                *f_lcol = p_col;
-                       } else if( dir == DIRECTION_CCW ) { /* counter loop direction */
+                       }
+                       else if (dir == DIRECTION_CCW) { /* counter loop direction */
                                BMLoop *lf;     /* current face loops */
                                MLoopCol *p_lcol; /*previous loop color */
                                MLoopCol *lcol;
@@ -1113,10 +1120,11 @@ void bmesh_rotatecolors_exec(BMesh *bm, BMOperator *op)
                                BM_ITER(lf, &l_iter, bm, BM_LOOPS_OF_FACE, fs) {
                                        /* previous loop color is the current loop color */
                                        lcol = CustomData_bmesh_get(&bm->ldata, lf->head.data, CD_MLOOPCOL);
-                                       if( n == 0 ) {
+                                       if (n == 0) {
                                                p_lcol = lcol;
                                                t_col = *lcol;
-                                       } else {
+                                       }
+                                       else {
                                                *p_lcol = *lcol;
                                                p_lcol = lcol;
                                        }
@@ -1142,7 +1150,7 @@ void bmesh_reversecolors_exec(BMesh *bm, BMOperator *op)
        MLoopCol *cols = NULL;
 
        BMO_ITER(fs, &fs_iter, bm, op, "faces", BM_FACE) {
-               if( CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL) ) {
+               if (CustomData_has_layer(&(bm->ldata), CD_MLOOPCOL)) {
                        BMLoop *lf;     /* current face loops */
                        int i = 0;
 
@@ -1226,10 +1234,10 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
 
        h = BLI_heap_new();
 
-       fori = 0; i < num_total; i++ )
+       for (i = 0; i < num_total; i++ )
                vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
 
-       while( !BLI_heap_empty(h) ) {
+       while (!BLI_heap_empty(h)) {
                BMEdge *e;
                BMIter e_i;
                float v_weight;
@@ -1237,7 +1245,7 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
                /* take the vertex with the lowest weight out of the heap */
                BMVert *v = (BMVert*)BLI_heap_popmin(h);
 
-               if( vert_list[BM_GetIndex(v)].weight == FLT_MAX ) /* this means that there is no path */
+               if (vert_list[BM_GetIndex(v)].weight == FLT_MAX) /* this means that there is no path */
                        break;
 
                v_weight = vert_list[BM_GetIndex(v)].weight;
@@ -1246,13 +1254,13 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
                        BMVert *u;
                        float e_weight = v_weight;
 
-                       if( type == VPATH_SELECT_EDGE_LENGTH )
+                       if (type == VPATH_SELECT_EDGE_LENGTH)
                                e_weight += len_v3v3(e->v1->co, e->v2->co);
                        else e_weight += 1.0f;
 
                        u = ( e->v1 == v ) ? e->v2 : e->v1;
 
-                       if( e_weight < vert_list[BM_GetIndex(u)].weight ) { /* is this path shorter ? */
+                       if (e_weight < vert_list[BM_GetIndex(u)].weight) { /* is this path shorter ? */
                                /* add it if so */
                                vert_list[BM_GetIndex(u)].parent = v;
                                vert_list[BM_GetIndex(u)].weight = e_weight;
@@ -1267,7 +1275,7 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
        /* now we trace the path (if it exists) */
        v = ev;
 
-       while( vert_list[BM_GetIndex(v)].parent != NULL ) {
+       while (vert_list[BM_GetIndex(v)].parent != NULL) {
                BMO_SetFlag(bm, v, VERT_MARK);
                v = vert_list[BM_GetIndex(v)].parent;
        }
index 97e4132482dc1b505820e1d7c1321ac8b825f369..1f0eef78e32902ca262099e9cbf52f54ea9c9853 100644 (file)
@@ -98,7 +98,7 @@ BMEditMesh_mods.c, UI level access, no geometry changes
 
 static void EDBM_select_mirrored(Object *obedit, BMEditMesh *em)
 {
-       if(em->selectmode & SCE_SELECT_VERTEX) {
+       if (em->selectmode & SCE_SELECT_VERTEX) {
                BMVert *eve, *v1;
                BMIter iter;
                int i;
@@ -107,7 +107,7 @@ static void EDBM_select_mirrored(Object *obedit, BMEditMesh *em)
                BM_ITER(eve, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
                        if (BM_TestHFlag(eve, BM_SELECT) && !BM_TestHFlag(eve, BM_HIDDEN)) {
                                v1= editbmesh_get_x_mirror_vert(obedit, em, eve, eve->co, i);
-                               if(v1) {
+                               if (v1) {
                                        BM_Select(em->bm, eve, FALSE);
                                        BM_Select(em->bm, v1, TRUE);
                                }
@@ -168,7 +168,7 @@ static void draw_triangulated(int mcords[][2], short tot)
 
        /* do the draw */
        dl= lb.first;   /* filldisplist adds in head of list */
-       if(dl->type==DL_INDEX3) {
+       if (dl->type==DL_INDEX3) {
                int *index;
                
                a= dl->parts;
@@ -196,11 +196,11 @@ int EDBM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax
        unsigned int *dr;
        int a;
        
-       if(vc->obedit==NULL || vc->v3d->drawtype<OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT)==0) return 0;
+       if (vc->obedit==NULL || vc->v3d->d