diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 11:55:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-13 11:57:52 +0300 |
commit | 52d31b4894a308b015fd111ad7872bd78f99fba6 (patch) | |
tree | 77ca2b2e20e53414b7b88a390f314787c8c03d29 /source/blender/bmesh/operators | |
parent | 9984c6494ae7336e38e9ccd8f39197f549819025 (diff) |
BMesh: make edge winding from face optional
Broke uv-sphere creation, further it might be a problem
for script authors expecting matching edge order for duplicated content.
Now only apply this when duplicating via the operator.
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index a5ad162b586..b2961c5cb6b 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -75,7 +75,8 @@ static BMEdge *bmo_edge_copy( BMOpSlot *slot_boundarymap_out, BMesh *bm_dst, BMesh *bm_src, BMEdge *e_src, - GHash *vhash, GHash *ehash) + GHash *vhash, GHash *ehash, + const bool use_edge_flip_from_face) { BMEdge *e_dst; BMVert *e_dst_v1, *e_dst_v2; @@ -121,10 +122,12 @@ static BMEdge *bmo_edge_copy( /* Mark the edge for output */ BMO_edge_flag_enable(bm_dst, e_dst, DUPE_NEW); - /* Take winding from previous face (if we had one), - * otherwise extruding a duplicated edges gives bad normals, see: T62487. */ - if (BM_edge_is_boundary(e_src) && (e_src->l->v == e_src->v1)) { - BM_edge_verts_swap(e_dst); + if (use_edge_flip_from_face) { + /* Take winding from previous face (if we had one), + * otherwise extruding a duplicated edges gives bad normals, see: T62487. */ + if (BM_edge_is_boundary(e_src) && (e_src->l->v == e_src->v1)) { + BM_edge_verts_swap(e_dst); + } } return e_dst; @@ -190,6 +193,7 @@ static BMFace *bmo_face_copy( static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src) { const bool use_select_history = BMO_slot_bool_get(op->slots_in, "use_select_history"); + const bool use_edge_flip_from_face = BMO_slot_bool_get(op->slots_in, "use_edge_flip_from_face"); BMVert *v = NULL, *v2; BMEdge *e = NULL; @@ -259,7 +263,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src) } /* now copy the actual edge */ bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out, - bm_dst, bm_src, e, vhash, ehash); + bm_dst, bm_src, e, vhash, ehash, use_edge_flip_from_face); BMO_edge_flag_enable(bm_src, e, DUPE_DONE); } } @@ -279,7 +283,7 @@ static void bmo_mesh_copy(BMOperator *op, BMesh *bm_dst, BMesh *bm_src) BM_ITER_ELEM (e, &eiter, f, BM_EDGES_OF_FACE) { if (!BMO_edge_flag_test(bm_src, e, DUPE_DONE)) { bmo_edge_copy(op, slot_edge_map_out, slot_boundary_map_out, - bm_dst, bm_src, e, vhash, ehash); + bm_dst, bm_src, e, vhash, ehash, use_edge_flip_from_face); BMO_edge_flag_enable(bm_src, e, DUPE_DONE); } } |