code cleanup:
authorCampbell Barton <ideasman42@gmail.com>
Sun, 13 May 2012 14:47:53 +0000 (14:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 13 May 2012 14:47:53 +0000 (14:47 +0000)
- use bmesh iterator macros in more places
- rename scanfill variables (were using same names as mesh faces/verts which was confusing)

source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/blenkernel/intern/key.c
source/blender/blenkernel/intern/mesh.c
source/blender/blenlib/intern/scanfill.c
source/blender/bmesh/operators/bmo_triangulate.c
source/blender/editors/mesh/editmesh_knife.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/windowmanager/intern/wm_gesture.c

index 17c6585..9b172b5 100644 (file)
@@ -425,8 +425,8 @@ static void curve_to_displist(Curve *cu, ListBase *nubase, ListBase *dispbase, i
 void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
 {
        ScanFillContext sf_ctx;
-       ScanFillVert *eve, *v1, *vlast;
-       ScanFillFace *efa;
+       ScanFillVert *sf_vert, *sf_vert_new, *sf_vert_last;
+       ScanFillFace *sf_tri;
        DispList *dlnew = NULL, *dl;
        float *f1;
        int colnr = 0, charidx = 0, cont = 1, tot, a, *index, nextcol = 0;
@@ -454,24 +454,24 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
                                                /* make editverts and edges */
                                                f1 = dl->verts;
                                                a = dl->nr;
-                                               eve = v1 = NULL;
+                                               sf_vert = sf_vert_new = NULL;
 
                                                while (a--) {
-                                                       vlast = eve;
+                                                       sf_vert_last = sf_vert;
 
-                                                       eve = BLI_scanfill_vert_add(&sf_ctx, f1);
+                                                       sf_vert = BLI_scanfill_vert_add(&sf_ctx, f1);
                                                        totvert++;
 
-                                                       if (vlast == NULL)
-                                                               v1 = eve;
+                                                       if (sf_vert_last == NULL)
+                                                               sf_vert_new = sf_vert;
                                                        else {
-                                                               BLI_scanfill_edge_add(&sf_ctx, vlast, eve);
+                                                               BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
                                                        }
                                                        f1 += 3;
                                                }
 
-                                               if (eve != NULL && v1 != NULL) {
-                                                       BLI_scanfill_edge_add(&sf_ctx, eve, v1);
+                                               if (sf_vert != NULL && sf_vert_new != NULL) {
+                                                       BLI_scanfill_edge_add(&sf_ctx, sf_vert, sf_vert_new);
                                                }
                                        }
                                        else if (colnr < dl->col) {
@@ -499,31 +499,31 @@ void BKE_displist_fill(ListBase *dispbase, ListBase *to, int flipnormal)
                                /* vert data */
                                f1 = dlnew->verts;
                                totvert = 0;
-                               eve = sf_ctx.fillvertbase.first;
-                               while (eve) {
-                                       copy_v3_v3(f1, eve->co);
+                               sf_vert = sf_ctx.fillvertbase.first;
+                               while (sf_vert) {
+                                       copy_v3_v3(f1, sf_vert->co);
                                        f1 += 3;
 
                                        /* index number */
-                                       eve->tmp.l = totvert;
+                                       sf_vert->tmp.l = totvert;
                                        totvert++;
 
-                                       eve = eve->next;
+                                       sf_vert = sf_vert->next;
                                }
 
                                /* index data */
-                               efa = sf_ctx.fillfacebase.first;
+                               sf_tri = sf_ctx.fillfacebase.first;
                                index = dlnew->index;
-                               while (efa) {
-                                       index[0] = (intptr_t)efa->v1->tmp.l;
-                                       index[1] = (intptr_t)efa->v2->tmp.l;
-                                       index[2] = (intptr_t)efa->v3->tmp.l;
+                               while (sf_tri) {
+                                       index[0] = (intptr_t)sf_tri->v1->tmp.l;
+                                       index[1] = (intptr_t)sf_tri->v2->tmp.l;
+                                       index[2] = (intptr_t)sf_tri->v3->tmp.l;
 
                                        if (flipnormal)
                                                SWAP(int, index[0], index[2]);
 
                                        index += 3;
-                                       efa = efa->next;
+                                       sf_tri = sf_tri->next;
                                }
                        }
 
index 585e0e1..024a1ec 100644 (file)
@@ -116,7 +116,7 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
        BMLoop *(*looptris)[3] = NULL;
        BLI_array_declare(looptris);
        BMIter iter, liter;
-       BMFace *f;
+       BMFace *efa;
        BMLoop *l;
        int i = 0, j;
 
@@ -150,9 +150,9 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
 
 #endif
 
-       BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
+       BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
                /*don't consider two-edged faces*/
-               if (f->len < 3) {
+               if (efa->len < 3) {
                        /* do nothing */
                }
 
@@ -160,20 +160,18 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
 
                /* no need to ensure the loop order, we know its ok */
 
-               else if (f->len == 3) {
+               else if (efa->len == 3) {
                        BLI_array_grow_one(looptris);
-                       l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
-                       for (j = 0; l; l = BM_iter_step(&liter), j++) {
+                       BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, j) {
                                looptris[i][j] = l;
                        }
                        i += 1;
                }
-               else if (f->len == 4) {
+               else if (efa->len == 4) {
                        BMLoop *ltmp[4];
                        BLI_array_grow_items(looptris, 2);
 
-                       l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
-                       for (j = 0; l; l = BM_iter_step(&liter), j++) {
+                       BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, j) {
                                ltmp[j] = l;
                        }
 
@@ -191,39 +189,39 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *tm)
 #endif /* USE_TESSFACE_SPEEDUP */
 
                else {
-                       ScanFillVert *v, *lastv = NULL, *firstv = NULL;
+                       ScanFillVert *sf_vert, *sf_vert_last = NULL, *sf_vert_first = NULL;
                        /* ScanFillEdge *e; */ /* UNUSED */
-                       ScanFillFace *efa;
+                       ScanFillFace *sf_tri;
                        int totfilltri;
 
                        BLI_scanfill_begin(&sf_ctx);
-                       /*scanfill time*/
-                       l = BM_iter_new(&liter, bm, BM_LOOPS_OF_FACE, f);
-                       for (j = 0; l; l = BM_iter_step(&liter), j++) {
+
+                       /* scanfill time */
+                       BM_ITER_ELEM_INDEX (l, &liter, efa, BM_LOOPS_OF_FACE, j) {
                                /*mark order*/
                                BM_elem_index_set(l, j); /* set_loop */
 
-                               v = BLI_scanfill_vert_add(&sf_ctx, l->v->co);
-                               v->tmp.p = l;
+                               sf_vert = BLI_scanfill_vert_add(&sf_ctx, l->v->co);
+                               sf_vert->tmp.p = l;
 
-                               if (lastv) {
-                                       /* e = */ BLI_scanfill_edge_add(&sf_ctx, lastv, v);
+                               if (sf_vert_last) {
+                                       /* e = */ BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
                                }
 
-                               lastv = v;
-                               if (firstv == NULL) firstv = v;
+                               sf_vert_last = sf_vert;
+                               if (sf_vert_first == NULL) sf_vert_first = sf_vert;
                        }
 
-                       /*complete the loop*/
-                       BLI_scanfill_edge_add(&sf_ctx, firstv, v);
+                       /* complete the loop */
+                       BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
 
-                       totfilltri = BLI_scanfill_calc_ex(&sf_ctx, FALSE, f->no);
+                       totfilltri = BLI_scanfill_calc_ex(&sf_ctx, FALSE, efa->no);
                        BLI_array_grow_items(looptris, totfilltri);
 
-                       for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
-                               BMLoop *l1 = efa->v1->tmp.p;
-                               BMLoop *l2 = efa->v2->tmp.p;
-                               BMLoop *l3 = efa->v3->tmp.p;
+                       for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+                               BMLoop *l1 = sf_tri->v1->tmp.p;
+                               BMLoop *l2 = sf_tri->v2->tmp.p;
+                               BMLoop *l3 = sf_tri->v3->tmp.p;
 
                                if (BM_elem_index_get(l1) > BM_elem_index_get(l2)) { SWAP(BMLoop *, l1, l2); }
                                if (BM_elem_index_get(l2) > BM_elem_index_get(l3)) { SWAP(BMLoop *, l2, l3); }
@@ -384,16 +382,16 @@ static void emDM_foreachMappedEdge(DerivedMesh *dm,
 
                BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
 
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter))
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        func(userData, i,
                             bmdm->vertexCos[BM_elem_index_get(eed->v1)],
                             bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
+               }
        }
        else {
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter))
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        func(userData, i, eed->v1->co, eed->v2->co);
+               }
        }
 }
 
@@ -411,8 +409,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm,
                BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
 
                glBegin(GL_LINES);
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter)) {
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
                                glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
                                glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v2)]);
@@ -422,8 +419,7 @@ static void emDM_drawMappedEdges(DerivedMesh *dm,
        }
        else {
                glBegin(GL_LINES);
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter)) {
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
                                glVertex3fv(eed->v1->co);
                                glVertex3fv(eed->v2->co);
@@ -454,8 +450,7 @@ static void emDM_drawMappedEdgesInterp(DerivedMesh *dm,
                BM_mesh_elem_index_ensure(bmdm->tc->bm, BM_VERT);
 
                glBegin(GL_LINES);
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter)) {
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
                                setDrawInterpOptions(userData, i, 0.0);
                                glVertex3fv(bmdm->vertexCos[BM_elem_index_get(eed->v1)]);
@@ -467,8 +462,7 @@ static void emDM_drawMappedEdgesInterp(DerivedMesh *dm,
        }
        else {
                glBegin(GL_LINES);
-               eed = BM_iter_new(&iter, bmdm->tc->bm, BM_EDGES_OF_MESH, NULL);
-               for (i = 0; eed; i++, eed = BM_iter_step(&iter)) {
+               BM_ITER_MESH_INDEX (eed, &iter, bmdm->tc->bm, BM_EDGES_OF_MESH, i) {
                        if (!setDrawOptions || (setDrawOptions(userData, i) != DM_DRAW_OPTION_SKIP)) {
                                setDrawInterpOptions(userData, i, 0.0);
                                glVertex3fv(eed->v1->co);
@@ -518,9 +512,9 @@ static void emDM_drawUVEdges(DerivedMesh *dm)
        glEnd();
 }
 
-static void emDM__calcFaceCent(BMesh *bm, BMFace *efa, float cent[3], float (*vertexCos)[3])
+static void emDM__calcFaceCent(BMFace *efa, float cent[3], float (*vertexCos)[3])
 {
-       BMIter iter;
+       BMIter liter;
        BMLoop *l;
        int tot = 0;
 
@@ -529,15 +523,13 @@ static void emDM__calcFaceCent(BMesh *bm, BMFace *efa, float cent[3], float (*ve
        /*simple (and stupid) median (average) based method :/ */
 
        if (vertexCos) {
-               l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, efa);
-               for (; l; l = BM_iter_step(&iter)) {
+               BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        add_v3_v3(cent, vertexCos[BM_elem_index_get(l->v)]);
                        tot++;
                }
        }
        else {
-               l = BM_iter_new(&iter, bm, BM_LOOPS_OF_FACE, efa);
-               for (; l; l = BM_iter_step(&iter)) {
+               BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        add_v3_v3(cent, l->v->co);
                        tot++;
                }
@@ -567,7 +559,7 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm,
        }
 
        BM_ITER_MESH_INDEX (efa, &iter, bmdm->tc->bm, BM_FACES_OF_MESH, i) {
-               emDM__calcFaceCent(bmdm->tc->bm, efa, cent, bmdm->vertexCos);
+               emDM__calcFaceCent(efa, cent, bmdm->vertexCos);
                func(userData, i, cent, polyNos ? polyNos[i] : efa->no);
        }
 }
@@ -1369,23 +1361,34 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
 {
        EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
        BMesh *bm = bmdm->tc->bm;
-       BMVert *ev;
+       BMVert *eve;
        BMIter iter;
-       int i;
+       const int has_bweight = CustomData_has_layer(&bm->vdata, CD_BWEIGHT);
 
-       ev = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, NULL);
-       for (i = 0; ev; ev = BM_iter_step(&iter), ++vert_r, ++i) {
-               if (bmdm->vertexCos)
-                       copy_v3_v3(vert_r->co, bmdm->vertexCos[i]);
-               else
-                       copy_v3_v3(vert_r->co, ev->co);
+       if (bmdm->vertexCos) {
+               int i;
 
-               normal_float_to_short_v3(vert_r->no, ev->no);
+               BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
+                       copy_v3_v3(vert_r->co, bmdm->vertexCos[i]);
+                       normal_float_to_short_v3(vert_r->no, eve->no);
+                       vert_r->flag = BM_vert_flag_to_mflag(eve);
 
-               vert_r->flag = BM_vert_flag_to_mflag(ev);
+                       if (has_bweight) {
+                               vert_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->vdata, eve, CD_BWEIGHT) * 255.0f);
+                       }
+                       vert_r++;
+               }
+       }
+       else {
+               BM_ITER_MESH (eve, &iter, bm, BM_VERTS_OF_MESH) {
+                       copy_v3_v3(vert_r->co, eve->co);
+                       normal_float_to_short_v3(vert_r->no, eve->no);
+                       vert_r->flag = BM_vert_flag_to_mflag(eve);
 
-               if (CustomData_has_layer(&bm->vdata, CD_BWEIGHT)) {
-                       vert_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->vdata, ev, CD_BWEIGHT) * 255.0f);
+                       if (has_bweight) {
+                               vert_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->vdata, eve, CD_BWEIGHT) * 255.0f);
+                       }
+                       vert_r++;
                }
        }
 }
@@ -1393,26 +1396,28 @@ static void emDM_copyVertArray(DerivedMesh *dm, MVert *vert_r)
 static void emDM_copyEdgeArray(DerivedMesh *dm, MEdge *edge_r)
 {
        BMesh *bm = ((EditDerivedBMesh *)dm)->tc->bm;
-       BMEdge *ee;
+       BMEdge *eed;
        BMIter iter;
-       int has_bweight = CustomData_has_layer(&bm->edata, CD_BWEIGHT);
-       int has_crease = CustomData_has_layer(&bm->edata, CD_CREASE);
+       const int has_bweight = CustomData_has_layer(&bm->edata, CD_BWEIGHT);
+       const int has_crease = CustomData_has_layer(&bm->edata, CD_CREASE);
 
        BM_mesh_elem_index_ensure(bm, BM_VERT);
 
-       for (ee = BM_iter_new(&iter, bm, BM_EDGES_OF_MESH, NULL); ee; ee = BM_iter_step(&iter), edge_r++) {
+       BM_ITER_MESH (eed, &iter, bm, BM_EDGES_OF_MESH) {
                if (has_bweight) {
-                       edge_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->edata, ee, CD_BWEIGHT) * 255.0f);
+                       edge_r->bweight = (unsigned char) (BM_elem_float_data_get(&bm->edata, eed, CD_BWEIGHT) * 255.0f);
                }
 
                if (has_crease) {
-                       edge_r->crease = (unsigned char) (BM_elem_float_data_get(&bm->edata, ee, CD_CREASE) * 255.0f);
+                       edge_r->crease = (unsigned char) (BM_elem_float_data_get(&bm->edata, eed, CD_CREASE) * 255.0f);
                }
 
-               edge_r->flag = BM_edge_flag_to_mflag(ee);
+               edge_r->flag = BM_edge_flag_to_mflag(eed);
+
+               edge_r->v1 = BM_elem_index_get(eed->v1);
+               edge_r->v2 = BM_elem_index_get(eed->v2);
 
-               edge_r->v1 = BM_elem_index_get(ee->v1);
-               edge_r->v2 = BM_elem_index_get(ee->v2);
+               edge_r++;
        }
 }
 
@@ -1443,19 +1448,18 @@ static void emDM_copyTessFaceArray(DerivedMesh *dm, MFace *face_r)
        }
 }
 
-
 static void emDM_copyLoopArray(DerivedMesh *dm, MLoop *loop_r)
 {
        EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
        BMesh *bm = bmdm->tc->bm;
        BMIter iter, liter;
-       BMFace *f;
+       BMFace *efa;
        BMLoop *l;
 
        BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE);
 
-       BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
-               BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+       BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+               BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                        loop_r->v = BM_elem_index_get(l->v);
                        loop_r->e = BM_elem_index_get(l->e);
                        loop_r++;
@@ -1468,18 +1472,18 @@ static void emDM_copyPolyArray(DerivedMesh *dm, MPoly *poly_r)
        EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
        BMesh *bm = bmdm->tc->bm;
        BMIter iter;
-       BMFace *f;
+       BMFace *efa;
        int i;
 
        i = 0;
-       BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
-               poly_r->flag = BM_face_flag_to_mflag(f);
+       BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) {
+               poly_r->flag = BM_face_flag_to_mflag(efa);
                poly_r->loopstart = i;
-               poly_r->totloop = f->len;
-               poly_r->mat_nr = f->mat_nr;
+               poly_r->totloop = efa->len;
+               poly_r->mat_nr = efa->mat_nr;
 
                poly_r++;
-               i += f->len;
+               i += efa->len;
        }
 }
 
index e36e7bf..f4ec223 100644 (file)
@@ -1055,8 +1055,7 @@ static float *get_weights_array(Object *ob, char *vgroup)
                weights = MEM_callocN(totvert * sizeof(float), "weights");
 
                if (em) {
-                       eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL);
-                       for (i = 0; eve; eve = BM_iter_step(&iter), i++) {
+                       BM_ITER_MESH_INDEX (eve, &iter, em->bm, BM_VERTS_OF_MESH, i) {
                                dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
 
                                if (dvert) {
index 537c64a..d478302 100644 (file)
@@ -2391,8 +2391,8 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
        MFace *mface = NULL, *mf;
        BLI_array_declare(mface);
        ScanFillContext sf_ctx;
-       ScanFillVert *v, *lastv, *firstv;
-       ScanFillFace *f;
+       ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first;
+       ScanFillFace *sf_tri;
        int *mface_orig_index = NULL;
        BLI_array_declare(mface_orig_index);
        int *mface_to_poly_map = NULL;
@@ -2485,21 +2485,21 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
                        ml = mloop + mp->loopstart;
                        
                        BLI_scanfill_begin(&sf_ctx);
-                       firstv = NULL;
-                       lastv = NULL;
+                       sf_vert_first = NULL;
+                       sf_vert_last = NULL;
                        for (j = 0; j < mp->totloop; j++, ml++) {
-                               v = BLI_scanfill_vert_add(&sf_ctx, mvert[ml->v].co);
+                               sf_vert = BLI_scanfill_vert_add(&sf_ctx, mvert[ml->v].co);
        
-                               v->keyindex = mp->loopstart + j;
+                               sf_vert->keyindex = mp->loopstart + j;
        
-                               if (lastv)
-                                       BLI_scanfill_edge_add(&sf_ctx, lastv, v);
+                               if (sf_vert_last)
+                                       BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
        
-                               if (!firstv)
-                                       firstv = v;
-                               lastv = v;
+                               if (!sf_vert_first)
+                                       sf_vert_first = sf_vert;
+                               sf_vert_last = sf_vert;
                        }
-                       BLI_scanfill_edge_add(&sf_ctx, lastv, firstv);
+                       BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert_first);
                        
                        totfilltri = BLI_scanfill_calc(&sf_ctx, FALSE);
                        if (totfilltri) {
@@ -2509,14 +2509,14 @@ int BKE_mesh_recalc_tessellation(CustomData *fdata,
                                        BLI_array_grow_items(mface_orig_index, totfilltri);
                                }
 
-                               for (f = sf_ctx.fillfacebase.first; f; f = f->next, mf++) {
+                               for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next, mf++) {
                                        mface_to_poly_map[mface_index] = poly_index;
                                        mf = &mface[mface_index];
 
                                        /* set loop indices, transformed to vert indices later */
-                                       mf->v1 = f->v1->keyindex;
-                                       mf->v2 = f->v2->keyindex;
-                                       mf->v3 = f->v3->keyindex;
+                                       mf->v1 = sf_tri->v1->keyindex;
+                                       mf->v2 = sf_tri->v2->keyindex;
+                                       mf->v3 = sf_tri->v3->keyindex;
                                        mf->v4 = 0;
 
                                        mf->mat_nr = mp->mat_nr;
index 71eb0ec..9475296 100644 (file)
@@ -86,8 +86,8 @@ typedef struct PolyFill {
 } PolyFill;
 
 typedef struct ScanFillVertLink {
-       ScanFillVert *v1;
-       ScanFillEdge *first, *last;
+       ScanFillVert *vert;
+       ScanFillEdge *edge_first, *edge_last;
 } ScanFillVertLink;
 
 
@@ -112,10 +112,10 @@ static int vergscdata(const void *a1, const void *a2)
 {
        const ScanFillVertLink *x1 = a1, *x2 = a2;
        
-       if      (x1->v1->xy[1] < x2->v1->xy[1]) return  1;
-       else if (x1->v1->xy[1] > x2->v1->xy[1]) return -1;
-       else if (x1->v1->xy[0] > x2->v1->xy[0]) return  1;
-       else if (x1->v1->xy[0] < x2->v1->xy[0]) return -1;
+       if      (x1->vert->xy[1] < x2->vert->xy[1]) return  1;
+       else if (x1->vert->xy[1] > x2->vert->xy[1]) return -1;
+       else if (x1->vert->xy[0] > x2->vert->xy[0]) return  1;
+       else if (x1->vert->xy[0] < x2->vert->xy[0]) return -1;
 
        return 0;
 }
@@ -230,14 +230,14 @@ ScanFillEdge *BLI_scanfill_edge_add(ScanFillContext *sf_ctx, ScanFillVert *v1, S
 static void addfillface(ScanFillContext *sf_ctx, ScanFillVert *v1, ScanFillVert *v2, ScanFillVert *v3)
 {
        /* does not make edges */
-       ScanFillFace *evl;
+       ScanFillFace *sf_tri;
 
-       evl = mem_element_new(sf_ctx, sizeof(ScanFillFace));
-       BLI_addtail(&sf_ctx->fillfacebase, evl);
+       sf_tri = mem_element_new(sf_ctx, sizeof(ScanFillFace));
+       BLI_addtail(&sf_ctx->fillfacebase, sf_tri);
        
-       evl->v1 = v1;
-       evl->v2 = v2;
-       evl->v3 = v3;
+       sf_tri->v1 = v1;
+       sf_tri->v2 = v2;
+       sf_tri->v3 = v3;
 }
 
 static int boundisect(PolyFill *pf2, PolyFill *pf1)
@@ -311,8 +311,8 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
        ScanFillEdge *ed;
        float fac, fac1, x, y;
 
-       if (sc->first == NULL) {
-               sc->first = sc->last = eed;
+       if (sc->edge_first == NULL) {
+               sc->edge_first = sc->edge_last = eed;
                eed->prev = eed->next = NULL;
                return 1;
        }
@@ -327,7 +327,7 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
        }
        else fac1 = (x - eed->v2->xy[0]) / fac1;
 
-       for (ed = sc->first; ed; ed = ed->next) {
+       for (ed = sc->edge_first; ed; ed = ed->next) {
 
                if (ed->v2 == eed->v2) {
                        return 0;
@@ -345,8 +345,8 @@ static short addedgetoscanvert(ScanFillVertLink *sc, ScanFillEdge *eed)
                        break;
                }
        }
-       if (ed) BLI_insertlinkbefore((ListBase *)&(sc->first), ed, eed);
-       else BLI_addtail((ListBase *)&(sc->first), eed);
+       if (ed) BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed, eed);
+       else BLI_addtail((ListBase *)&(sc->edge_first), eed);
 
        return 1;
 }
@@ -373,7 +373,7 @@ static ScanFillVertLink *addedgetoscanlist(ScanFillContext *sf_ctx, ScanFillEdge
                eed->v2 = eve;
        }
        /* find location in list */
-       scsearch.v1 = eed->v1;
+       scsearch.vert = eed->v1;
        sc = (ScanFillVertLink *)bsearch(&scsearch, sf_ctx->_scdata, len,
                                         sizeof(ScanFillVertLink), vergscdata);
 
@@ -559,7 +559,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                        if (eve->f != SF_VERT_ZERO_LEN) {
                                verts++;
                                eve->f = 0;  /* flag for connectedges later on */
-                               sc->v1 = eve;
+                               sc->vert = eve;
                                sc++;
                        }
                }
@@ -616,11 +616,11 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
        sc = sf_ctx->_scdata;
        for (a = 0; a < verts; a++) {
                /* printf("VERTEX %d %x\n",a,sc->v1); */
-               ed1 = sc->first;
+               ed1 = sc->edge_first;
                while (ed1) {   /* set connectflags  */
                        nexted = ed1->next;
                        if (ed1->v1->h == 1 || ed1->v2->h == 1) {
-                               BLI_remlink((ListBase *)&(sc->first), ed1);
+                               BLI_remlink((ListBase *)&(sc->edge_first), ed1);
                                BLI_addtail(&sf_ctx->filledgebase, ed1);
                                if (ed1->v1->h > 1) ed1->v1->h--;
                                if (ed1->v2->h > 1) ed1->v2->h--;
@@ -629,8 +629,8 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
 
                        ed1 = nexted;
                }
-               while (sc->first) { /* for as long there are edges */
-                       ed1 = sc->first;
+               while (sc->edge_first) { /* for as long there are edges */
+                       ed1 = sc->edge_first;
                        ed2 = ed1->next;
                        
                        /* commented out... the ESC here delivers corrupted memory (and doesnt work during grab) */
@@ -641,7 +641,7 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                break;
                        }
                        if (ed2 == 0) {
-                               sc->first = sc->last = NULL;
+                               sc->edge_first = sc->edge_last = NULL;
                                /* printf("just 1 edge to vert\n"); */
                                BLI_addtail(&sf_ctx->filledgebase, ed1);
                                ed1->v2->f = 0;
@@ -663,12 +663,12 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                test = 0;
 
                                for (b = a + 1; b < verts; b++) {
-                                       if (sc1->v1->f == 0) {
-                                               if (sc1->v1->xy[1] <= miny) break;
+                                       if (sc1->vert->f == 0) {
+                                               if (sc1->vert->xy[1] <= miny) break;
 
-                                               if (testedgeside(v1->xy, v2->xy, sc1->v1->xy))
-                                                       if (testedgeside(v2->xy, v3->xy, sc1->v1->xy))
-                                                               if (testedgeside(v3->xy, v1->xy, sc1->v1->xy)) {
+                                               if (testedgeside(v1->xy, v2->xy, sc1->vert->xy))
+                                                       if (testedgeside(v2->xy, v3->xy, sc1->vert->xy))
+                                                               if (testedgeside(v3->xy, v1->xy, sc1->vert->xy)) {
                                                                        /* point in triangle */
                                                                
                                                                        test = 1;
@@ -679,11 +679,11 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                }
                                if (test) {
                                        /* make new edge, and start over */
-                                       /* printf("add new edge %x %x and start again\n",v2,sc1->v1); */
+                                       /* printf("add new edge %x %x and start again\n",v2,sc1->vert); */
 
-                                       ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->v1);
+                                       ed3 = BLI_scanfill_edge_add(sf_ctx, v2, sc1->vert);
                                        BLI_remlink(&sf_ctx->filledgebase, ed3);
-                                       BLI_insertlinkbefore((ListBase *)&(sc->first), ed2, ed3);
+                                       BLI_insertlinkbefore((ListBase *)&(sc->edge_first), ed2, ed3);
                                        ed3->v2->f = SF_VERT_UNKNOWN;
                                        ed3->f = SF_EDGE_UNKNOWN;
                                        ed3->v1->h++; 
@@ -694,14 +694,14 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                        /* printf("add face %x %x %x\n",v1,v2,v3); */
                                        addfillface(sf_ctx, v1, v2, v3);
                                        totface++;
-                                       BLI_remlink((ListBase *)&(sc->first), ed1);
+                                       BLI_remlink((ListBase *)&(sc->edge_first), ed1);
                                        BLI_addtail(&sf_ctx->filledgebase, ed1);
                                        ed1->v2->f = 0;
                                        ed1->v1->h--; 
                                        ed1->v2->h--;
                                        /* ed2 can be removed when it's a boundary edge */
                                        if ((ed2->f == 0 && twoconnected) || (ed2->f == SF_EDGE_BOUNDARY)) {
-                                               BLI_remlink((ListBase *)&(sc->first), ed2);
+                                               BLI_remlink((ListBase *)&(sc->edge_first), ed2);
                                                BLI_addtail(&sf_ctx->filledgebase, ed2);
                                                ed2->v2->f = 0;
                                                ed2->v1->h--; 
@@ -723,11 +723,11 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                                ed3->v1->h--; 
                                                ed3->v2->h--;
 
-                                               ed3 = sc1->first;
+                                               ed3 = sc1->edge_first;
                                                while (ed3) {
                                                        if ( (ed3->v1 == v1 && ed3->v2 == v3) || (ed3->v1 == v3 && ed3->v2 == v1) ) {
                                                                if (twoconnected || ed3->f == SF_EDGE_BOUNDARY) {
-                                                                       BLI_remlink((ListBase *)&(sc1->first), ed3);
+                                                                       BLI_remlink((ListBase *)&(sc1->edge_first), ed3);
                                                                        BLI_addtail(&sf_ctx->filledgebase, ed3);
                                                                        ed3->v1->h--; 
                                                                        ed3->v2->h--;
@@ -741,11 +741,11 @@ static int scanfill(ScanFillContext *sf_ctx, PolyFill *pf)
                                }
                        }
                        /* test for loose edges */
-                       ed1 = sc->first;
+                       ed1 = sc->edge_first;
                        while (ed1) {
                                nexted = ed1->next;
                                if (ed1->v1->h < 2 || ed1->v2->h < 2) {
-                                       BLI_remlink((ListBase *)&(sc->first), ed1);
+                                       BLI_remlink((ListBase *)&(sc->edge_first), ed1);
                                        BLI_addtail(&sf_ctx->filledgebase, ed1);
                                        if (ed1->v1->h > 1) ed1->v1->h--;
                                        if (ed1->v2->h > 1) ed1->v2->h--;
index afc60d8..e53144b 100644 (file)
@@ -161,9 +161,9 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
        BMEdge *e;
        BMOperator bmop;
        ScanFillContext sf_ctx;
-       /* ScanFillEdge *eed; */ /* UNUSED */
-       ScanFillVert *eve, *v1, *v2;
-       ScanFillFace *efa;
+       /* ScanFillEdge *sf_edge; */ /* UNUSED */
+       ScanFillVert *sf_vert, *sf_vert_1, *sf_vert_2;
+       ScanFillFace *sf_tri;
        SmallHash hash;
 
        BLI_smallhash_init(&hash);
@@ -174,28 +174,28 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op)
                BMO_elem_flag_enable(bm, e, EDGE_MARK);
                
                if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v1)) {
-                       eve = BLI_scanfill_vert_add(&sf_ctx, e->v1->co);
-                       eve->tmp.p = e->v1;
-                       BLI_smallhash_insert(&hash, (uintptr_t)e->v1, eve);
+                       sf_vert = BLI_scanfill_vert_add(&sf_ctx, e->v1->co);
+                       sf_vert->tmp.p = e->v1;
+                       BLI_smallhash_insert(&hash, (uintptr_t)e->v1, sf_vert);
                }
                
                if (!BLI_smallhash_haskey(&hash, (uintptr_t)e->v2)) {
-                       eve = BLI_scanfill_vert_add(&sf_ctx, e->v2->co);
-                       eve->tmp.p = e->v2;
-                       BLI_smallhash_insert(&hash, (uintptr_t)e->v2, eve);
+                       sf_vert = BLI_scanfill_vert_add(&sf_ctx, e->v2->co);
+                       sf_vert->tmp.p = e->v2;
+                       BLI_smallhash_insert(&hash, (uintptr_t)e->v2, sf_vert);
                }
                
-               v1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1);
-               v2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2);
-               /* eed = */ BLI_scanfill_edge_add(&sf_ctx, v1, v2);
-               /* eed->tmp.p = e; */ /* UNUSED */
+               sf_vert_1 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v1);
+               sf_vert_2 = BLI_smallhash_lookup(&hash, (uintptr_t)e->v2);
+               /* sf_edge = */ BLI_scanfill_edge_add(&sf_ctx, sf_vert_1, sf_vert_2);
+               /* sf_edge->tmp.p = e; */ /* UNUSED */
        }
        
        BLI_scanfill_calc(&sf_ctx, FALSE);
        
-       for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
+       for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
                BMFace *f = BM_face_create_quad_tri(bm,
-                                                   efa->v1->tmp.p, efa->v2->tmp.p, efa->v3->tmp.p, NULL,
+                                                   sf_tri->v1->tmp.p, sf_tri->v2->tmp.p, sf_tri->v3->tmp.p, NULL,
                                                    NULL, TRUE);
                BMLoop *l;
                BMIter liter;
index 5a99ddb..d49b77c 100644 (file)
@@ -1866,8 +1866,8 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
 
        for (i = 0; i < totface; i++) {
                SmallHash *hash = &shash;
-               ScanFillFace *efa;
-               ScanFillVert *eve, *lasteve;
+               ScanFillFace *sf_tri;
+               ScanFillVert *sf_vert, *sf_vert_last;
                int j;
                float rndscale = FLT_EPSILON * 25;
 
@@ -1881,55 +1881,55 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
 
                for (entry = face_nets[i].first; entry; entry = entry->next) {
                        if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v1)) {
-                               eve = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v1->v->co);
-                               eve->poly_nr = 0;
-                               rnd_offset_co(eve->co, rndscale);
-                               eve->tmp.p = entry->kfe->v1->v;
-                               BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v1, eve);
+                               sf_vert = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v1->v->co);
+                               sf_vert->poly_nr = 0;
+                               rnd_offset_co(sf_vert->co, rndscale);
+                               sf_vert->tmp.p = entry->kfe->v1->v;
+                               BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v1, sf_vert);
                        }
 
                        if (!BLI_smallhash_haskey(hash, (intptr_t)entry->kfe->v2)) {
-                               eve = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v2->v->co);
-                               eve->poly_nr = 0;
-                               rnd_offset_co(eve->co, rndscale);
-                               eve->tmp.p = entry->kfe->v2->v;
-                               BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v2, eve);
+                               sf_vert = BLI_scanfill_vert_add(&sf_ctx, entry->kfe->v2->v->co);
+                               sf_vert->poly_nr = 0;
+                               rnd_offset_co(sf_vert->co, rndscale);
+                               sf_vert->tmp.p = entry->kfe->v2->v;
+                               BLI_smallhash_insert(hash, (intptr_t)entry->kfe->v2, sf_vert);
                        }
                }
 
                for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
-                       lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
-                       eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
+                       sf_vert_last = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
+                       sf_vert = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
 
-                       eve->poly_nr++;
-                       lasteve->poly_nr++;
+                       sf_vert->poly_nr++;
+                       sf_vert_last->poly_nr++;
                }
 
                for (j = 0, entry = face_nets[i].first; entry; entry = entry->next, j++) {
-                       lasteve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
-                       eve = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
+                       sf_vert_last = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v1);
+                       sf_vert = BLI_smallhash_lookup(hash, (intptr_t)entry->kfe->v2);
 
-                       if (eve->poly_nr > 1 && lasteve->poly_nr > 1) {
-                               ScanFillEdge *eed;
-                               eed = BLI_scanfill_edge_add(&sf_ctx, lasteve, eve);
+                       if (sf_vert->poly_nr > 1 && sf_vert_last->poly_nr > 1) {
+                               ScanFillEdge *sf_edge;
+                               sf_edge = BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
                                if (entry->kfe->oe)
-                                       eed->f = SF_EDGE_BOUNDARY;  /* mark as original boundary edge */
+                                       sf_edge->f = SF_EDGE_BOUNDARY;  /* mark as original boundary edge */
 
                                BMO_elem_flag_disable(bm, entry->kfe->e->v1, DEL);
                                BMO_elem_flag_disable(bm, entry->kfe->e->v2, DEL);
                        }
                        else {
-                               if (lasteve->poly_nr < 2)
-                                       BLI_remlink(&sf_ctx.fillvertbase, lasteve);
-                               if (eve->poly_nr < 2)
-                                       BLI_remlink(&sf_ctx.fillvertbase, eve);
+                               if (sf_vert_last->poly_nr < 2)
+                                       BLI_remlink(&sf_ctx.fillvertbase, sf_vert_last);
+                               if (sf_vert->poly_nr < 2)
+                                       BLI_remlink(&sf_ctx.fillvertbase, sf_vert);
                        }
                }
 
                BLI_scanfill_calc(&sf_ctx, FALSE);
 
-               for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
-                       BMVert *v1 = efa->v3->tmp.p, *v2 = efa->v2->tmp.p, *v3 = efa->v1->tmp.p;
+               for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+                       BMVert *v1 = sf_tri->v3->tmp.p, *v2 = sf_tri->v2->tmp.p, *v3 = sf_tri->v1->tmp.p;
                        BMFace *f2;
                        BMLoop *l_iter;
                        BMVert *verts[3] = {v1, v2, v3};
index e504e37..c8dbee6 100644 (file)
@@ -216,8 +216,8 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
        BLI_srand(0);
        
        BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
-               ScanFillVert *v, *lastv, *firstv;
-               ScanFillFace *sefa;
+               ScanFillVert *sf_vert, *sf_vert_last, *sf_vert_first;
+               ScanFillFace *sf_tri;
                ParamKey key, vkeys[4];
                ParamBool pin[4], select[4];
                BMLoop *ls[3];
@@ -264,35 +264,35 @@ static ParamHandle *construct_param_handle(Scene *scene, BMEditMesh *em,
                        /* ngon - scanfill time! */
                        BLI_scanfill_begin(&sf_ctx);
                        
-                       firstv = lastv = NULL;
+                       sf_vert_first = sf_vert_last = NULL;
                        BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
                                int i;
                                
-                               v = BLI_scanfill_vert_add(&sf_ctx, l->v->co);
+                               sf_vert = BLI_scanfill_vert_add(&sf_ctx, l->v->co);
                                
                                /* add small random offset */
                                for (i = 0; i < 3; i++) {
-                                       v->co[i] += (BLI_frand() - 0.5f) * FLT_EPSILON * 50;
+                                       sf_vert->co[i] += (BLI_frand() - 0.5f) * FLT_EPSILON * 50;
                                }
                                
-                               v->tmp.p = l;
+                               sf_vert->tmp.p = l;
 
-                               if (lastv) {
-                                       BLI_scanfill_edge_add(&sf_ctx, lastv, v);
+                               if (sf_vert_last) {
+                                       BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
                                }
 
-                               lastv = v;
-                               if (!firstv) 
-                                       firstv = v;
+                               sf_vert_last = sf_vert;
+                               if (!sf_vert_first)
+                                       sf_vert_first = sf_vert;
                        }
 
-                       BLI_scanfill_edge_add(&sf_ctx, firstv, v);
+                       BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
 
                        BLI_scanfill_calc_ex(&sf_ctx, TRUE, efa->no);
-                       for (sefa = sf_ctx.fillfacebase.first; sefa; sefa = sefa->next) {
-                               ls[0] = sefa->v1->tmp.p;
-                               ls[1] = sefa->v2->tmp.p;
-                               ls[2] = sefa->v3->tmp.p;
+                       for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+                               ls[0] = sf_tri->v1->tmp.p;
+                               ls[1] = sf_tri->v2->tmp.p;
+                               ls[2] = sf_tri->v3->tmp.p;
 
                                for (i = 0; i < 3; i++) {
                                        MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, ls[i]->head.data, CD_MLOOPUV);
index 7f40d29..97a431d 100644 (file)
@@ -231,8 +231,8 @@ static void wm_gesture_draw_circle(wmGesture *gt)
 static void draw_filled_lasso(wmGesture *gt)
 {
        ScanFillContext sf_ctx;
-       ScanFillVert *v = NULL, *lastv = NULL, *firstv = NULL;
-       ScanFillFace *efa;
+       ScanFillVert *sf_vert = NULL, *sf_vert_last = NULL, *sf_vert_first = NULL;
+       ScanFillFace *sf_tri;
        short *lasso = (short *)gt->customdata;
        int i;
        
@@ -244,26 +244,26 @@ static void draw_filled_lasso(wmGesture *gt)
                co[1] = (float)lasso[1];
                co[2] = 0.0f;
 
-               v = BLI_scanfill_vert_add(&sf_ctx, co);
-               if (lastv)
-                       /* e = */ /* UNUSED */ BLI_scanfill_edge_add(&sf_ctx, lastv, v);
-               lastv = v;
-               if (firstv == NULL) firstv = v;
+               sf_vert = BLI_scanfill_vert_add(&sf_ctx, co);
+               if (sf_vert_last)
+                       /* e = */ /* UNUSED */ BLI_scanfill_edge_add(&sf_ctx, sf_vert_last, sf_vert);
+               sf_vert_last = sf_vert;
+               if (sf_vert_first == NULL) sf_vert_first = sf_vert;
        }
        
        /* highly unlikely this will fail, but could crash if (gt->points == 0) */
-       if (firstv) {
+       if (sf_vert_first) {
                float zvec[3] = {0.0f, 0.0f, 1.0f};
-               BLI_scanfill_edge_add(&sf_ctx, firstv, v);
+               BLI_scanfill_edge_add(&sf_ctx, sf_vert_first, sf_vert);
                BLI_scanfill_calc_ex(&sf_ctx, FALSE, zvec);
        
                glEnable(GL_BLEND);
                glColor4f(1.0, 1.0, 1.0, 0.05);
                glBegin(GL_TRIANGLES);
-               for (efa = sf_ctx.fillfacebase.first; efa; efa = efa->next) {
-                       glVertex2fv(efa->v1->co);
-                       glVertex2fv(efa->v2->co);
-                       glVertex2fv(efa->v3->co);
+               for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) {
+                       glVertex2fv(sf_tri->v1->co);
+                       glVertex2fv(sf_tri->v2->co);
+                       glVertex2fv(sf_tri->v3->co);
                }
                glEnd();
                glDisable(GL_BLEND);