diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-01-04 08:23:04 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-01-04 08:23:04 +0300 |
commit | c3e454b8e0808c8615cd58d86547e63642cde91d (patch) | |
tree | 77d20c732229c18dafd226d356814bd378258d0b /source/blender/bmesh/operators | |
parent | 0fe80121b9f073c6d9379f6a94cc0550704826e9 (diff) |
Fix T60099: Inconsistent normals from spin tool
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_dupe.c | 5 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 24 |
2 files changed, 20 insertions, 9 deletions
diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index 7f13731dc02..9dd4eded002 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -525,8 +525,9 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &dupop); } else { - BMO_op_initf(bm, &extop, op->flag, "extrude_face_region geom=%S use_normal_flip=%b", - op, "geom_last.out", use_normal_flip && (a == 0)); + BMO_op_initf(bm, &extop, op->flag, + "extrude_face_region geom=%S use_normal_flip=%b use_normal_from_adjacent=%b", + op, "geom_last.out", use_normal_flip && (a == 0), (a != 0)); BMO_op_exec(bm, &extop); if ((use_merge && (a == steps - 1)) == false) { BMO_op_callf(bm, op->flag, diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 8c1624740da..a13024d8793 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -339,6 +339,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMOpSlot *slot_facemap_out; BMOpSlot *slot_edges_exclude; const bool use_normal_flip = BMO_slot_bool_get(op->slots_in, "use_normal_flip"); + const bool use_normal_from_adjacent = BMO_slot_bool_get(op->slots_in, "use_normal_from_adjacent"); /* initialize our sub-operators */ BMO_op_initf( @@ -489,13 +490,22 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) continue; } - /* orient loop to give same normal as a loop of newedge - * if it exists (will be an extruded face), - * else same normal as a loop of e, if it exists */ - const bool edge_normal_flip = !( - e_new->l ? - (e_new->l->v == e_new->v1) : - (!e->l || !(e->l->v == e->v1))); + bool edge_normal_flip; + if (use_normal_from_adjacent == false) { + /* Orient loop to give same normal as a loop of 'e_new' + * if it exists (will be one of the faces from the region), + * else same normal as a loop of e, if it exists. */ + edge_normal_flip = !( + e_new->l ? + (e_new->l->v == e_new->v1) : + (!e->l || !(e->l->v == e->v1))); + } + else { + /* Special case, needed for repetitive extrusions + * that use the normals from the previously created faces. */ + edge_normal_flip = !(e->l && e->v1 != e->l->v); + } + if (edge_normal_flip == use_normal_flip) { f_verts[0] = e->v1; f_verts[1] = e->v2; |