diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 11:54:11 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-27 11:54:11 +0400 |
commit | d358458a8d3bc37c4ea5418fa6e6c9c259704f51 (patch) | |
tree | 1d76b4fc9d486eaf44741fe26494f78aa46d5fe7 /source/blender/bmesh/operators/bmo_create.c | |
parent | 31eee77a4503ac38c3d9d96a5f77df86648c700c (diff) |
fix for mesh face filling when a valid edge-loop was selected but unselected connecting geometry existed inside the loop.
In this case edgenet_fill operator failed and it would fallback to filling as unordered vertices which was mostly fine but failed on some concave loops.
Add a new bmesh operator 'edgeloop_fill' fills in closed loops even if they don't make a valid edge-net.
Diffstat (limited to 'source/blender/bmesh/operators/bmo_create.c')
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index a6346a4480f..86904155cd3 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -132,7 +132,10 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) } /* --- end special case support, continue as normal --- */ - /* call edgenet create */ + + /* -------------------------------------------------------------------- */ + /* EdgeNet Create */ + /* call edgenet prepare op so additional face creation cases wore */ BMO_op_initf(bm, &op2, op->flag, "edgenet_prepare edges=%fe", ELE_NEW); BMO_op_exec(bm, &op2); @@ -154,8 +157,10 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) } BMO_op_finish(bm, &op2); - - /* now call dissolve face */ + + + /* -------------------------------------------------------------------- */ + /* Dissolve Face */ BMO_op_initf(bm, &op2, op->flag, "dissolve_faces faces=%ff", ELE_NEW); BMO_op_exec(bm, &op2); @@ -169,6 +174,32 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) BMO_op_finish(bm, &op2); + + /* -------------------------------------------------------------------- */ + /* Fill EdgeLoop's - fills isolated loops, different from edgenet */ + + /* note: in most cases 'edgenet_fill' will handle this case since in common cases + * users fill in empty spaces, however its possible to have an edge selection around + * existing geometry that makes 'edgenet_fill' fail. */ + BMO_op_initf(bm, &op2, op->flag, "edgeloop_fill edges=%fe", ELE_NEW); + BMO_op_exec(bm, &op2); + + /* return if edge loop fill did something */ + if (BMO_slot_buffer_count(op2.slots_out, "faces.out")) { + BMO_slot_copy(&op2, slots_out, "faces.out", + op, slots_out, "faces.out"); + BMO_op_finish(bm, &op2); + return; + } + + BMO_op_finish(bm, &op2); + + + + /* -------------------------------------------------------------------- */ + /* Continue with ad-hoc fill methods since operators fail, + * edge, vcloud... may add more */ + /* now, count how many verts we have */ amount = 0; BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { @@ -237,8 +268,9 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) /* done creating edges */ } else if (amount > 2) { - /* TODO, all these verts may be connected by edges. - * we should check on this before assuming they are a random set of verts */ + /* TODO, some of these vertes may be connected by edges, + * this connectivity could be used rather then treating + * them as a bunch of isolated verts. */ BMVert **vert_arr = MEM_mallocN(sizeof(BMVert **) * totv, __func__); int i = 0; |