Style Cleanup:
authorCampbell Barton <ideasman42@gmail.com>
Sat, 11 Feb 2012 04:00:18 +0000 (04:00 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 11 Feb 2012 04:00:18 +0000 (04:00 +0000)
also remove editmesh/bmesh conversion files, these wont ever be used and dont contain anything useful as examples.

15 files changed:
source/blender/bmesh/CMakeLists.txt
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_interp.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_opdefines.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_to_editmesh.c [deleted file]
source/blender/bmesh/intern/bmesh_walkers.c
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/bmesh/intern/editmesh_to_bmesh.c [deleted file]

index 26e29c9ac04c25e288130ed61c4fcf82dfaf47bf..693c8cede787a65ece6fcd4e6a928c9b8a578c40 100644 (file)
@@ -90,9 +90,7 @@ set(SRC
        intern/bmesh_mods.c
        intern/bmesh_structure.h
        intern/bmesh_construct.c
-       intern/bmesh_to_editmesh.c
        intern/bmesh_operators_private.h
-       intern/editmesh_to_bmesh.c
        intern/bmesh_structure.c
        intern/bmesh_polygon.c
        intern/bmesh_queries.c
index 9b522fc222e055f9542bec38b2e156aa0f468658..9f6ebfe39ba0bfa9c4c3b0a54638b3daf30c0882 100644 (file)
@@ -5,7 +5,6 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * about this.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2007 Blender Foundation.
  * All rights reserved.
@@ -183,9 +182,9 @@ BMFace *BM_Make_Face_QuadTri_v(BMesh *bm, BMVert **verts, int len, const BMFace
                else {
                        if (!edar[2]) edar[2] = BM_Make_Edge(bm, verts[2], verts[0], NULL, FALSE);
                }
-       
+
                f = BM_Make_Face(bm, verts, edar, len, FALSE);
-       
+
                if (example && f) {
                        BM_Copy_Attributes(bm, bm, example, f);
                }
@@ -799,9 +798,9 @@ BMesh *BM_Copy_Mesh(BMesh *bmold)
 /* ME -> BM */
 char BM_Vert_Flag_From_MEFlag(const char  meflag)
 {
-    return ( ((meflag & SELECT)       ? BM_SELECT : 0) |
-             ((meflag & ME_HIDE)      ? BM_HIDDEN : 0)
-             );
+       return ( ((meflag & SELECT)       ? BM_SELECT : 0) |
+                ((meflag & ME_HIDE)      ? BM_HIDDEN : 0)
+                );
 }
 char BM_Edge_Flag_From_MEFlag(const short meflag)
 {
@@ -813,20 +812,20 @@ char BM_Edge_Flag_From_MEFlag(const short meflag)
 }
 char BM_Face_Flag_From_MEFlag(const char  meflag)
 {
-    return ( ((meflag & ME_FACE_SEL)  ? BM_SELECT : 0) |
-             ((meflag & ME_SMOOTH)    ? BM_SMOOTH : 0) |
-             ((meflag & ME_HIDE)      ? BM_HIDDEN : 0)
-             );
+       return ( ((meflag & ME_FACE_SEL)  ? BM_SELECT : 0) |
+                ((meflag & ME_SMOOTH)    ? BM_SMOOTH : 0) |
+                ((meflag & ME_HIDE)      ? BM_HIDDEN : 0)
+                );
 }
 
 /* BM -> ME */
 char  BM_Vert_Flag_To_MEFlag(BMVert *eve)
 {
-    const char hflag = eve->head.hflag;
+       const char hflag = eve->head.hflag;
 
-    return ( ((hflag & BM_SELECT)  ? SELECT  : 0) |
-             ((hflag & BM_HIDDEN)  ? ME_HIDE : 0)
-             );
+       return ( ((hflag & BM_SELECT)  ? SELECT  : 0) |
+                ((hflag & BM_HIDDEN)  ? ME_HIDE : 0)
+                );
 }
 short BM_Edge_Flag_To_MEFlag(BMEdge *eed)
 {
@@ -842,12 +841,12 @@ short BM_Edge_Flag_To_MEFlag(BMEdge *eed)
 }
 char  BM_Face_Flag_To_MEFlag(BMFace *efa)
 {
-    const char hflag = efa->head.hflag;
+       const char hflag = efa->head.hflag;
 
-    return ( ((hflag & BM_SELECT) ? ME_FACE_SEL : 0) |
-             ((hflag & BM_SMOOTH) ? ME_SMOOTH   : 0) |
-             ((hflag & BM_HIDDEN) ? ME_HIDE     : 0)
-             );
+       return ( ((hflag & BM_SELECT) ? ME_FACE_SEL : 0) |
+                ((hflag & BM_SMOOTH) ? ME_SMOOTH   : 0) |
+                ((hflag & BM_HIDDEN) ? ME_HIDE     : 0)
+                );
 }
 
 /* unused, type spesific functions below */
index 1f8cf3c2ecec0b4bd9caebf27f0ce8f2c1490b6d..e547f75ed4ba50b66c614ad4b75b9e15734f0abd 100644 (file)
@@ -108,7 +108,7 @@ static void UNUSED_FUNCTION(BM_Data_Vert_Average)(BMesh *UNUSED(bm), BMFace *UNU
  *  Returns -
  *     Nothing
  */
+
 void BM_Data_Facevert_Edgeinterp(BMesh *bm, BMVert *v1, BMVert *UNUSED(v2), BMVert *v, BMEdge *e1, float fac)
 {
        void *src[2];
@@ -342,7 +342,7 @@ static double UNUSED_FUNCTION(dist_to_line_segment_v2_d)(double v1[3], double v2
 MINLINE double line_point_side_v2_d(const double *l1, const double *l2, const double *pt)
 {
        return  ((l1[0] - pt[0]) * (l2[1] - pt[1])) -
-                       ((l2[0] - pt[0]) * (l1[1] - pt[1]));
+               ((l2[0] - pt[0]) * (l1[1] - pt[1]));
 }
 
 /* point in quad - only convex quads */
@@ -371,16 +371,16 @@ static int isect_point_quad_v2_d(double pt[2], double v1[2], double v2[2], doubl
 }
 
 /***** multires interpolation*****
-
-mdisps is a grid of displacements, ordered thus:
-
- v1/center----v4/next -> x
-     |           |
-     |           |
-  v2/prev------v3/cur
-     |
-     V
-     y
+ *
+ * mdisps is a grid of displacements, ordered thus:
+ *
*  v1/center----v4/next -> x
*      |           |
*      |           |
*   v2/prev------v3/cur
*      |
*      V
*      y
  */
 
 static int compute_mdisp_quad(BMLoop *l, double v1[3], double v2[3], double v3[3], double v4[3],
@@ -515,7 +515,7 @@ static int mdisp_in_mdispquad(BMesh *bm, BMLoop *l, BMLoop *tl, double p[3], dou
                BM_Vert_UpdateAllNormals(bm, l->v);
        if (len_v3(tl->v->no) == 0.0f)
                BM_Vert_UpdateAllNormals(bm, tl->v);
-               
+
        compute_mdisp_quad(tl, v1, v2, v3, v4, e1, e2);
 
        /* expand quad a bit */
@@ -533,7 +533,7 @@ static int mdisp_in_mdispquad(BMesh *bm, BMLoop *l, BMLoop *tl, double p[3], dou
        
        *x *= res - 1;
        *y *= res - 1;
-                 
+
        return 1;
 }
 
@@ -642,7 +642,7 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
                 *             V
                 *             y
                 */
-                 
+
                sides = (int)sqrt(mdp->totdisp);
                for (y = 0; y < sides; y++) {
                        add_v3_v3v3(co1, mdn->disps[y * sides], mdl->disps[y]);
@@ -673,7 +673,7 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
                 *             V
                 *             y
                 */
-                
+
                if (l->radial_next == l)
                        continue;
 
@@ -681,7 +681,7 @@ void BM_multires_smooth_bounds(BMesh *bm, BMFace *f)
                        mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->head.data, CD_MDISPS);
                else
                        mdl2 = CustomData_bmesh_get(&bm->ldata, l->radial_next->next->head.data, CD_MDISPS);
-                       
+
                sides = (int)sqrt(mdl1->totdisp);
                for (y = 0; y < sides; y++) {
                        int a1, a2, o1, o2;
@@ -820,7 +820,7 @@ void BM_vert_interp_from_face(BMesh *bm, BMVert *v, BMFace *source)
        } while ((l_iter = l_iter->next) != l_first);
 
        /* scale source face coordinates a bit, so points sitting directonly on an
-     * edge will work. */
+        * edge will work. */
        mul_v3_fl(cent, 1.0f / (float)source->len);
        for (i = 0; i < source->len; i++) {
                float vec[3];
index a9ae9613fec42cc98c6cc5f3b1764db8cea5c6b2..73117c607ea2f8e1f8844996f4ac6205bb20e1ec 100644 (file)
@@ -83,7 +83,7 @@ BMesh *BM_Make_Mesh(struct Object *ob, int allocsize[4])
 
        bm->ob = ob;
        
-   /* allocate the memory pools for the mesh elements */
+       /* allocate the memory pools for the mesh elements */
        bm->vpool = BLI_mempool_create(vsize, allocsize[0], allocsize[0], FALSE, TRUE);
        bm->epool = BLI_mempool_create(esize, allocsize[1], allocsize[1], FALSE, TRUE);
        bm->lpool = BLI_mempool_create(lsize, allocsize[2], allocsize[2], FALSE, FALSE);
@@ -136,7 +136,7 @@ void BM_Free_Mesh_Data(BMesh *bm)
        if (bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
        if (bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
 
-       /* free custom data */
+       /* free custom data */
        CustomData_free(&bm->vdata, 0);
        CustomData_free(&bm->edata, 0);
        CustomData_free(&bm->ldata, 0);
@@ -185,7 +185,7 @@ void BM_Clear_Mesh(BMesh *bm)
 
        bm->ob = ob;
        
-   /* allocate the memory pools for the mesh elements */
+       /* allocate the memory pools for the mesh elements */
        bm->vpool = BLI_mempool_create(vsize, allocsize[0], allocsize[0], FALSE, TRUE);
        bm->epool = BLI_mempool_create(esize, allocsize[1], allocsize[1], FALSE, TRUE);
        bm->lpool = BLI_mempool_create(lsize, allocsize[2], allocsize[2], FALSE, FALSE);
@@ -609,8 +609,8 @@ void BM_ElemIndex_Validate(BMesh *bm, const char *location, const char *func, co
 #ifdef DEBUG
        if (is_any_error == 0) {
                fprintf(stderr,
-                               "Valid Index Success: at %s, %s, '%s', '%s'\n",
-                               location, func, msg_a, msg_b);
+                       "Valid Index Success: at %s, %s, '%s', '%s'\n",
+                       location, func, msg_a, msg_b);
        }
 #endif
 #endif
index ce4e48daf763afa116ad4ebe5e5f517c4d8f42a3..8ed44918f58c376291a5d9cfdacdc6ea9ade6a3c 100644 (file)
@@ -256,7 +256,7 @@ void BM_Dissolve_Disk(BMesh *bm, BMVert *v)
  * Returns:
  *      pointer to the combined face
  */
+
 BMFace *BM_Join_TwoFaces(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e)
 {
        BMLoop *l1, *l2;
@@ -362,7 +362,7 @@ BMFace *BM_Split_Face(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **nl,
        if (nf) {
                BM_Copy_Attributes(bm, bm, f, nf);
                copy_v3_v3(nf->no, f->no);
-       
+
                /* handle multires update */
                if (has_mdisp && (nf != f)) {
                        BMLoop *l_iter;
@@ -709,18 +709,18 @@ int BM_Validate_Face(BMesh *bm, BMFace *face, FILE *err)
 }
 
 /*
           BM Rotate Edge
-
   Spins an edge topologically, either counter-clockwise or clockwise.
   If ccw is true, the edge is spun counter-clockwise, otherwise it is
   spun clockwise.
-    
   Returns the spun edge.  Note that this works by dissolving the edge
   then re-creating it, so the returned edge won't have the same pointer
   address as the original one.
-
   Returns NULL on error (e.g., if the edge isn't surrounded by exactly
   two faces).
*         BM Rotate Edge
+ *
* Spins an edge topologically, either counter-clockwise or clockwise.
* If ccw is true, the edge is spun counter-clockwise, otherwise it is
* spun clockwise.
+ *
* Returns the spun edge.  Note that this works by dissolving the edge
* then re-creating it, so the returned edge won't have the same pointer
* address as the original one.
+ *
* Returns NULL on error (e.g., if the edge isn't surrounded by exactly
* two faces).
  */
 BMEdge *BM_Rotate_Edge(BMesh *bm, BMEdge *e, int ccw)
 {
index 46b33a93662b44cca0f498cb7eb680c6f7a6d1a2..7dcad13f77f9501b5fb36bfef526172d58ef1ba6 100644 (file)
@@ -339,102 +339,102 @@ int bmesh_check_element(BMesh *UNUSED(bm), void *element, const char htype)
                return 2;
        
        switch (htype) {
-       case BM_VERT: {
-               BMVert *v = element;
-               if (v->e && v->e->head.htype != BM_EDGE) {
-                       err |= 4;
+               case BM_VERT: {
+                       BMVert *v = element;
+                       if (v->e && v->e->head.htype != BM_EDGE) {
+                               err |= 4;
+                       }
+                       break;
                }
-               break;
-       }
-       case BM_EDGE: {
-               BMEdge *e = element;
-               if (e->l && e->l->head.htype != BM_LOOP)
-                       err |= 8;
-               if (e->l && e->l->f->head.htype != BM_FACE)
-                       err |= 16;
-               if (e->dlink1.prev == NULL || e->dlink2.prev == NULL || e->dlink1.next == NULL || e->dlink2.next == NULL)
-                       err |= 32;
-               if (e->l && (e->l->radial_next == NULL || e->l->radial_prev == NULL))
-                       err |= 64;
-               if (e->l && e->l->f->len <= 0)
-                       err |= 128;
-               break;
-       }
-       case BM_LOOP: {
-               BMLoop *l = element, *l2;
-               int i;
-
-               if (l->f->head.htype != BM_FACE)
-                       err |= 256;
-               if (l->e->head.htype != BM_EDGE)
-                       err |= 512;
-               if (l->v->head.htype !=  BM_VERT)
-                       err |= 1024;
-               if (!BM_Vert_In_Edge(l->e, l->v)) {
-                       fprintf(stderr, "%s: fatal bmesh error (vert not in edge)! (bmesh internal error)\n", __func__);
-                       err |= 2048;
+               case BM_EDGE: {
+                       BMEdge *e = element;
+                       if (e->l && e->l->head.htype != BM_LOOP)
+                               err |= 8;
+                       if (e->l && e->l->f->head.htype != BM_FACE)
+                               err |= 16;
+                       if (e->dlink1.prev == NULL || e->dlink2.prev == NULL || e->dlink1.next == NULL || e->dlink2.next == NULL)
+                               err |= 32;
+                       if (e->l && (e->l->radial_next == NULL || e->l->radial_prev == NULL))
+                               err |= 64;
+                       if (e->l && e->l->f->len <= 0)
+                               err |= 128;
+                       break;
                }
+               case BM_LOOP: {
+                       BMLoop *l = element, *l2;
+                       int i;
+
+                       if (l->f->head.htype != BM_FACE)
+                               err |= 256;
+                       if (l->e->head.htype != BM_EDGE)
+                               err |= 512;
+                       if (l->v->head.htype !=  BM_VERT)
+                               err |= 1024;
+                       if (!BM_Vert_In_Edge(l->e, l->v)) {
+                               fprintf(stderr, "%s: fatal bmesh error (vert not in edge)! (bmesh internal error)\n", __func__);
+                               err |= 2048;
+                       }
 
-               if (l->radial_next == NULL || l->radial_prev == NULL)
-                       err |= (1 << 12);
-               if (l->f->len <= 0)
-                       err |= (1 << 13);
+                       if (l->radial_next == NULL || l->radial_prev == NULL)
+                               err |= (1 << 12);
+                       if (l->f->len <= 0)
+                               err |= (1 << 13);
 
-               /* validate boundary loop--invalid for hole loops, of course,
+                       /* validate boundary loop--invalid for hole loops, of course,
                 * but we won't be allowing those for a while ye */
-               l2 = l;
-               i = 0;
-               do {
-                       if (i >= BM_NGON_MAX)
-                               break;
-
-                       i++;
-                       l2 = l2->next;
-               } while (l2 != l);
+                       l2 = l;
+                       i = 0;
+                       do {
+                               if (i >= BM_NGON_MAX)
+                                       break;
 
-               if (i != l->f->len || l2 != l)
-                       err |= (1 << 14);
+                               i++;
+                               l2 = l2->next;
+                       } while (l2 != l);
 
-               if (!bmesh_radial_validate(bmesh_radial_length(l), l))
-                       err |= (1 << 15);
+                       if (i != l->f->len || l2 != l)
+                               err |= (1 << 14);
 
-               break;
-       }
-       case BM_FACE: {
-               BMFace *f = element;
-               BMLoop *l_iter;
-               BMLoop *l_first;
-               int len = 0;
+                       if (!bmesh_radial_validate(bmesh_radial_length(l), l))
+                               err |= (1 << 15);
 
-               if (!f->loops.first)
-                       err |= (1 << 16);
-               l_iter = l_first = BM_FACE_FIRST_LOOP(f);
-               do {
-                       if (l_iter->f != f) {
-                               fprintf(stderr, "%s: loop inside one face points to another! (bmesh internal error)\n", __func__);
-                               err |= (1 << 17);
-                       }
+                       break;
+               }
+               case BM_FACE: {
+                       BMFace *f = element;
+                       BMLoop *l_iter;
+                       BMLoop *l_first;
+                       int len = 0;
+
+                       if (!f->loops.first)
+                               err |= (1 << 16);
+                       l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+                       do {
+                               if (l_iter->f != f) {
+                                       fprintf(stderr, "%s: loop inside one face points to another! (bmesh internal error)\n", __func__);
+                                       err |= (1 << 17);
+                               }
 
-                       if (!l_iter->e)
-                               err |= (1 << 18);
-                       if (!l_iter->v)
-                               err |= (1 << 19);
-                       if (!BM_Vert_In_Edge(l_iter->e, l_iter->v) || !BM_Vert_In_Edge(l_iter->e, l_iter->next->v)) {
-                               err |= (1 << 20);
-                       }
+                               if (!l_iter->e)
+                                       err |= (1 << 18);
+                               if (!l_iter->v)
+                                       err |= (1 << 19);
+                               if (!BM_Vert_In_Edge(l_iter->e, l_iter->v) || !BM_Vert_In_Edge(l_iter->e, l_iter->next->v)) {
+                                       err |= (1 << 20);
+                               }
 
-                       if (!bmesh_radial_validate(bmesh_radial_length(l_iter), l_iter))
-                               err |= (1 << 21);
+                               if (!bmesh_radial_validate(bmesh_radial_length(l_iter), l_iter))
+                                       err |= (1 << 21);
 
-                       if (!bmesh_disk_count(l_iter->v) || !bmesh_disk_count(l_iter->next->v))
-                               err |= (1 << 22);
+                               if (!bmesh_disk_count(l_iter->v) || !bmesh_disk_count(l_iter->next->v))
+                                       err |= (1 << 22);
 
-                       len++;
-               } while ((l_iter = l_iter->next) != l_first);
+                               len++;
+                       } while ((l_iter = l_iter->next) != l_first);
 
-               if (len != f->len)
-                       err |= (1 << 23);
-       }
+                       if (len != f->len)
+                               err |= (1 << 23);
+               }
        }
 
        if (err) {
@@ -572,10 +572,10 @@ void BM_Kill_Edge(BMesh *bm, BMEdge *e)
 
        bmesh_disk_remove_edge(e, e->v1);
        bmesh_disk_remove_edge(e, e->v2);
-               
+
        if (e->l) {
                BMLoop *l = e->l, *lnext, *startl = e->l;
-                       
+
                do {
                        lnext = l->radial_next;
                        if (lnext->f == l->f) {
@@ -584,7 +584,7 @@ void BM_Kill_Edge(BMesh *bm, BMEdge *e)
                        }
                        
                        BM_Kill_Face(bm, l->f);
-               
+
                        if (l == lnext)
                                break;
                        l = lnext;
@@ -671,7 +671,7 @@ static int bmesh_loop_reverse_loop(BMesh *bm, BMFace *f, BMLoopList *lst)
                        md = CustomData_bmesh_get(&bm->ldata, curloop->head.data, CD_MDISPS);
                        if (!md->totdisp || !md->disps)
                                continue;
-                                       
+
                        sides = (int)sqrt(md->totdisp);
                        co = md->disps;
                        
@@ -1063,7 +1063,7 @@ static BMFace *bmesh_addpolylist(BMesh *bm, BMFace *UNUSED(example))
  *  A BMFace pointer
  */
 BMFace *bmesh_sfme(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2,
-                                  BMLoop **rl, ListBase *holes)
+                   BMLoop **rl, ListBase *holes)
 {
 
        BMFace *f2;
@@ -1394,7 +1394,7 @@ int bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv)
                        bmesh_disk_append_edge(oe, tv);
                        /* remove ke from tv's disk cycl */
                        bmesh_disk_remove_edge(ke, tv);
-               
+
                        /* deal with radial cycle of k */
                        radlen = bmesh_radial_length(ke->l);
                        if (ke->l) {
@@ -1936,7 +1936,7 @@ BMVert *bmesh_urmv(BMesh *bm, BMFace *sf, BMVert *sv)
                if (sl->v == sv) break;
                sl = sl->next;
        } while (sl != hl);
-               
+
        if (sl->v != sv) {
                /* sv is not part of sf */
                return NULL;
index 2e8b86575d4ebba4119684b9410ab1adf11c82c6..02ac4174f69c4b3571f7cf53eb9737475f3e7e0d 100644 (file)
@@ -414,7 +414,7 @@ static BMOpDefine def_bridge_loops = {
        "bridge_loops",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"}, /* input edge */
         {BMOP_OPSLOT_ELEMENT_BUF, "faceout"}, /* new face */
-       {0, /* null-terminating sentine */}},
+        {0, /* null-terminating sentine */}},
        bmesh_bridge_loops_exec,
        0,
 };
@@ -427,7 +427,7 @@ static BMOpDefine def_edgenet_fill = {
         {BMOP_OPSLOT_ELEMENT_BUF, "excludefaces"}, /* list of faces to ignore for manifold check */
         {BMOP_OPSLOT_MAPPING,     "faceout_groupmap"}, /* maps new faces to the group numbers they came fro */
         {BMOP_OPSLOT_ELEMENT_BUF, "faceout"}, /* new face */
-       {0, /* null-terminating sentine */}},
+        {0, /* null-terminating sentine */}},
        bmesh_edgenet_fill_exec,
        0,
 };
@@ -446,7 +446,7 @@ static BMOpDefine def_edgenet_prepare = {
        "edgenet_prepare",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"}, //input edges
         {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"}, //new edges
-       {0, /* null-terminating sentine */}},
+        {0, /* null-terminating sentine */}},
        bmesh_edgenet_prepare,
        0,
 };
@@ -461,8 +461,8 @@ static BMOpDefine def_rotate = {
        "rotate",
        {{BMOP_OPSLOT_VEC, "cent"}, //center of rotation
         {BMOP_OPSLOT_MAT, "mat"}, //matrix defining rotation
-       {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
-       {0, /* null-terminating sentine */}},
+        {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
+        {0, /* null-terminating sentine */}},
        bmesh_rotate_exec,
        0,
 };
@@ -476,8 +476,8 @@ static BMOpDefine def_rotate = {
 static BMOpDefine def_translate = {
        "translate",
        {{BMOP_OPSLOT_VEC, "vec"}, //translation offset
-       {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
-       {0, /* null-terminating sentine */}},
+        {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
+        {0, /* null-terminating sentine */}},
        bmesh_translate_exec,
        0,
 };
@@ -490,8 +490,8 @@ static BMOpDefine def_translate = {
 static BMOpDefine def_scale = {
        "scale",
        {{BMOP_OPSLOT_VEC, "vec"}, //scale factor
-       {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
-       {0, /* null-terminating sentine */}},
+        {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
+        {0, /* null-terminating sentine */}},
        bmesh_scale_exec,
        0,
 };
@@ -506,8 +506,8 @@ static BMOpDefine def_scale = {
 static BMOpDefine def_transform = {
        "transform",
        {{BMOP_OPSLOT_MAT, "mat"}, //transform matrix
-       {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
-       {0, /* null-terminating sentine */}},
+        {BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
+        {0, /* null-terminating sentine */}},
        bmesh_transform_exec,
        0,
 };
@@ -521,8 +521,8 @@ static BMOpDefine def_transform = {
 static BMOpDefine def_object_load_bmesh = {
        "object_load_bmesh",
        {{BMOP_OPSLOT_PNT, "scene"},
-       {BMOP_OPSLOT_PNT, "object"},
-       {0, /* null-terminating sentine */}},
+        {BMOP_OPSLOT_PNT, "object"},
+        {0, /* null-terminating sentine */}},
        object_load_bmesh_exec,
        0,
 };
@@ -567,9 +567,9 @@ static BMOpDefine def_mesh_to_bmesh = {
 static BMOpDefine def_extrude_indivface = {
        "extrude_face_indiv",
        {{BMOP_OPSLOT_ELEMENT_BUF, "faces"}, //input faces
-       {BMOP_OPSLOT_ELEMENT_BUF, "faceout"}, //output faces
-       {BMOP_OPSLOT_ELEMENT_BUF, "skirtout"}, //output skirt geometry, faces and edges
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "faceout"}, //output faces
+        {BMOP_OPSLOT_ELEMENT_BUF, "skirtout"}, //output skirt geometry, faces and edges
+        {0} /* null-terminating sentine */},
        bmesh_extrude_face_indiv_exec,
        0
 };
@@ -583,8 +583,8 @@ static BMOpDefine def_extrude_indivface = {
 static BMOpDefine def_extrude_onlyedge = {
        "extrude_edge_only",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"}, //input vertices
-       {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, //output geometry
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, //output geometry
+        {0} /* null-terminating sentine */},
        bmesh_extrude_onlyedge_exec,
        0
 };
@@ -597,9 +597,9 @@ static BMOpDefine def_extrude_onlyedge = {
 static BMOpDefine def_extrudeverts_indiv = {
        "extrude_vert_indiv",
        {{BMOP_OPSLOT_ELEMENT_BUF, "verts"}, //input vertices
-       {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"}, //output wire edges
-       {BMOP_OPSLOT_ELEMENT_BUF, "vertout"}, //output vertices
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"}, //output wire edges
+        {BMOP_OPSLOT_ELEMENT_BUF, "vertout"}, //output vertices
+        {0} /* null-terminating sentine */},
        extrude_vert_indiv_exec,
        0
 };
@@ -607,8 +607,8 @@ static BMOpDefine def_extrudeverts_indiv = {
 static BMOpDefine def_connectverts = {
        "connectverts",
        {{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
+        {0} /* null-terminating sentine */},
        connectverts_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -616,10 +616,10 @@ static BMOpDefine def_connectverts = {
 static BMOpDefine def_extrudefaceregion = {
        "extrudefaceregion",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edgefacein"},
-       {BMOP_OPSLOT_MAPPING, "exclude"},
-       {BMOP_OPSLOT_INT, "alwayskeeporig"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_MAPPING, "exclude"},
+        {BMOP_OPSLOT_INT, "alwayskeeporig"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
+        {0} /* null-terminating sentine */},
        extrude_edge_context_exec,
        0
 };
@@ -627,7 +627,7 @@ static BMOpDefine def_extrudefaceregion = {
 static BMOpDefine def_dissolvevertsop = {
        "dissolveverts",
        {{BMOP_OPSLOT_ELEMENT_BUF, "verts"},
-       {0} /* null-terminating sentine */},
+        {0} /* null-terminating sentine */},
        dissolveverts_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -635,9 +635,9 @@ static BMOpDefine def_dissolvevertsop = {
 static BMOpDefine def_dissolveedgessop = {
        "dissolveedges",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
-       {BMOP_OPSLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges.
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
+        {BMOP_OPSLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges.
+        {0} /* null-terminating sentine */},
        dissolveedges_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -645,8 +645,8 @@ static BMOpDefine def_dissolveedgessop = {
 static BMOpDefine def_dissolveedgeloopsop = {
        "dissolveedgeloop",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
+        {0} /* null-terminating sentine */},
        dissolve_edgeloop_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -654,9 +654,9 @@ static BMOpDefine def_dissolveedgeloopsop = {
 static BMOpDefine def_dissolvefacesop = {
        "dissolvefaces",
        {{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
-       {BMOP_OPSLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges.
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "regionout"},
+        {BMOP_OPSLOT_INT, "use_verts"}, // dissolve verts left between only 2 edges.
+        {0} /* null-terminating sentine */},
        dissolvefaces_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -665,10 +665,10 @@ static BMOpDefine def_dissolvefacesop = {
 static BMOpDefine def_triangop = {
        "triangulate",
        {{BMOP_OPSLOT_ELEMENT_BUF, "faces"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "faceout"},
-       {BMOP_OPSLOT_MAPPING, "facemap"},
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "edgeout"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "faceout"},
+        {BMOP_OPSLOT_MAPPING, "facemap"},
+        {0} /* null-terminating sentine */},
        triangulate_exec,
        BMOP_UNTAN_MULTIRES
 };
@@ -676,24 +676,24 @@ static BMOpDefine def_triangop = {
 static BMOpDefine def_subdop = {
        "esubd",
        {{BMOP_OPSLOT_ELEMENT_BUF, "edges"},
-       {BMOP_OPSLOT_INT, "numcuts"},
-       {BMOP_OPSLOT_FLT, "smooth"},
-       {BMOP_OPSLOT_FLT, "fractal"},
-       {BMOP_OPSLOT_INT, "beauty"},
-       {BMOP_OPSLOT_INT, "seed"},
-       {BMOP_OPSLOT_MAPPING, "custompatterns"},
-       {BMOP_OPSLOT_MAPPING, "edgepercents"},
-       
+        {BMOP_OPSLOT_INT, "numcuts"},
+        {BMOP_OPSLOT_FLT, "smooth"},
+        {BMOP_OPSLOT_FLT, "fractal"},
+        {BMOP_OPSLOT_INT, "beauty"},
+        {BMOP_OPSLOT_INT, "seed"},
+        {BMOP_OPSLOT_MAPPING, "custompatterns"},
+        {BMOP_OPSLOT_MAPPING, "edgepercents"},
+
        /* these next three can have multiple types of elements in them */
-       {BMOP_OPSLOT_ELEMENT_BUF, "outinner"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "outsplit"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */
+        {BMOP_OPSLOT_ELEMENT_BUF, "outinner"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "outsplit"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "geomout"}, /* contains all output geometr */
 
-       {BMOP_OPSLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h
-       {BMOP_OPSLOT_INT, "gridfill"}, //fill in fully-selected faces with a grid
-       {BMOP_OPSLOT_INT, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle
+        {BMOP_OPSLOT_INT, "quadcornertype"}, //quad corner type, see bmesh_operators.h
+        {BMOP_OPSLOT_INT, "gridfill"}, //fill in fully-selected faces with a grid
+        {BMOP_OPSLOT_INT, "singleedge"}, //tesselate the case of one edge selected in a quad or triangle
 
-       {0} /* null-terminating sentine */,
+        {0} /* null-terminating sentine */,
        },
        esubdivide_exec,
        BMOP_UNTAN_MULTIRES
@@ -702,7 +702,7 @@ static BMOpDefine def_subdop = {
 static BMOpDefine def_delop = {
        "del",
        {{BMOP_OPSLOT_ELEMENT_BUF, "geom"}, {BMOP_OPSLOT_INT, "context"},
-       {0} /* null-terminating sentine */},
+        {0} /* null-terminating sentine */},
        delop_exec,
        0
 };
@@ -710,15 +710,15 @@ static BMOpDefine def_delop = {
 static BMOpDefine def_dupeop = {
        "dupe",
        {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "origout"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "newout"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "origout"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "newout"},
        /* facemap maps from source faces to dupe
         * faces, and from dupe faces to source faces */
-       {BMOP_OPSLOT_MAPPING, "facemap"},
-       {BMOP_OPSLOT_MAPPING, "boundarymap"},
-       {BMOP_OPSLOT_MAPPING, "isovertmap"},
-       {BMOP_OPSLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_MAPPING, "facemap"},
+        {BMOP_OPSLOT_MAPPING, "boundarymap"},
+        {BMOP_OPSLOT_MAPPING, "isovertmap"},
+        {BMOP_OPSLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
+        {0} /* null-terminating sentine */},
        dupeop_exec,
        0
 };
@@ -726,11 +726,11 @@ static BMOpDefine def_dupeop = {
 static BMOpDefine def_splitop = {
        "split",
        {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
-       {BMOP_OPSLOT_MAPPING, "boundarymap"},
-       {BMOP_OPSLOT_MAPPING, "isovertmap"},
-       {BMOP_OPSLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
+        {BMOP_OPSLOT_MAPPING, "boundarymap"},
+        {BMOP_OPSLOT_MAPPING, "isovertmap"},
+        {BMOP_OPSLOT_PNT, "dest"}, /* destination bmesh, if NULL will use current on */
+        {0} /* null-terminating sentine */},
        splitop_exec,
        0
 };
@@ -744,14 +744,14 @@ static BMOpDefine def_splitop = {
 static BMOpDefine def_spinop = {
        "spin",
        {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
-       {BMOP_OPSLOT_VEC, "cent"}, /* rotation center */
-       {BMOP_OPSLOT_VEC, "axis"}, /* rotation axis */
-       {BMOP_OPSLOT_VEC, "dvec"}, /* translation delta per step */
-       {BMOP_OPSLOT_FLT, "ang"}, /* total rotation angle (degrees) */
-       {BMOP_OPSLOT_INT, "steps"}, /* number of steps */
-       {BMOP_OPSLOT_INT, "dupli"}, /* duplicate or extrude? */
-       {0} /* null-terminating sentine */},
+        {BMOP_OPSLOT_ELEMENT_BUF, "lastout"}, /* result of last step */
+        {BMOP_OPSLOT_VEC, "cent"}, /* rotation center */
+        {BMOP_OPSLOT_VEC, "axis"}, /* rotation axis */
+        {BMOP_OPSLOT_VEC, "dvec"}, /* translation delta per step */
+        {BMOP_OPSLOT_FLT, "ang"}, /* total rotation angle (degrees) */
+        {BMOP_OPSLOT_INT, "steps"}, /* number of steps */
+        {BMOP_OPSLOT_INT, "dupli"}, /* duplicate or extrude? */
+        {0} /* null-terminating sentine */},
        spinop_exec,
        0
 };
@@ -974,16 +974,16 @@ static BMOpDefine def_create_cone = {
  * Creates a circle
  */
 static BMOpDefine def_create_circle = {
-  "create_circle",
-  {{BMOP_OPSLOT_ELEMENT_BUF, "vertout"}, //output verts
-   {BMOP_OPSLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces
-   {BMOP_OPSLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons
-   {BMOP_OPSLOT_INT, "segments"},
-   {BMOP_OPSLOT_FLT, "diameter"}, //diameter of one end
-   {BMOP_OPSLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
-   {0, /* null-terminating sentine */}},
-  bmesh_create_circle_exec,
-  0,
+       "create_circle",
+       {{BMOP_OPSLOT_ELEMENT_BUF, "vertout"}, //output verts
+        {BMOP_OPSLOT_INT, "cap_ends"}, //wheter or not to fill in the ends with faces
+        {BMOP_OPSLOT_INT, "cap_tris"}, //fill ends with triangles instead of ngons
+        {BMOP_OPSLOT_INT, "segments"},
+        {BMOP_OPSLOT_FLT, "diameter"}, //diameter of one end
+        {BMOP_OPSLOT_MAT, "mat"}, //matrix to multiply the new geometry with--
+        {0, /* null-terminating sentine */}},
+       bmesh_create_circle_exec,
+       0,
 };
 
 /*
@@ -1059,9 +1059,9 @@ static BMOpDefine def_triangle_fill = {
 static BMOpDefine def_solidify = {
        "solidify",
        {{BMOP_OPSLOT_ELEMENT_BUF, "geom"},
-       {BMOP_OPSLOT_FLT, "thickness"},
-       {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
-       {0}},
+        {BMOP_OPSLOT_FLT, "thickness"},
+        {BMOP_OPSLOT_ELEMENT_BUF, "geomout"},
+        {0}},
        bmesh_solidify_face_region_exec,
        0
 };
index 25809fbc6565896e1e2b895ac091346af4ddf945..b1f8b63662fb891ddad27dac9492a213c06d472a 100644 (file)
@@ -1044,10 +1044,10 @@ float BMO_IterMapValf(BMOIter *iter)
 
 /* error syste */
 typedef struct BMOpError {
-       struct BMOpError *next, *prev;
-       int errorcode;
-       BMOperator *op;
-       const char *msg;
+       struct BMOpError *next, *prev;
+       int errorcode;
+       BMOperator *op;
+       const char *msg;
 } BMOpError;
 
 void BMO_ClearStack(BMesh *bm)
@@ -1250,103 +1250,103 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
                }
                else {
                        switch (*fmt) {
-                       case ' ':
-                       case '\t':
-                       case '=':
-                       case '%':
-                               break;
-                       case 'm': {
-                               int size, c;
-                               
-                               c = NEXT_CHAR(fmt);
-                               fmt++;
-
-                               if (c == '3') size = 3;
-                               else if (c == '4') size = 4;
-                               else GOTO_ERROR;
-
-                               BMO_Set_Mat(op, slotname, va_arg(vlist, void *), size);
-                               state = 1;
-                               break;
-                       }
-                       case 'v': {
-                               BMO_Set_Vec(op, slotname, va_arg(vlist, float *));
-                               state = 1;
-                               break;
-                       }
-                       case 'e': {
-                               BMHeader *ele = va_arg(vlist, void *);
-                               BMOpSlot *slot = BMO_GetSlot(op, slotname);
+                               case ' ':
+                               case '\t':
+                               case '=':
+                               case '%':
+                                       break;
+                               case 'm': {
+                                       int size, c;
+
+                                       c = NEXT_CHAR(fmt);
+                                       fmt++;
+
+                                       if (c == '3') size = 3;
+                                       else if (c == '4') size = 4;
+                                       else GOTO_ERROR;
+
+                                       BMO_Set_Mat(op, slotname, va_arg(vlist, void *), size);
+                                       state = 1;
+                                       break;
+                               }
+                               case 'v': {
+                                       BMO_Set_Vec(op, slotname, va_arg(vlist, float *));
+                                       state = 1;
+                                       break;
+                               }
+                               case 'e': {
+                                       BMHeader *ele = va_arg(vlist, void *);
+                                       BMOpSlot *slot = BMO_GetSlot(op, slotname);
 
-                               slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
-                               slot->len = 1;
-                               *((void **)slot->data.buf) = ele;
+                                       slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(void *) * 4);
+                                       slot->len = 1;
+                                       *((void **)slot->data.buf) = ele;
 
-                               state = 1;
-                               break;
-                       }
-                       case 's': {
-                               BMOperator *op2 = va_arg(vlist, void *);
-                               const char *slotname2 = va_arg(vlist, char *);
-
-                               BMO_CopySlot(op2, op, slotname2, slotname);
-                               state = 1;
-                               break;
-                       }
-                       case 'i':
-                       case 'd':
-                               BMO_Set_Int(op, slotname, va_arg(vlist, int));
-                               state = 1;
-                               break;
-                       case 'p':
-                               BMO_Set_Pnt(op, slotname, va_arg(vlist, void *));
-                               state = 1;
-                               break;
-                       case 'f':
-                       case 'h':
-                       case 'a':
-                               type = *fmt;
+                                       state = 1;
+                                       break;
+                               }
+                               case 's': {
+                                       BMOperator *op2 = va_arg(vlist, void *);
+                                       const char *slotname2 = va_arg(vlist, char *);
 
-                               if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\t' || NEXT_CHAR(fmt) == '\0') {
-                                       BMO_Set_Float(op, slotname, va_arg(vlist, double));
+                                       BMO_CopySlot(op2, op, slotname2, slotname);
+                                       state = 1;
+                                       break;
                                }
-                               else {
-                                       ret = 0;
-                                       stop = 0;
-                                       while (1) {
-                                               switch (NEXT_CHAR(fmt)) {
-                                                       case 'f': ret |= BM_FACE; break;
-                                                       case 'e': ret |= BM_EDGE; break;
-                                                       case 'v': ret |= BM_VERT; break;
-                                                       default:
-                                                               stop = 1;
+                               case 'i':
+                               case 'd':
+                                       BMO_Set_Int(op, slotname, va_arg(vlist, int));
+                                       state = 1;
+                                       break;
+                               case 'p':
+                                       BMO_Set_Pnt(op, slotname, va_arg(vlist, void *));
+                                       state = 1;
+                                       break;
+                               case 'f':
+                               case 'h':
+                               case 'a':
+                                       type = *fmt;
+
+                                       if (NEXT_CHAR(fmt) == ' ' || NEXT_CHAR(fmt) == '\t' || NEXT_CHAR(fmt) == '\0') {
+                                               BMO_Set_Float(op, slotname, va_arg(vlist, double));
+                                       }
+                                       else {
+                                               ret = 0;
+                                               stop = 0;
+                                               while (1) {
+                                                       switch (NEXT_CHAR(fmt)) {
+                                                               case 'f': ret |= BM_FACE; break;
+                                                               case 'e': ret |= BM_EDGE; break;
+                                                               case 'v': ret |= BM_VERT; break;
+                                                               default:
+                                                                       stop = 1;
+                                                                       break;
+                                                       }
+                                                       if (stop) {
                                                                break;
-                                               }
-                                               if (stop) {
-                                                       break;
-                                               }
+                                                       }
 
-                                               fmt++;
-                                       }
+                                                       fmt++;
+                                               }
 
-                                       if (type == 'h') {
-                                               BMO_HeaderFlag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
-                                       }
-                                       else if (type == 'a') {
-                                               BMO_All_To_Slot(bm, op, slotname, ret);
-                                       }
-                                       else {
-                                               BMO_Flag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
+                                               if (type == 'h') {
+                                                       BMO_HeaderFlag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
+                                               }
+                                               else if (type == 'a') {
+                                                       BMO_All_To_Slot(bm, op, slotname, ret);
+                                               }
+                                               else {
+                                                       BMO_Flag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
+                                               }
                                        }
-                               }
 
-                               state = 1;
-                               break;
-                       default:
-                               fprintf(stderr,
-                                       "%s: unrecognized bmop format char: %c, %d in '%s'\n",
-                                       __func__, *fmt, (int)(fmt - ofmt), ofmt);
-                               break;
+                                       state = 1;
+                                       break;
+                               default:
+                                       fprintf(stderr,
+                                               "%s: unrecognized bmop format char: %c, %d in '%s'\n",
+                                               __func__, *fmt, (int)(fmt - ofmt), ofmt);
+                                       break;
                        }
                }
                fmt++;
index 6ec4faae3ea9e1f199f095a114d3797fa431bc2b..987807e03500da296e5624282dfd8f5cdb1af118 100644 (file)
@@ -139,7 +139,7 @@ static void compute_poly_normal(float normal[3], float (*verts)[3], int nverts)
                }
 #endif
                /* newell's method
-               
+
                so thats?:
                (a[1] - b[1]) * (a[2] + b[2]);
                a[1]*b[2] - b[1]*a[2] - b[1]*b[2] + a[1]*a[2]
@@ -553,7 +553,7 @@ void bmesh_update_face_normal(BMesh *bm, BMFace *f, float no[3],
 }
 /* exact same as 'bmesh_update_face_normal' but accepts vertex coords */
 void bmesh_update_face_normal_vertex_cos(BMesh *bm, BMFace *f, float no[3],
-                                   float (*projectverts)[3], float (*vertexCos)[3])
+                                         float (*projectverts)[3], float (*vertexCos)[3])
 {
        BMLoop *l;
 
@@ -665,7 +665,7 @@ static int linecrossesf(const float v1[2], const float v2[2], const float v3[2],
        
        /* do an interval test on the x and y axe */
        /* first do x axi */
-       #define T FLT_EPSILON * 15
+#define T FLT_EPSILON * 15
        if ( ABS(v1[1] - v2[1]) < T &&
             ABS(v3[1] - v4[1]) < T &&
             ABS(v1[1] - v3[1]) < T)
index 9018ab8c14a2ab2c8425bdbf9d398f5bd8fdf27c..d0d5e09e1e4a0cb12a9ef7e9daff381fd17b4c3d 100644 (file)
@@ -247,8 +247,9 @@ int BM_Vert_FaceCount(BMVert *v)
        BMLoop *l;
        BMIter iter;
 
-       BM_ITER(l, &iter, NULL, BM_LOOPS_OF_VERT, v)
+       BM_ITER(l, &iter, NULL, BM_LOOPS_OF_VERT, v) {
                count++;
+       }
 
        return count;
 #if 0 //this code isn't working
index ca2811adff03175938028982e3257c95008c0742..149b8d90134c94aec66e32716f24351be8b15021 100644 (file)
@@ -5,7 +5,6 @@
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
  * of the License, or (at your option) any later version.
- * about this.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +13,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2007 Blender Foundation.
  * All rights reserved.
@@ -50,7 +49,7 @@
  *     MISC utility functions.
  *
  */
+
 int bmesh_vert_in_edge(BMEdge *e, BMVert *v)
 {
        if (e->v1 == v || e->v2 == v) return TRUE;
@@ -665,7 +664,7 @@ int bmesh_cycle_remove(void *h, void *remn)
                                //remnode->next = NULL;
                                //remnode->prev = NULL;
                                return TRUE;
-               
+
                        }
                }
        }
@@ -714,7 +713,7 @@ int bmesh_cycle_validate(int len, void *h)
  *  Returns -
  *     Pointer to the next edge in the disk cycle for the vertex v.
  */
+
 BMEdge *bmesh_disk_nextedge(BMEdge *e, BMVert *v)
 {
        if (bmesh_vert_in_edge(e, v)) {
@@ -958,7 +957,7 @@ void bmesh_radial_remove_loop(BMLoop *l, BMEdge *e)
 
 int bmesh_radial_find_face(BMEdge *e, BMFace *f)
 {
-               
+
        BMLoop *curloop;
        int i, len;
        
diff --git a/source/blender/bmesh/intern/bmesh_to_editmesh.c b/source/blender/bmesh/intern/bmesh_to_editmesh.c
deleted file mode 100644 (file)
index 4b5bd16..0000000
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/intern/bmesh_to_editmesh.c
- *  \ingroup bmesh
- *
- * Unused
- */
-
-#if 0
-#include "MEM_guardedalloc.h"
-#include "BKE_customdata.h" 
-#include "DNA_listBase.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include <string.h>
-#include "BKE_utildefines.h"
-#include "BKE_mesh.h"
-#include "BKE_global.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
-
-#include "BLI_editVert.h"
-#include "mesh_intern.h"
-#include "ED_mesh.h"
-
-#include "BLI_edgehash.h"
-#include "BLI_array.h"
-#include "BLI_array.h"
-
-#include "bmesh.h"
-
-/*
- * BMESH TO EDITMESH
- *
- * This file contains functions for converting 
- * from a bmesh to an editmesh
- *
-*/
-
-/*
- * LOOPS TO EDITMESH CORNERS
- *
- * Converts N-Gon loop (face-edge)
- * data (UVs, Verts Colors, ect) to
- * face corner data.
- *
-*/
-
-static void loops_to_editmesh_corners(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex)
-{
-       int i, j;
-       BMLoop *l;
-       MTFace *texface;
-       MTexPoly *texpoly;
-       MCol *mcol;
-       MLoopCol *mloopcol;
-       MLoopUV *mloopuv;
-
-       for(i=0; i < numTex; i++) {
-               texface = CustomData_em_get_n(facedata, face_block, CD_MTFACE, i);
-               texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i);
-               
-               texface->tpage = texpoly->tpage;
-               texface->flag = texpoly->flag;
-               texface->transp = texpoly->transp;
-               texface->mode = texpoly->mode;
-               texface->tile = texpoly->tile;
-               texface->unwrap = texpoly->unwrap;
-
-               j = 0;
-               l = f->loopbase;
-               do {
-                       mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
-                       texface->uv[j][0] = mloopuv->uv[0];
-                       texface->uv[j][1] = mloopuv->uv[1];
-                       j++;
-                       l = ((l->next));
-               } while(l!=f->lbase);
-
-       }
-
-       for(i=0; i < numCol; i++) {
-               mcol = CustomData_em_get_n(facedata, face_block, CD_MCOL, i);
-               j = 0;
-               l = f->loopbase;
-               do {
-                       mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i);
-                       mcol[j].r = mloopcol->r;
-                       mcol[j].g = mloopcol->g;
-                       mcol[j].b = mloopcol->b;
-                       mcol[j].a = mloopcol->a;
-                       j++;
-                       l = ((l->next));
-               } while(l!=f->lbase);
-       }
-}
-
-static EditVert *bmeshvert_to_editvert(BMesh *bm, EditMesh *em, BMVert *v, int index, EditVert **evlist)
-{
-       EditVert *eve = NULL;
-
-       v->head.eflag1 = index; /*abuse!*/
-       eve = addvertlist(em, v->co, NULL);
-       eve->keyindex = index;
-       evlist[index]= eve;
-       
-       /*copy flags*/
-       if(v->head.flag & BM_HIDDEN) eve->h = 1;
-       if (v->head.flag & BM_SELECT) eve->f |= SELECT;
-
-       eve->bweight = v->bweight;
-       CustomData_em_copy_data(&bm->vdata, &em->vdata, v->head.data, &eve->data);
-       /*copy normal*/
-       eve->no[0] = v->no[0];
-       eve->no[1] = v->no[1];
-       eve->no[2] = v->no[2];
-
-       return eve;
-}
-
-static void bmeshedge_to_editedge_internal(BMesh *bm, EditMesh *em, BMEdge *e, EditEdge *eed)
-{
-       eed->crease = e->crease;
-       eed->bweight = e->bweight;
-       
-       //copy relavent flags
-       if (e->head.flag & BM_SELECT) eed->f |= SELECT;
-       if (e->head.flag & BM_SEAM) eed->seam = 1;
-       if (e->head.flag & BM_SHARP) eed->sharp = 1;
-       if (e->head.flag & BM_HIDDEN) eed->h = 1;
-       if (e->head.flag & BM_FGON) eed->h |= EM_FGON;
-
-       CustomData_em_copy_data(&bm->edata, &em->edata, e->head.data, &eed->data);
-}
-
-static EditEdge *bmeshedge_to_editedge(BMesh *bm, EditMesh *em, BMEdge *e, EditVert **evlist)
-{
-       EditEdge *eed = NULL;
-
-       if(!(findedgelist(em, evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1]))) {
-               eed= addedgelist(em, evlist[e->v1->head.eflag1], evlist[e->v2->head.eflag1], NULL);
-               bmeshedge_to_editedge_internal(bm, em, e, eed);
-       }
-
-       return eed;
-}
-
-static EditFace *bmeshface_to_editface(BMesh *bm, EditMesh *em, BMFace *f, EditVert **evlist, int numCol, int numTex)
-{
-       EditVert *eve1, *eve2, *eve3, *eve4;
-       EditFace *efa = NULL;
-       int len;
-       
-       len = f->len;
-
-       eve1= evlist[f->lbase->v->head.eflag1];
-       eve2= evlist[((f->lbase->next))->v->head.eflag1];
-       eve3= evlist[((f->lbase->next->next))->v->head.eflag1];
-       if (len == 4) {
-               eve4= evlist[ ((f->lbase->prev))->v->head.eflag1];
-       }
-       else {
-               eve4= NULL;
-       }
-       
-       if (eve1==eve2 || eve1==eve3 || eve1==eve4 || eve2==eve3 || eve3==eve4
-           || eve2==eve4) return NULL;
-
-       efa = addfacelist(em, eve1, eve2, eve3, eve4, NULL, NULL);
-       if (!efa) return NULL;
-
-       bmeshedge_to_editedge_internal(bm, em, f->lbase->e, efa->e1);
-       bmeshedge_to_editedge_internal(bm, em, ((f->lbase->next))->e, efa->e2);
-       bmeshedge_to_editedge_internal(bm, em, ((f->lbase->next->next))->e, efa->e3);
-       if(eve4)
-               bmeshedge_to_editedge_internal(bm, em, ((f->lbase->prev))->e, efa->e4);
-
-       efa->mat_nr = (unsigned char)f->mat_nr;
-
-       /*Copy normal*/
-       efa->n[0] = f->no[0];
-       efa->n[1] = f->no[1];
-       efa->n[2] = f->no[2];
-       
-       //copy relavent original flags
-       if (f->head.flag & BM_SELECT) efa->f |= SELECT;
-       if (f->head.flag & BM_HIDDEN) efa->h = 1;
-       if (f->head.flag & BM_SMOOTH) efa->flag |= ME_SMOOTH;
-       if (f->head.flag & BM_ACTIVE) EM_set_actFace(em, efa);
-
-       CustomData_em_copy_data(&bm->pdata, &em->fdata, f->head.data, &efa->data);
-       loops_to_editmesh_corners(bm, &em->fdata, efa->data, f, numCol,numTex);
-       
-       return efa;
-}
-
-EditMesh *bmesh_to_editmesh_intern(BMesh *bm) 
-{
-       BMVert *v;
-       BMEdge *e;
-       BMFace *f;
-
-       BMIter verts;
-       BMIter edges;
-       BMIter faces;
-
-       EditMesh *em;
-       EditVert *eve, **evlist;
-
-       int totvert, i, numTex, numCol, flag;
-
-       em = MEM_callocN(sizeof(EditMesh), "EditMesh from bmesh");
-
-       em->selectmode = bm->selectmode;
-
-       flag = CD_MASK_BMESH & ~CD_MASK_MTEXPOLY;
-
-       CustomData_copy(&bm->vdata, &em->vdata, flag, CD_CALLOC, 0);
-       CustomData_copy(&bm->edata, &em->edata, flag, CD_CALLOC, 0);
-       CustomData_copy(&bm->pdata, &em->fdata, flag, CD_CALLOC, 0);
-       CustomData_from_bmeshpoly(&em->fdata, &bm->pdata, &bm->ldata,0);
-       numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-       numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-       totvert = BM_Count_Element(bm, BM_VERT);
-       evlist= MEM_mallocN(totvert*sizeof(EditVert *),"evlist");
-
-       /* make vertices */
-       for(i=0, v = BMIter_New(&verts, bm, BM_VERTS_OF_MESH, bm); v; v = BMIter_Step(&verts), i++) 
-               eve = bmeshvert_to_editvert(bm, em, v, i, evlist);
-
-       /* make edges */
-       for(e = BMIter_New(&edges, bm, BM_EDGES_OF_MESH, bm); e; e = BMIter_Step(&edges))
-               bmeshedge_to_editedge(bm, em, e, evlist);
-
-       /* make faces */
-       for(f = BMIter_New(&faces, bm, BM_FACES_OF_MESH, bm); f; f = BMIter_Step(&faces))
-               bmeshface_to_editface(bm, em, f, evlist, numCol, numTex);
-                       
-       MEM_freeN(evlist);
-
-       EM_fgon_flags(em);
-
-       EM_nvertices_selected(em);
-       EM_nedges_selected(em);
-       EM_nfaces_selected(em);
-
-       return em;
-}
-
-void bmesh2edit_exec(BMesh *bmesh, BMOperator *op)
-{
-       BMO_Set_Pnt(op, "emout", bmesh_to_editmesh_intern(bmesh));
-}
-
-#define FACE_NGON      1
-
-void bmesh_make_fgons_exec(BMesh *bmesh, BMOperator *op)
-{
-       BMOperator triop;
-       BMFace *face;
-       BMIter iter, liter;
-       BMEdge *edge;
-       BMLoop *l, *nl;
-       BMOpSlot *eout;
-       int i, trifan = BMO_Get_Int(op, "trifan");
-
-       if (!trifan) BMO_Init_Op(&triop, "triangulate");
-       
-       /* instead of properly tesselate, just make a triangle fan, this
-        * should make bmesh -> editmesh -> bmesh conversions always properly
-        * work. */
-       for (face = BMIter_New(&iter, bmesh, BM_FACES_OF_MESH, NULL); face; face=BMIter_Step(&iter)) {
-               if (face->len > 4) {
-                       BMO_SetFlag(bmesh, face, FACE_NGON);
-                       if (trifan) {
-                               while (face->len > 4) {
-                                       face = BM_Split_Face(bmesh, face, 
-                                               face->lbase->v, 
-                                               (face->lbase->next->next)->v,
-                                               &nl, NULL);
-                                       BM_SetHFlag(nl->e, BM_FGON);
-                               }
-                       }
-               }
-       }
-
-       if (!trifan) {
-               BMO_Flag_To_Slot(bmesh, &triop, "faces", FACE_NGON, BM_FACE);
-               BMO_Exec_Op(bmesh, &triop);
-
-               eout = BMO_GetSlot(&triop, "edgeout");
-               for (i=0; i<eout->len; i++) {
-                       edge = ((BMEdge**)eout->data.buf)[i];
-                       edge->head.flag |= BM_FGON;
-                       face = BMIter_New(&iter, bmesh, BM_FACES_OF_EDGE, edge);
-                       
-                       for (; face; face=BMIter_Step(&iter)) {
-                               face->head.flag |= BM_NONORMCALC;
-                       }
-               }
-
-               BMO_Finish_Op(bmesh, &triop);
-       }
-}
-
-EditMesh *bmesh_to_editmesh(BMesh *bmesh)
-{
-       BMOperator conv, makefgon;
-       EditMesh *em;
-       
-       /*first fgon-afy the mesh*/
-       BMO_Init_Op(&makefgon, "makefgon");
-       BMO_Set_Int(&makefgon, "trifan", 1);
-       BMO_Exec_Op(bmesh, &makefgon);
-       BMO_Finish_Op(bmesh, &makefgon);
-
-       BMO_Init_Op(&conv, "bmesh_to_editmesh");
-       BMO_Exec_Op(bmesh, &conv);
-       em = BMO_Get_Pnt(&conv, "emout");
-       BMO_Finish_Op(bmesh, &conv);
-       
-       return em;
-}
-#endif
index 681e60a49d40ebfa5cc1c43ff462cab03dc1dc63..e666a88583c421d760132acca27a33d7ca0eab0b 100644 (file)
@@ -244,15 +244,15 @@ void *BMW_addstate(BMWalker *walker)
        newstate->depth = walker->depth;
        switch (walker->order)
        {
-       case BMW_DEPTH_FIRST:
-               BLI_addhead(&walker->states, newstate);
-               break;
-       case BMW_BREADTH_FIRST:
-               BLI_addtail(&walker->states, newstate);
-               break;
-       default:
-               BLI_assert(0);
-               break;
+               case BMW_DEPTH_FIRST:
+                       BLI_addhead(&walker->states, newstate);
+                       break;
+               case BMW_BREADTH_FIRST:
+                       BLI_addtail(&walker->states, newstate);
+                       break;
+               default:
+                       BLI_assert(0);
+                       break;
        }
        return newstate;
 }
index 1428c863a56be0f25a09afa0085f960f157464cb..aaa6575ca6e5f49307eba49d1ae75ba7de6ab9a9 100644 (file)
@@ -141,8 +141,9 @@ static void *shellWalker_step(BMWalker *walker)
        int restrictpass = 1;
        shellWalker shellWalk = *((shellWalker *)BMW_currentstate(walker));
        
-       if (!BLI_ghash_haskey(walker->visithash, shellWalk.base))
+       if (!BLI_ghash_haskey(walker->visithash, shellWalk.base)) {
                BLI_ghash_insert(walker->visithash, shellWalk.base, NULL);
+       }
 
        BMW_removestate(walker);
 
@@ -151,8 +152,8 @@ static void *shellWalker_step(BMWalker *walker)
        curedge = shellWalk.curedge;
        do {
                if (!BLI_ghash_haskey(walker->visithash, curedge)) {
-                       if (!walker->restrictflag || (walker->restrictflag &&
-                          BMO_TestFlag(walker->bm, curedge, walker->restrictflag)))
+                       if (!walker->restrictflag ||
+                           (walker->restrictflag && BMO_TestFlag(walker->bm, curedge, walker->restrictflag)))
                        {
                                shellWalker *newstate;
 
@@ -746,7 +747,7 @@ static void *edgeringWalker_step(BMWalker *walker)
 
        /* only walk to manifold edge */
        if ((l->f->len == 4) && !BM_Nonmanifold_Edge(bm, l->e) &&
-                !BLI_ghash_haskey(walker->visithash, l->e)) {
+           !BLI_ghash_haskey(walker->visithash, l->e)) {
                lwalk = BMW_addstate(walker);
                lwalk->l = l;
                lwalk->wireedge = NULL;
diff --git a/source/blender/bmesh/intern/editmesh_to_bmesh.c b/source/blender/bmesh/intern/editmesh_to_bmesh.c
deleted file mode 100644 (file)
index 641e051..0000000
+++ /dev/null
@@ -1,508 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor(s): Joseph Eagar, Geoffrey Bantle, Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/intern/editmesh_to_bmesh.c
- *  \ingroup bmesh
- *
- * Unused
- */
-
-#if 0
-
-#include "MEM_guardedalloc.h"
-#include "BKE_customdata.h" 
-#include "DNA_listBase.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
-#include <string.h>
-#include "BKE_utildefines.h"
-#include "BKE_mesh.h"
-#include "BKE_global.h"
-#include "BKE_DerivedMesh.h"
-#include "BKE_cdderivedmesh.h"
-
-#include "BLI_editVert.h"
-#include "mesh_intern.h"
-#include "ED_mesh.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_edgehash.h"
-#include "BLI_array.h"
-
-#include "bmesh.h"
-
-/*
- * EDITMESH TO BMESH.C
- *
- * This file contains functions
- * for converting an editmesh
- * into a Bmesh
- *
-*/
-
-/*
- * EDITMESH CORNERS TO LOOPS
- * 
- * Converts editmesh face corner data
- * (UVs, Vert colors, ect) to N-Gon 
- * face-edge ('loop') data.
- *
-*/
-
-static void editmesh_corners_to_loops(BMesh *bm, CustomData *facedata, void *face_block, BMFace *f,int numCol, int numTex)
-{
-       int i, j;
-       BMLoop *l;
-       MTFace *texface;
-       MTexPoly *texpoly;
-       MCol *mcol;
-       MLoopCol *mloopcol;
-       MLoopUV *mloopuv;
-       BMIter iter;
-
-       for(i=0; i < numTex; i++) {
-               texface = CustomData_em_get_n(facedata, face_block, CD_MTFACE, i);
-               texpoly = CustomData_bmesh_get_n(&bm->pdata, f->head.data, CD_MTEXPOLY, i);
-               
-               texpoly->tpage = texface->tpage;
-               texpoly->flag = texface->flag;
-               texpoly->transp = texface->transp;
-               texpoly->mode = texface->mode;
-               texpoly->tile = texface->tile;
-               texpoly->unwrap = texface->unwrap;
-               
-               for (j=0, l=BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, f); l; j++, l=BMIter_Step(&iter)) {
-                       mloopuv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i);
-                       mloopuv->uv[0] = texface->uv[j][0];
-                       mloopuv->uv[1] = texface->uv[j][1];
-               }
-
-       }
-       for(i=0; i < numCol; i++) {
-               mcol = CustomData_em_get_n(facedata, face_block, CD_MCOL, i);
-               for (j=0, l=BMIter_New(&iter, bm, BM_LOOPS_OF_FACE, f); l; j++, l=BMIter_Step(&iter)) {
-                       mloopcol = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPCOL, i);
-                       mloopcol->r = mcol[j].r;
-                       mloopcol->g = mcol[j].g;
-                       mloopcol->b = mcol[j].b;
-                       mloopcol->a = mcol[j].a;
-               }
-       }
-}
-
-/*
- * EDITVERT TO BMVert
- *
- * Converts an editvert to
- * a BMVert.
- *
-*/
-
-static BMVert *editvert_to_BMVert(BMesh *bm, BMOperator *op, EditMesh *em, EditVert *eve)
-{
-               BMVert *v = NULL;
-
-               v = BM_Make_Vert(bm, eve->co, NULL);
-               VECCOPY(v->no, eve->no);
-
-               /*transfer flags*/
-               v->head.flag = eve->h ? BM_HIDDEN : 0;
-               if(eve->f & SELECT) BM_Select_Vert(bm, v, TRUE);
-               v->bweight = eve->bweight;
-
-               BMO_Insert_MapPointer(bm, op, "map", eve, v);
-
-               /*Copy Custom Data*/
-               CustomData_bmesh_copy_data(&em->vdata, &bm->vdata, eve->data, &v->head.data);
-               
-               return v;
-}      
-
-/*
- * EDITEDGE TO BMEdge
- *
- * Converts an editedge to 
- * a BMEdge
- *
-*/
-
-static void editedge_to_BMEdge_internal(BMesh *bm, BMOperator *op, EditMesh *em, BMEdge *e, EditEdge *eed)
-{
-       e->crease = eed->crease;
-       e->bweight = eed->bweight;
-       
-       BM_Select(bm, e, eed->f & SELECT);
-       e->head.flag |= eed->seam ? BM_SEAM : 0;
-       e->head.flag |= eed->h & 1 ? BM_HIDDEN : 0;
-       e->head.flag |= eed->h & EM_FGON ? BM_FGON : 0;
-       e->head.flag |= eed->sharp ? BM_SHARP : 0;
-
-       CustomData_bmesh_copy_data(&em->edata, &bm->edata, eed->data, &e->head.data);
-
-       BMO_Insert_MapPointer(bm, op, "map", eed, e);
-}
-
-static BMEdge *editedge_to_BMEdge(BMesh *bm, BMOperator *op, EditMesh *em, EditEdge *eed)
-{
-               BMVert *v1 = NULL, *v2 = NULL;
-               BMEdge *e = NULL;
-               
-               v1 = eed->v1->tmp.p;
-               v2 = eed->v2->tmp.p;
-       
-               e = BM_Make_Edge(bm, v1, v2,NULL, FALSE);
-
-               editedge_to_BMEdge_internal(bm, op, em, e, eed);
-
-               return e;
-}
-/*
- * EDITFACE TO BMFace
- *
- * Converts an editface to a BMFace.
- * Note that this also convert per-face
- * corner data as well.
- *
-*/
-
-static BMFace *editface_to_BMFace(BMesh *bm, BMOperator *op, EditMesh *em, EditFace *efa, int numCol, int numTex)
-{
-               BMVert *v1 = NULL, *v2 = NULL;
-               BMFace *f = NULL;
-               BMEdge *edar[4];
-               int len;
-
-               edar[0] = BM_Make_Edge(bm, efa->v1->tmp.p, efa->v2->tmp.p, NULL, 1); 
-               edar[1] = BM_Make_Edge(bm, efa->v2->tmp.p, efa->v3->tmp.p, NULL, 1); 
-               if(efa->v4) {
-                       edar[2] = BM_Make_Edge(bm, efa->v3->tmp.p, efa->v4->tmp.p, NULL, 1); 
-                       edar[3] = BM_Make_Edge(bm, efa->v4->tmp.p, efa->v1->tmp.p, NULL, 1); 
-               }
-               else {
-                       edar[2] = BM_Make_Edge(bm, efa->v3->tmp.p, efa->v1->tmp.p, NULL, 1); 
-               }
-
-               editedge_to_BMEdge_internal(bm, op, em, edar[0], efa->e1);
-               editedge_to_BMEdge_internal(bm, op, em, edar[1], efa->e2);
-               editedge_to_BMEdge_internal(bm, op, em, edar[2], efa->e3);
-               if(efa->v4)
-                       editedge_to_BMEdge_internal(bm, op, em, edar[3], efa->e4);
-
-
-               if(efa->e1->fgoni) edar[0]->head.flag |= BM_FGON;
-               if(efa->e2->fgoni) edar[1]->head.flag |= BM_FGON;
-               if(efa->e3->fgoni) edar[2]->head.flag |= BM_FGON;
-               if(efa->v4 && efa->e4->fgoni) edar[3]->head.flag |= BM_FGON;
-
-               if(efa->v4) len = 4;
-               else len = 3;
-
-               /*find v1 and v2*/
-               v1 = efa->v1->tmp.p;
-               v2 = efa->v2->tmp.p;
-
-               f = BM_Make_Ngon(bm, v1, v2, edar, len, 0);
-               
-               VECCOPY(f->no, efa->n);
-
-               BMO_Insert_MapPointer(bm, op, "map", efa, f);
-
-               f->head.flag = 0;
-               f->mat_nr = efa->mat_nr;
-               if(efa->f & SELECT) BM_Select_Face(bm, f, TRUE);
-               if (efa->flag & ME_SMOOTH) f->head.flag |= BM_SMOOTH;
-               if(efa->h) f->head.flag |= BM_HIDDEN;
-
-               if (efa == em->act_face) f->head.flag |= BM_ACTIVE;
-               
-               CustomData_bmesh_copy_data(&em->fdata, &bm->pdata, efa->data, &f->head.data);
-               editmesh_corners_to_loops(bm, &em->fdata, efa->data, f,numCol,numTex);
-
-               return f;
-}
-
-/*
- * BMESH FGONCONVERT
- *
- * This function and its associated structures
- * /helpers (fgonsort, sortfgon, fuse_fgon) are
- * used to convert f-gons to bmesh n-gons. This
- * is accomplished by sorting a list of fgon faces
- * such that faces that are part of the same fgon
- * are next to each other. These faces are then
- * converted as is into bmesh faces and
- * fused togather.
- *
- * Note that currently, there is no support for 
- * holes in faces in the bmesh structure, so 
- * f-gons with holes will only partially convert.
- *
-*/
-
-typedef struct fgonsort {
-       unsigned long x;
-       struct EditFace *efa;
-       struct BMFace *f;
-       int done;
-}fgonsort;
-
-static int sortfgon(const void *v1, const void *v2)
-{
-       const struct fgonsort *x1=v1, *x2=v2;
-       
-       if( x1->x > x2->x ) return 1;
-       else if( x1->x < x2->x) return -1;
-       return 0;
-}
-
-static void fuse_fgon(BMesh *bm, BMFace *f)
-{
-       BMFace *sf;
-       BMLoop *l;
-       int done, act=0;
-
-       sf = f;
-       done = 0;
-       while(!done) {
-               done = 1;
-               l = sf->loopbase;
-               do{
-                       if(l->e->head.flag & BM_FGON) { 
-                               if (l->f->head.flag & BM_ACTIVE) act = BM_ACTIVE;
-                               if (l->radial.next->data->f->head.flag & BM_ACTIVE) act = BM_ACTIVE;
-
-                               sf = BM_Join_TwoFaces(bm,l->f, l->radial.next->data->f, l->e);
-                               if (!sf) {
-                                       //tesselation error
-                                       break;
-                               }
-
-                               sf->head.flag |= act;
-                               if(sf) {
-                                       done = 0;
-                                       break;
-                               } else { /*we have to get out of here...*/
-                                       return;
-                               }
-                       }
-                       l = l->next;
-               } while(l != sf->loopbase);
-       }
-}
-
-static BM_fgonconvert(BMesh *bm, BMOperator *op, EditMesh *em, int numCol, int numTex)
-{
-       EditFace *efa;
-       BMFace *f;
-       BMIter iter;
-       struct fgonsort *sortblock, *sb, *sb1;
-       int a, b, amount=0;
-       
-       /*
-       for (efa=em->faces.first; efa; efa=efa->next) {
-               f = editface_to_BMFace(bm, em, efa, numCol, numTex);
-       }
-
-       for (f=bm->polys.first; f; f=f->next) {
-               fuse_fgon(bm, f);
-       }
-
-       return;*/
-
-       EM_fgon_flags(em);
-
-       /*zero out efa->tmp, we store fgon index here*/
-       for(efa = em->faces.first; efa; efa = efa->next) {
-               efa->tmp.l = 0;
-               amount++;
-       }
-       /*go through and give each editface an fgon index*/
-       for(efa = em->faces.first; efa; efa = efa->next) {
-               if(efa->e1->fgoni) efa->tmp.l = efa->e1->fgoni;
-               else if(efa->e2->fgoni) efa->tmp.l = efa->e2->fgoni;
-               else if(efa->e3->fgoni) efa->tmp.l = efa->e3->fgoni;
-               else if(efa->e4 && efa->e4->fgoni) efa->tmp.l = efa->e4->fgoni;
-       }
-
-       sb= sortblock= MEM_mallocN(sizeof(fgonsort)* amount,"fgon sort block");
-
-       for(efa = em->faces.first; efa; efa=efa->next) {
-               sb->x = efa->tmp.l;
-               sb->efa = efa;
-               sb->done = 0;
-               sb++;
-       }
-
-       qsort(sortblock, amount, sizeof(fgonsort), sortfgon);
-
-       sb = sortblock;
-       for(a=0; a<amount; a++, sb++) {
-               if(sb->x && sb->done == 0) {
-                       /*first pass: add in faces for this fgon*/
-                       for(b=a, sb1 = sb; b<amount && sb1->x == sb->x; b++, sb1++) {
-                               efa = sb1->efa;
-                               sb1->f = editface_to_BMFace(bm, op, em, efa, numCol, numTex);
-                               sb1->done = 1;
-                       }
-                       /*fuse fgon*/
-                       fuse_fgon(bm, sb->f);
-               }
-       }
-       MEM_freeN(sortblock);
-}
-
-/*
- * TAG WIRE EDGES
- *
- * Flags editedges 'f1' member
- * if the edge has no faces.
- *
-*/
-
-static void tag_wire_edges(EditMesh *em)
-{
-       EditFace *efa;
-       EditEdge *eed;
-       for(eed = em->edges.first; eed; eed = eed->next) eed->f1 = 1;
-       for(efa = em->faces.first; efa; efa = efa->next) {
-               efa->e1->f1 = 0;
-               efa->e2->f1 = 0;
-               efa->e3->f1 = 0;
-               if(efa->e4) efa->e4->f1 = 0;
-       }
-}
-
-/*
- * EDITMESH TO BMESH
- *
- * Function to convert an editmesh to a bmesh
- * Currently all custom data as well as 
- * f-gons should be converted correctly.
- *
-*/
-
-BMesh *editmesh_to_bmesh_intern(EditMesh *em, BMesh *bm, BMOperator *op)
-{
-       BMVert *v;
-       EditVert *eve;
-       EditEdge *eed;
-       EditFace *efa;
-       BMEdge *e;
-       BMIter iter;
-       int allocsize[4] = {512,512,2048,512}, numTex, numCol;
-
-       /*make sure to update FGon flags*/
-       EM_fgon_flags(em);
-
-       /*copy custom data layout*/
-       CustomData_copy(&em->vdata, &bm->vdata, CD_MASK_BMESH, CD_CALLOC, 0);
-       CustomData_copy(&em->edata, &bm->edata, CD_MASK_BMESH, CD_CALLOC, 0);
-       CustomData_copy(&em->fdata, &bm->pdata, CD_MASK_BMESH, CD_CALLOC, 0);
-
-       /*copy face corner data*/
-       CustomData_to_bmeshpoly(&em->fdata, &bm->pdata, &bm->ldata, 0, 0);
-       
-       CustomData_bmesh_init_pool(&bm->vdata, allocsize[0]);
-       CustomData_bmesh_init_pool(&bm->edata, allocsize[1]);
-       CustomData_bmesh_init_pool(&bm->ldata, allocsize[2]);
-       CustomData_bmesh_init_pool(&bm->pdata, allocsize[3]);
-
-       /*needed later*/
-       numTex = CustomData_number_of_layers(&bm->pdata, CD_MTEXPOLY);
-       numCol = CustomData_number_of_layers(&bm->ldata, CD_MLOOPCOL);
-
-       /*copy over selection mode*/
-       bm->selectmode = 0;
-       if(em->selectmode & SCE_SELECT_VERTEX) bm->selectmode |= SCE_SELECT_VERTEX;
-       if(em->selectmode & SCE_SELECT_EDGE) bm->selectmode |= SCE_SELECT_EDGE;
-       if(em->selectmode & SCE_SELECT_FACE) bm->selectmode |= SCE_SELECT_FACE;
-
-
-       /*begin editloop*/
-       //BM_Begin_Edit(bm);
-
-       /*tag wire edges*/
-       tag_wire_edges(em);
-
-       /*add verts*/
-       for(eve = em->verts.first; eve; eve = eve->next) {
-               v = editvert_to_BMVert(bm, op, em, eve);
-               eve->tmp.p = v;
-       }
-       /*convert f-gons*/
-       BM_fgonconvert(bm, op, em, numCol, numTex);
-       
-       /*clean up any dangling fgon flags*/
-       for (e=BMIter_New(&iter, bm, BM_EDGES_OF_MESH, NULL); e; e=BMIter_Step(&iter)) {
-               e->head.flag &= ~BM_FGON;
-       }
-
-       /*do quads + triangles*/
-       for(efa = em->faces.first; efa; efa = efa->next) {
-               if(!efa->tmp.l) editface_to_BMFace(bm, op, em, efa, numCol, numTex);
-       }
-
-       /*add wire edges*/      
-       for(eed = em->edges.first; eed; eed = eed->next) {
-               if(eed->f1) editedge_to_BMEdge(bm, op, em, eed);
-       }
-       //BM_end_edit(bm, BM_CALC_NORM);
-       return bm;
-}
-
-void edit2bmesh_exec(BMesh *bmesh, BMOperator *op)
-{
-       editmesh_to_bmesh_intern(BMO_Get_Pnt(op, "em"), bmesh, op);
-}
-
-BMesh *editmesh_to_bmesh(EditMesh *em)
-{
-       BMOperator conv;
-       BMesh *bm;
-       int allocsize[4] = {512,512,2048,512};
-
-       /*allocate a bmesh*/
-       bm = BM_Make_Mesh(allocsize);
-
-       BMO_Init_Op(&conv, "editmesh_to_bmesh");
-       BMO_Set_Pnt(&conv, "em", em);
-       BMO_Exec_Op(bm, &conv);
-       BMO_Finish_Op(bm, &conv);
-
-       return bm;
-}
-
-BMesh *init_editmesh_to_bmesh(EditMesh *em, BMOperator *op)
-{
-       BMesh *bm;
-       int allocsize[4] = {512,512,2048,512}, numTex, numCol;
-
-       /*allocate a bmesh*/
-       bm = BM_Make_Mesh(allocsize);
-
-       BMO_Init_Op(op, "editmesh_to_bmesh");
-       BMO_Set_Pnt(op, "em", em);
-
-       return bm;
-}
-#endif