diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 14:12:09 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-23 14:12:09 +0400 |
commit | 5b5cae86b72776375f1b01dc555d98429e5c5782 (patch) | |
tree | 506f3253ce96cd4174199bb33a662e74fe01899a /source/blender/bmesh | |
parent | 2e2ea1ae212c8a660eb468119a7fb1bce17a46b9 (diff) |
optiona for bmesh triangle fill operator to take a normal argument
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_opdefines.c | 1 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_triangulate.c | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 3f486482466..54c67508626 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1598,6 +1598,7 @@ static BMOpDefine bmo_triangle_fill_def = { /* slots_in */ {{"use_beauty", BMO_OP_SLOT_BOOL}, {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}}, /* input edges */ + {"normal", BMO_OP_SLOT_VEC}, /* optionally pass the fill normal to use */ {{'\0'}}, }, /* slots_out */ diff --git a/source/blender/bmesh/operators/bmo_triangulate.c b/source/blender/bmesh/operators/bmo_triangulate.c index 2d6fad7afc9..46a8295dfd4 100644 --- a/source/blender/bmesh/operators/bmo_triangulate.c +++ b/source/blender/bmesh/operators/bmo_triangulate.c @@ -66,8 +66,11 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) ScanFillVert *sf_vert, *sf_vert_1, *sf_vert_2; ScanFillFace *sf_tri; SmallHash hash; + float normal[3], *normal_pt; BLI_smallhash_init(&hash); + + BMO_slot_vec_get(op->slots_in, "normal", normal); BLI_scanfill_begin(&sf_ctx); @@ -92,7 +95,15 @@ void bmo_triangle_fill_exec(BMesh *bm, BMOperator *op) /* sf_edge->tmp.p = e; */ /* UNUSED */ } - BLI_scanfill_calc(&sf_ctx, BLI_SCANFILL_CALC_HOLES); + if (is_zero_v3(normal)) { + normal_pt = NULL; + } + else { + normalize_v3(normal); + normal_pt = normal; + } + + BLI_scanfill_calc_ex(&sf_ctx, BLI_SCANFILL_CALC_HOLES, normal_pt); for (sf_tri = sf_ctx.fillfacebase.first; sf_tri; sf_tri = sf_tri->next) { BMFace *f = BM_face_create_quad_tri(bm, |