bmesh api cleanup, face creation args now accept an example face (as with vertex...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 21 Aug 2013 07:51:47 +0000 (07:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 21 Aug 2013 07:51:47 +0000 (07:51 +0000)
also replace BM_face_create_quad_tri_v with BM_face_create_verts

24 files changed:
source/blender/blenkernel/intern/modifiers_bmesh.c
source/blender/blenkernel/intern/pbvh_bmesh.c
source/blender/bmesh/bmesh.h
source/blender/bmesh/intern/bmesh_construct.c
source/blender/bmesh/intern/bmesh_construct.h
source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_core.h
source/blender/bmesh/intern/bmesh_log.c
source/blender/bmesh/intern/bmesh_mesh_conv.c
source/blender/bmesh/operators/bmo_bridge.c
source/blender/bmesh/operators/bmo_create.c
source/blender/bmesh/operators/bmo_dupe.c
source/blender/bmesh/operators/bmo_extrude.c
source/blender/bmesh/operators/bmo_fill_edgeloop.c
source/blender/bmesh/operators/bmo_fill_grid.c
source/blender/bmesh/operators/bmo_hull.c
source/blender/bmesh/operators/bmo_inset.c
source/blender/bmesh/operators/bmo_removedoubles.c
source/blender/bmesh/operators/bmo_symmetrize.c
source/blender/bmesh/tools/bmesh_bevel.c
source/blender/bmesh/tools/bmesh_edgenet.c
source/blender/editors/mesh/editmesh_rip.c
source/blender/modifiers/intern/MOD_skin.c
source/blender/python/bmesh/bmesh_py_types.c

index 290b0684e4047ea0656df99b7782e05399ea13ed..d1797810c8682482c15c333d24f6b5a36d898ad5 100644 (file)
@@ -52,7 +52,7 @@ static BMFace *bm_face_create_from_mpoly(MPoly *mp, MLoop *ml,
                edges[j] = etable[ml->e];
        }
 
-       return BM_face_create(bm, verts, edges, mp->totloop, BM_CREATE_SKIP_CD);
+       return BM_face_create(bm, verts, edges, mp->totloop, NULL, BM_CREATE_SKIP_CD);
 }
 
 /**
index f16c1902b326c2b1e0e8e77ad26cfcd761507572..c9b68931142ec0dfd39bab36c4d9e0845a2806c8 100644 (file)
@@ -302,9 +302,7 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
        /* ensure we never add existing face */
        BLI_assert(BM_face_exists(v_tri, 3, NULL) == false);
 
-       f = BM_face_create(bvh->bm, v_tri, e_tri, 3, BM_CREATE_NOP);
-       // BM_elem_attrs_copy(bvh->bm, bvh->bm, f_example, f);
-       f->mat_nr = f_example->mat_nr;
+       f = BM_face_create(bvh->bm, v_tri, e_tri, 3, f_example, BM_CREATE_NOP);
 
        if (!BLI_ghash_haskey(bvh->bm_face_to_node, f)) {
 
index 1f7c9ee97f62018a8fa9a1326f1d4d1d1ba7e869..5bde354f4e82b92166ab880bfe1ba49e49a0fd48 100644 (file)
@@ -251,8 +251,8 @@ extern "C" {
 #include "intern/bmesh_operator_api.h"
 #include "intern/bmesh_error.h"
 
-#include "intern/bmesh_construct.h"
 #include "intern/bmesh_core.h"
+#include "intern/bmesh_construct.h"
 #include "intern/bmesh_edgeloop.h"
 #include "intern/bmesh_interp.h"
 #include "intern/bmesh_iterators.h"
index 0708b174b2b9c9892762d460e428be82804a17ec..3df5cab03404ed724efd40cebf9580f380ed292a 100644 (file)
@@ -65,64 +65,10 @@ static void bm_loop_attrs_copy(BMesh *source_mesh, BMesh *target_mesh,
 
 BMFace *BM_face_create_quad_tri(BMesh *bm,
                                 BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
-                                const BMFace *example, const bool no_double)
+                                const BMFace *f_example, const eBMCreateFlag create_flag)
 {
        BMVert *vtar[4] = {v1, v2, v3, v4};
-       return BM_face_create_quad_tri_v(bm, vtar, v4 ? 4 : 3, example, no_double);
-}
-
-BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFace *example, const bool no_double)
-{
-       BMFace *f = NULL;
-       bool is_overlap = false;
-
-       /* sanity check - debug mode only */
-       if (len == 3) {
-               BLI_assert(verts[0] != verts[1]);
-               BLI_assert(verts[0] != verts[2]);
-               BLI_assert(verts[1] != verts[2]);
-       }
-       else if (len == 4) {
-               BLI_assert(verts[0] != verts[1]);
-               BLI_assert(verts[0] != verts[2]);
-               BLI_assert(verts[0] != verts[3]);
-
-               BLI_assert(verts[1] != verts[2]);
-               BLI_assert(verts[1] != verts[3]);
-
-               BLI_assert(verts[2] != verts[3]);
-       }
-       else {
-               BLI_assert(0);
-       }
-
-
-       if (no_double) {
-               /* check if face exists or overlaps */
-               is_overlap = BM_face_exists(verts, len, &f);
-       }
-
-       /* make new face */
-       if ((f == NULL) && (!is_overlap)) {
-               BMEdge *edar[4] = {NULL};
-               edar[0] = BM_edge_create(bm, verts[0], verts[1], NULL, BM_CREATE_NO_DOUBLE);
-               edar[1] = BM_edge_create(bm, verts[1], verts[2], NULL, BM_CREATE_NO_DOUBLE);
-               if (len == 4) {
-                       edar[2] = BM_edge_create(bm, verts[2], verts[3], NULL, BM_CREATE_NO_DOUBLE);
-                       edar[3] = BM_edge_create(bm, verts[3], verts[0], NULL, BM_CREATE_NO_DOUBLE);
-               }
-               else {
-                       edar[2] = BM_edge_create(bm, verts[2], verts[0], NULL, BM_CREATE_NO_DOUBLE);
-               }
-
-               f = BM_face_create(bm, verts, edar, len, BM_CREATE_NOP);
-
-               if (example && f) {
-                       BM_elem_attrs_copy(bm, bm, example, f);
-               }
-       }
-
-       return f;
+       return BM_face_create_verts(bm, vtar, v4 ? 4 : 3, f_example, create_flag, true);
 }
 
 /**
@@ -199,7 +145,8 @@ void BM_face_copy_shared(BMesh *bm, BMFace *f,
  * #BM_face_create should be considered over this function as it
  * avoids some unnecessary work.
  */
-BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len, const int create_flag)
+BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len,
+                            const BMFace *f_example, const eBMCreateFlag create_flag)
 {
        BMEdge **edges_sort = BLI_array_alloca(edges_sort, len);
        BMVert **verts_sort = BLI_array_alloca(verts_sort, len + 1);
@@ -318,7 +265,7 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, c
                BM_ELEM_API_FLAG_DISABLE(verts_sort[i], _FLAG_MV);
        }
 
-       f = BM_face_create(bm, verts_sort, edges_sort, len, create_flag);
+       f = BM_face_create(bm, verts_sort, edges_sort, len, f_example, create_flag);
 
        /* clean up flags */
        for (i = 0; i < len; i++) {
@@ -346,7 +293,8 @@ err:
  * - Optionally create edges between vertices.
  * - Uses verts so no need to find edges (handy when you only have verts)
  */
-BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, const int create_flag,
+BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len,
+                                  const BMFace *f_example, const eBMCreateFlag create_flag,
                                   const bool calc_winding, const bool create_edges)
 {
        BMEdge **edge_arr = BLI_array_alloca(edge_arr, len);
@@ -406,7 +354,8 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, c
                bm,
                v_winding[winding[0]],
                v_winding[winding[1]],
-               edge_arr, len, create_flag);
+               edge_arr, len,
+               f_example, create_flag);
 }
 
 
@@ -439,7 +388,8 @@ static int angle_index_pair_cmp(const void *e1, const void *e2)
  *
  * \note Since this is a vcloud there is no direction.
  */
-BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, const int create_flag)
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
+                                   const BMFace *f_example, const eBMCreateFlag create_flag)
 {
        AngleIndexPair *vang = BLI_array_alloca(vang, len);
        BMVert **vert_arr_map = BLI_array_alloca(vert_arr_map, len);
@@ -552,7 +502,7 @@ BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, const
                vert_arr_map[i] = vert_arr[vang[i].index];
        }
 
-       f = BM_face_create_ngon_verts(bm, vert_arr_map, len, create_flag, true, true);
+       f = BM_face_create_ngon_verts(bm, vert_arr_map, len, f_example, create_flag, true, true);
 
        return f;
 }
@@ -923,7 +873,7 @@ static BMFace *bm_mesh_copy_new_face(BMesh *bm_new, BMesh *bm_old,
                j++;
        } while ((l_iter = l_iter->next) != l_first);
 
-       f_new = BM_face_create(bm_new, verts, edges, f->len, BM_CREATE_SKIP_CD);
+       f_new = BM_face_create(bm_new, verts, edges, f->len, NULL, BM_CREATE_SKIP_CD);
 
        if (UNLIKELY(f_new == NULL)) {
                return NULL;
index 92ed330752394ad4ae1a21074947de11be3594b2..e85c97dffd9af67906d60f6b318b089e3ee82bfe 100644 (file)
 
 struct BMAllocTemplate;
 
-BMFace *BM_face_create_quad_tri_v(BMesh *bm,
-                                  BMVert **verts, int len,
-                                  const BMFace *example, const bool no_double);
-
 BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v1, BMVert *v2, BMVert *v3, BMVert *v4,
-                                const BMFace *example, const bool no_double);
+                                const BMFace *f_example, const eBMCreateFlag create_flag);
 
 void BM_face_copy_shared(BMesh *bm, BMFace *f,
                          BMElemFilterFunc filter_fn, void *user_data);
 
-BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len, const int create_flag);
-BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len, const int create_flag,
+BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, const int len,
+                            const BMFace *f_example, const eBMCreateFlag create_flag);
+BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, const int len,
+                                  const BMFace *f_example, const eBMCreateFlag create_flag,
                                   const bool calc_winding, const bool create_edges);
 
-BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len, const int create_flag);
+BMFace *BM_face_create_ngon_vcloud(BMesh *bm, BMVert **vert_arr, int len,
+                                   const BMFace *f_example, const eBMCreateFlag create_flag);
 
 void BMO_remove_tagged_faces(BMesh *bm, const short oflag);
 void BMO_remove_tagged_edges(BMesh *bm, const short oflag);
index 0d36377e6dfc50d1e270b358ac9de78d6f0a7741..892e11838891e7bc0af48b188fcf12a8537669b7 100644 (file)
@@ -56,7 +56,8 @@
 /**
  * \brief Main function for creating a new vertex.
  */
-BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, const eBMCreateFlag create_flag)
+BMVert *BM_vert_create(BMesh *bm, const float co[3],
+                       const BMVert *v_example, const eBMCreateFlag create_flag)
 {
        BMVert *v = BLI_mempool_calloc(bm->vpool);
 
@@ -86,10 +87,10 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, cons
        }
 
        if (!(create_flag & BM_CREATE_SKIP_CD)) {
-               if (example) {
+               if (v_example) {
                        int *keyi;
 
-                       BM_elem_attrs_copy(bm, bm, example, v);
+                       BM_elem_attrs_copy(bm, bm, v_example, v);
 
                        /* exception: don't copy the original shapekey index */
                        keyi = CustomData_bmesh_get(&bm->vdata, v->head.data, CD_SHAPE_KEYINDEX);
@@ -113,7 +114,8 @@ BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, cons
  * \note Duplicate edges are supported by the API however users should _never_ see them.
  * so unless you need a unique edge or know the edge won't exist, you should call with \a no_double = true
  */
-BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, const eBMCreateFlag create_flag)
+BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
+                       const BMEdge *e_example, const eBMCreateFlag create_flag)
 {
        BMEdge *e;
        
@@ -148,8 +150,8 @@ BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example,
        bmesh_disk_edge_append(e, e->v2);
        
        if (!(create_flag & BM_CREATE_SKIP_CD)) {
-               if (example) {
-                       BM_elem_attrs_copy(bm, bm, example, e);
+               if (e_example) {
+                       BM_elem_attrs_copy(bm, bm, e_example, e);
                }
                else {
                        CustomData_bmesh_set_default(&bm->edata, &e->head.data);
@@ -190,7 +192,8 @@ static BMLoop *bm_loop_create(BMesh *bm, BMVert *v, BMEdge *e, BMFace *f,
        return l;
 }
 
-static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte, const int create_flag)
+static BMLoop *bm_face_boundary_add(BMesh *bm, BMFace *f, BMVert *startv, BMEdge *starte,
+                                    const eBMCreateFlag create_flag)
 {
 #ifdef USE_BMESH_HOLES
        BMLoopList *lst = BLI_mempool_calloc(bm->looplistpool);
@@ -251,7 +254,7 @@ BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f,
                                v1 = verts[(i + 1) % f->len];
                        }
                        
-                       edges[i] = BM_edge_create(bm_dst,  v1, v2, l_iter->e, BM_CREATE_NOP);
+                       edges[i] = BM_edge_create(bm_dst, v1, v2, l_iter->e, BM_CREATE_NOP);
                }
                else {
                        edges[i] = l_iter->e;
@@ -259,7 +262,7 @@ BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f,
                i++;
        } while ((l_iter = l_iter->next) != l_first);
        
-       f_copy = BM_face_create(bm_dst, verts, edges, f->len, BM_CREATE_SKIP_CD);
+       f_copy = BM_face_create(bm_dst, verts, edges, f->len, NULL, BM_CREATE_SKIP_CD);
        
        BM_elem_attrs_copy(bm_src, bm_dst, f, f_copy);
        
@@ -320,11 +323,12 @@ BLI_INLINE BMFace *bm_face_create__internal(BMesh *bm, const eBMCreateFlag creat
  * \param len  Length of the face
  * \param create_flag  Options for creating the face
  */
-BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const eBMCreateFlag create_flag)
+BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
+                       const BMFace *f_example, const eBMCreateFlag create_flag)
 {
        BMFace *f = NULL;
        BMLoop *l, *startl, *lastl;
-       int i, overlap;
+       int i;
        
        if (len == 0) {
                /* just return NULL for now */
@@ -333,8 +337,8 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
 
        if (create_flag & BM_CREATE_NO_DOUBLE) {
                /* Check if face already exists */
-               overlap = BM_face_exists(verts, len, &f);
-               if (overlap) {
+               const bool is_overlap = BM_face_exists(verts, len, &f);
+               if (is_overlap) {
                        return f;
                }
                else {
@@ -364,6 +368,15 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
        
        f->len = len;
        
+       if (!(create_flag & BM_CREATE_SKIP_CD)) {
+               if (f_example) {
+                       BM_elem_attrs_copy(bm, bm, f_example, f);
+               }
+               else {
+                       CustomData_bmesh_set_default(&bm->pdata, &f->head.data);
+               }
+       }
+
        BM_CHECK_ELEMENT(f);
 
        return f;
@@ -372,8 +385,8 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
 /**
  * Wrapper for #BM_face_create when you don't have an edge array
  */
-BMFace *BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const eBMCreateFlag create_flag,
-                             const bool create_edges)
+BMFace *BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len,
+                             const BMFace *f_example, const eBMCreateFlag create_flag, const bool create_edges)
 {
        BMEdge **edge_arr = BLI_array_alloca(edge_arr, len);
        int i, i_prev = len - 1;
@@ -392,7 +405,7 @@ BMFace *BM_face_create_verts(BMesh *bm, BMVert **vert_arr, const int len, const
                i_prev = i;
        }
 
-       return BM_face_create(bm, vert_arr, edge_arr, len, create_flag);
+       return BM_face_create(bm, vert_arr, edge_arr, len, f_example, create_flag);
 }
 
 #ifndef NDEBUG
@@ -1079,7 +1092,7 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
        }
 
        /* create region face */
-       f_new = tote ? BM_face_create_ngon(bm, v1, v2, edges, tote, BM_CREATE_NOP) : NULL;
+       f_new = tote ? BM_face_create_ngon(bm, v1, v2, edges, tote, faces[0], BM_CREATE_NOP) : NULL;
        if (UNLIKELY(!f_new || BMO_error_occurred(bm))) {
                if (!BMO_error_occurred(bm))
                        err = N_("Invalid boundary region to join faces");
@@ -1106,8 +1119,6 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
                        BM_elem_attrs_copy(bm, bm, l2, l_iter);
                }
        } while ((l_iter = l_iter->next) != l_first);
-       
-       BM_elem_attrs_copy(bm, bm, faces[0], f_new);
 
 #ifdef USE_BMESH_HOLES
        /* add holes */
index f12be2ed16d13d6c6fd4f797dfb8fa0458886159..a18c2ebd32c746730a0922e882072ec9b3dc6e97 100644 (file)
@@ -40,10 +40,14 @@ typedef enum eBMCreateFlag {
        BM_CREATE_SKIP_CD   = (1 << 2),
 } eBMCreateFlag;
 
-BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *example, const eBMCreateFlag create_flag);
-BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *example, const eBMCreateFlag create_flag);
-BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len, const eBMCreateFlag create_flag);
-BMFace *BM_face_create_verts(BMesh *bm, BMVert **verts, const int len, const eBMCreateFlag create_flag,
+BMVert *BM_vert_create(BMesh *bm, const float co[3],
+                       const BMVert *v_example, const eBMCreateFlag create_flag);
+BMEdge *BM_edge_create(BMesh *bm, BMVert *v1, BMVert *v2,
+                       const BMEdge *e_example, const eBMCreateFlag create_flag);
+BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
+                       const BMFace *f_example, const eBMCreateFlag create_flag);
+BMFace *BM_face_create_verts(BMesh *bm, BMVert **verts, const int len,
+                             const BMFace *f_example, const eBMCreateFlag create_flag,
                              const bool create_edges);
 
 void    BM_face_edges_kill(BMesh *bm, BMFace *f);
index c80592695e2abee9cde7aa56f6be54557f48e0d1..1309aa6543d193e5e45e5f855efd78be936a50de 100644 (file)
@@ -294,7 +294,7 @@ static void bm_log_faces_restore(BMesh *bm, BMLog *log, GHash *faces)
                                bm_log_vert_from_id(log, lf->v_ids[2])};
                BMFace *f;
 
-               f = BM_face_create_quad_tri_v(bm, v, 3, NULL, false);
+               f = BM_face_create_verts(bm, v, 3, NULL, BM_CREATE_NOP, true);
                bm_log_face_id_set(log, f, GET_INT_FROM_POINTER(key));
        }
 }
index 81d4aad0fdfd58c5f2515fff14c8be3e7b610db4..d92fe45afcd21df6f61bc4f356534878dc0bc76a 100644 (file)
@@ -212,7 +212,7 @@ static BMFace *bm_face_create_from_mpoly(MPoly *mp, MLoop *ml,
                edges[j] = etable[ml->e];
        }
 
-       return BM_face_create(bm, verts, edges, mp->totloop, BM_CREATE_SKIP_CD);
+       return BM_face_create(bm, verts, edges, mp->totloop, NULL, BM_CREATE_SKIP_CD);
 }
 
 
index 7f6b5739a582834b7b4698c3037bc376ad48ef7c..9381fabacf2c16c626c0a9917f515ae50f94441a 100644 (file)
@@ -343,7 +343,7 @@ static void bridge_loop_pair(BMesh *bm,
                                BMVert *v_arr[4] = {v_a, v_b, v_b_next, v_a_next};
                                if (BM_face_exists(v_arr, 4, &f) == false) {
                                        /* copy if loop data if its is missing on one ring */
-                                       f = BM_face_create_verts(bm, v_arr, 4, BM_CREATE_NOP, true);
+                                       f = BM_face_create_verts(bm, v_arr, 4, NULL, BM_CREATE_NOP, true);
 
                                        l_iter = BM_FACE_FIRST_LOOP(f);
                                        if (l_b)      BM_elem_attrs_copy(bm, bm, l_b,      l_iter); l_iter = l_iter->next;
@@ -356,7 +356,7 @@ static void bridge_loop_pair(BMesh *bm,
                                BMVert *v_arr[3] = {v_a, v_b, v_a_next};
                                if (BM_face_exists(v_arr, 3, &f) == false) {
                                        /* fan-fill a triangle */
-                                       f = BM_face_create_verts(bm, v_arr, 3, BM_CREATE_NOP, true);
+                                       f = BM_face_create_verts(bm, v_arr, 3, NULL, BM_CREATE_NOP, true);
 
                                        l_iter = BM_FACE_FIRST_LOOP(f);
                                        if (l_b)      BM_elem_attrs_copy(bm, bm, l_b,      l_iter); l_iter = l_iter->next;
index 3b403ca800ea7fa6288182138daa81843bb0aa32..dd814fa8bfbfd72c47db5b8574c7d50d46685173 100644 (file)
@@ -283,7 +283,7 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op)
                BMFace *f;
 
                BMO_iter_as_array(op->slots_in, "geom", BM_VERT, (void **)vert_arr, totv);
-               f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, BM_CREATE_NO_DOUBLE);
+               f = BM_face_create_ngon_vcloud(bm, vert_arr, totv, NULL, BM_CREATE_NO_DOUBLE);
 
                if (f) {
                        BMO_elem_flag_enable(bm, f, ELE_OUT);
index 1dc7b0a414db38565cf312000fb7e712a9b51769..7c73f9cfbc3ec75154871c6fe8e8fe0aa53ae6d7 100644 (file)
@@ -156,12 +156,10 @@ static BMFace *copy_face(BMOperator *op,
        }
 
        /* create new face */
-       target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, BM_CREATE_SKIP_CD);
+       target_face = BM_face_create(target_mesh, vtar, edar, source_face->len, source_face, BM_CREATE_SKIP_CD);
        BMO_slot_map_elem_insert(op, slot_facemap_out, source_face, target_face);
        BMO_slot_map_elem_insert(op, slot_facemap_out, target_face, source_face);
 
-       BM_elem_attrs_copy(source_mesh, target_mesh, source_face, target_face);
-
        /* mark the face for output */
        BMO_elem_flag_enable(target_mesh, target_face, DUPE_NEW);
        
index e80a093cb08b16a291ff7891a66888e2f092ee46..c6808da1bb8e7702e1b26127ed6dea679fee63bb 100644 (file)
@@ -77,7 +77,7 @@ void bmo_extrude_discrete_faces_exec(BMesh *bm, BMOperator *op)
 
                        f_side = BM_face_create_quad_tri(bm,
                                                         l_org->next->v, l_new->next->v, l_new->v, l_org->v,
-                                                        f_org, false);
+                                                        f_org, BM_CREATE_NOP);
 
                        l_side_iter = BM_FACE_FIRST_LOOP(f_side);
 
@@ -185,7 +185,7 @@ void bmo_extrude_edge_only_exec(BMesh *bm, BMOperator *op)
                        f_verts[3] = e_new->v2;
                }
                /* not sure what to do about example face, pass NULL for now */
-               f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, false);
+               f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true);
                bm_extrude_copy_face_loop_attributes(bm, f);
                
                if (BMO_elem_flag_test(bm, e, EXT_INPUT))
@@ -401,7 +401,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op)
                }
 
                /* not sure what to do about example face, pass NULL for now */
-               f = BM_face_create_quad_tri_v(bm, f_verts, 4, NULL, false);
+               f = BM_face_create_verts(bm, f_verts, 4, NULL, BM_CREATE_NOP, true);
                bm_extrude_copy_face_loop_attributes(bm, f);
        }
 
index 1e38205a1b7d786f62ae56712a5688aa16527ae8..0fbaf5ff11a7222c91921a1a54ee78d5ca17654f 100644 (file)
@@ -140,7 +140,7 @@ void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
                                BMFace *f;
 
                                /* don't use calc_edges option because we already have the edges */
-                               f = BM_face_create_ngon_verts(bm, f_verts, i, BM_CREATE_NOP, true, false);
+                               f = BM_face_create_ngon_verts(bm, f_verts, i, NULL, BM_CREATE_NOP, true, false);
                                BMO_elem_flag_enable(bm, f, ELE_OUT);
                                f->mat_nr = mat_nr;
                                if (use_smooth) {
index 730c45ce88c2e74388d2583e31cbc4cd2803d920..1c575bf4866af3a6d5f264e169af1e1418b223c0 100644 (file)
@@ -218,7 +218,7 @@ static void bm_grid_fill_array(BMesh *bm, BMVert **v_grid, const int xtot, const
                                        v_grid[XY(x + 1, y + 1)],  /* TR */
                                        v_grid[XY(x + 1, y + 0)],  /* BR */
                                        NULL,
-                                       false);
+                                       BM_CREATE_NOP);
                        }
                        else {
                                f = BM_face_create_quad_tri(
@@ -228,7 +228,7 @@ static void bm_grid_fill_array(BMesh *bm, BMVert **v_grid, const int xtot, const
                                        v_grid[XY(x,     y + 1)],  /* TL */
                                        v_grid[XY(x,     y + 0)],  /* BL */
                                        NULL,
-                                       false);
+                                       BM_CREATE_NOP);
                        }
                        BMO_elem_flag_enable(bm, f, FACE_OUT);
                        f->mat_nr = mat_nr;
index 89da386c1cbf548ace004cc22a1a8a8e9afaae1c..9ba08f0a470a2d63daba2b83a58aae913314ff8b 100644 (file)
@@ -135,7 +135,7 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
                                }
 
                                /* Create new hull face */
-                               f = BM_face_create_quad_tri_v(bm, t->v, 3, example, true);
+                               f = BM_face_create_verts(bm, t->v, 3, example, BM_CREATE_NO_DOUBLE, true);
                                BM_face_copy_shared(bm, f, NULL, NULL);
                        }
                        /* Mark face for 'geom.out' slot and select */
index b9337406c99f070ccb1cefa0331dca31d7557a22..20cd828af1ea7eed350caac58dcd6eb02d8521f7 100644 (file)
@@ -162,7 +162,7 @@ static void bmo_face_inset_individual(
                                                      v_other_next,
                                                      l_iter->next->v,
                                                      l_iter->v,
-                                                     f, false);
+                                                     f, BM_CREATE_NOP);
                BMO_elem_flag_enable(bm, f_new_outer, ELE_NEW);
 
                /* copy loop data */
@@ -811,7 +811,7 @@ void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
 #endif
                /* no need to check doubles, we KNOW there won't be any */
                /* yes - reverse face is correct in this case */
-               f = BM_face_create_quad_tri_v(bm, varr, j, es->l->f, false);
+               f = BM_face_create_verts(bm, varr, j, es->l->f, BM_CREATE_NOP, true);
                BMO_elem_flag_enable(bm, f, ELE_NEW);
 
                /* copy for loop data, otherwise UV's and vcols are no good.
index 4ee4979fdcd408fb6af64b8cbe3bd228ebea9202..514d8e1584549dc4a6edd00c1cee60f13171366b 100644 (file)
@@ -189,10 +189,8 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op)
                        v2 = BMO_slot_map_elem_get(slot_targetmap, v2);
                }
                
-               f_new = BM_face_create_ngon(bm, v, v2, edges, a, BM_CREATE_NO_DOUBLE);
+               f_new = BM_face_create_ngon(bm, v, v2, edges, a, f, BM_CREATE_NO_DOUBLE);
                if (f_new && (f_new != f)) {
-                       BM_elem_attrs_copy(bm, bm, f, f_new);
-
                        a = 0;
                        BM_ITER_ELEM (l, &liter, f_new, BM_LOOPS_OF_FACE) {
                                l_new = loops[a];
index 159e6900dd6de50584248ebfe561f62926888029..f0402cc5da7d79fc024d7b44cf855627d1c586e8 100644 (file)
@@ -362,7 +362,7 @@ static bool symm_poly_next_crossing(const Symm *symm,
        return false;
 }
 
-static BMFace *symm_face_create_v(BMesh *bm, BMFace *example,
+static BMFace *symm_face_create_v(BMesh *bm, BMFace *f_example,
                                   BMVert **fv, BMEdge **fe, int len)
 {
        BMFace *f_new;
@@ -382,9 +382,7 @@ static BMFace *symm_face_create_v(BMesh *bm, BMFace *example,
                        BMO_elem_flag_enable(bm, fe[i], SYMM_OUTPUT_GEOM);
                }
        }
-       f_new = BM_face_create(bm, fv, fe, len, BM_CREATE_NO_DOUBLE);
-       if (example)
-               BM_elem_attrs_copy(bm, bm, example, f_new);
+       f_new = BM_face_create(bm, fv, fe, len, f_example, BM_CREATE_NO_DOUBLE);
        BM_face_select_set(bm, f_new, true);
        BMO_elem_flag_enable(bm, f_new, SYMM_OUTPUT_GEOM);
 
index 227c629275488ff57814cdd59387c2602350ffb0..3152c50b25abf8d72c373952d34e224d120abc84 100644 (file)
@@ -255,20 +255,8 @@ static BMFace *bev_create_ngon(BMesh *bm, BMVert **vert_arr, const int totv,
        BMFace *f, *interp_f;
        int i;
 
-       if (totv == 3) {
-               f = BM_face_create_quad_tri_v(bm, vert_arr, 3, facerep, FALSE);
-       }
-       else if (totv == 4) {
-               f = BM_face_create_quad_tri_v(bm, vert_arr, 4, facerep, FALSE);
-       }
-       else {
-               BMEdge **ee = BLI_array_alloca(ee, totv);
+       f = BM_face_create_verts(bm, vert_arr, totv, facerep, BM_CREATE_NOP, true);
 
-               for (i = 0; i < totv; i++) {
-                       ee[i] = BM_edge_create(bm, vert_arr[i], vert_arr[(i + 1) % totv], NULL, BM_CREATE_NO_DOUBLE);
-               }
-               f = BM_face_create(bm, vert_arr, ee, totv, BM_CREATE_NOP);
-       }
        if ((facerep || (face_arr && face_arr[0])) && f) {
                BM_elem_attrs_copy(bm, bm, facerep ? facerep : face_arr[0], f);
                if (do_interp) {
index c4fce80db56a518bebe63c6d6158392a2e8dd10e..44188d9c34cef158a92e039c228bea4108db0103 100644 (file)
@@ -193,7 +193,7 @@ static BMFace *bm_edgenet_face_from_path(
        }
 #endif
 
-       f = BM_face_create(bm, vert_arr, edge_arr, (int)path_len, BM_CREATE_NOP);
+       f = BM_face_create(bm, vert_arr, edge_arr, (int)path_len, NULL, BM_CREATE_NOP);
 
        return f;
 }
index cbea45e2c2ee2a952006a5ba7f4b5647bf7d2c07..0aa46ea299be63f3d6d5cf2ec277f551431b15fc 100644 (file)
@@ -494,7 +494,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
                        /* face should never exist */
                        BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == false);
 
-                       f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, false);
+                       f = BM_face_create_verts(bm, f_verts, f_verts[3] ? 4 : 3, f_example, BM_CREATE_NOP, true);
 
                        l_iter = BM_FACE_FIRST_LOOP(f);
 
index aa26940a7d76b6143fb608bd461ab9f3698c353e..09e0ac966d0b493c9d681ddbf9735f4ccda0f1c8 100644 (file)
@@ -940,7 +940,7 @@ static void add_poly(SkinOutput *so,
        BLI_assert(v3 != v4);
        BLI_assert(v1 && v2 && v3);
 
-       f = BM_face_create_verts(so->bm, verts, v4 ? 4 : 3, BM_CREATE_NO_DOUBLE, true);
+       f = BM_face_create_verts(so->bm, verts, v4 ? 4 : 3, NULL, BM_CREATE_NO_DOUBLE, true);
        if (so->smd->flag & MOD_SKIN_SMOOTH_SHADING)
                BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
        f->mat_nr = so->mat_nr;
index 0395f6aaadc64b9e0fb0879d2d905e39fd7b3a8b..e6842051e317642106dd8340eb72f51d19529c99 100644 (file)
@@ -2020,7 +2020,8 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
                /* Go ahead and make the face!
                 * --------------------------- */
 
-               f_new = BM_face_create_verts(bm, vert_array, vert_seq_len, BM_CREATE_NOP, true);
+               f_new = BM_face_create_verts(bm, vert_array, vert_seq_len,
+                                            py_face_example ? py_face_example->f : NULL, BM_CREATE_NOP, true);
 
                if (UNLIKELY(f_new == NULL)) {
                        PyErr_SetString(PyExc_ValueError,
@@ -2028,10 +2029,6 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
                        goto cleanup;
                }
 
-               if (py_face_example) {
-                       BM_elem_attrs_copy(py_face_example->bm, bm, py_face_example->f, f_new);
-               }
-
                ret = BPy_BMFace_CreatePyObject(bm, f_new);
 
                /* pass through */