diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 20:04:37 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-03-01 20:04:37 +0400 |
commit | 4a5078d6c9bf59840c0fe46876a9eb71aa3ad33a (patch) | |
tree | f11bd72c483993e38dcd2c927ff68eb279323dc2 /source/blender/bmesh/operators/bmo_extrude.c | |
parent | 216f74880e86b7da22e708569b1de082da357dfb (diff) |
style cleanup
* add extra argument to BMO_slot_map_to_flag() to filter by vert/edge/face
* made BMO_slot_map_* / BMO_slot_buffer_* functions stricter with type checking.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_extrude.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_extrude.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index fee8b7ee254..4cc965dc372 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -29,9 +29,11 @@ #include "bmesh_operators_private.h" /* own include */ -#define EXT_INPUT 1 -#define EXT_KEEP 2 -#define EXT_DEL 4 +enum { + EXT_INPUT = 1, + EXT_KEEP = 2, + EXT_DEL = 4 +}; #define VERT_MARK 1 #define EDGE_MARK 1 @@ -192,7 +194,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BMLoop *l, *l2; BMVert *verts[4], *v, *v2; BMFace *f; - int rlen, found, fwd, delorig = 0; + int found, fwd, delorig = FALSE; /* initialize our sub-operators */ BMO_op_init(bm, &dupeop, "dupe"); @@ -204,21 +206,27 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) if (!BMO_slot_bool_get(op, "alwayskeeporig")) { BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) { + int edge_face_tot; + if (!BMO_elem_flag_test(bm, e, EXT_INPUT)) { continue; } - found = FALSE; - f = BM_iter_new(&fiter, bm, BM_FACES_OF_EDGE, e); - for (rlen = 0; f; f = BM_iter_step(&fiter), rlen++) { + found = FALSE; /* found a face that isn't input? */ + edge_face_tot = 0; /* edge/face count */ + + BM_ITER(f, &fiter, bm, BM_FACES_OF_EDGE, e) { if (!BMO_elem_flag_test(bm, f, EXT_INPUT)) { found = TRUE; - delorig = 1; + delorig = TRUE; break; } + + edge_face_tot++; } - if ((found == FALSE) && (rlen > 1)) { + if ((edge_face_tot > 1) && (found == FALSE)) { + /* edge has a face user, that face isnt extrude input */ BMO_elem_flag_enable(bm, e, EXT_DEL); } } @@ -256,7 +264,7 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } } - if (delorig) { + if (delorig == TRUE) { BMO_op_initf(bm, &delop, "del geom=%fvef context=%i", EXT_DEL, DEL_ONLYTAGGED); } @@ -267,11 +275,13 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) if (bm->act_face && BMO_elem_flag_test(bm, bm->act_face, EXT_INPUT)) bm->act_face = BMO_slot_map_ptr_get(bm, &dupeop, "facemap", bm->act_face); - if (delorig) BMO_op_exec(bm, &delop); + if (delorig) { + BMO_op_exec(bm, &delop); + } /* if not delorig, reverse loops of original face */ if (!delorig) { - for (f = BM_iter_new(&iter, bm, BM_FACES_OF_MESH, NULL); f; f = BM_iter_step(&iter)) { + BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { if (BMO_elem_flag_test(bm, f, EXT_INPUT)) { BM_face_normal_flip(bm, f); } |