diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-05-02 23:15:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-05-02 23:17:32 +0300 |
commit | 6bc8a3f8d3b47c1b8be0ede8293334448ea6bf3f (patch) | |
tree | 7dfa721d33fd9d761c5abb0606faa1e5217172dd | |
parent | dd48ddd605708a64adb5d78307451ffca0cc1ad3 (diff) |
BMesh: rip-tool can now split off isolated fans
Useful since there wasn't a good way to do this previously.
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index e9fc12f3252..abd88ae65aa 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -559,9 +559,10 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve } } - /* this should be impossible, but sanity checks are a good thing */ - if (!v) + /* (v == NULL) should be impossible */ + if ((v == NULL) || (v->e == NULL)) { return OPERATOR_CANCELLED; + } is_wire = BM_vert_is_wire(v); @@ -621,6 +622,32 @@ static int edbm_rip_invoke__vert(bContext *C, wmOperator *op, const wmEvent *eve } } + if (e2) { + /* Try to split off a non-manifold fan (when we have multiple disconnected fans) */ + + /* note: we're lazy here and first split then check there are any faces remaining, + * this isn't good practice, however its less hassle then checking for multiple-disconnected regions */ + BMLoop *l_sep = e2->l->v == v ? e2->l : e2->l->next; + BMVert *v_new; + BLI_assert(l_sep->v == v); + v_new = bmesh_urmv_loop_region(bm, l_sep); + if (BM_vert_find_first_loop(v)) { + BM_vert_select_set(bm, v, false); + BM_select_history_remove(bm, v); + + BM_vert_select_set(bm, v_new, true); + if (ese.ele) { + BM_select_history_store(bm, v_new); + } + + return OPERATOR_FINISHED; + } + else { + /* rewind */ + BM_vert_splice(bm, v, v_new); + } + } + /* should we go ahead with edge rip or do we need to do special case, split off vertex?: * split off vertex if... * - we cant find an edge - this means we are ripping a faces vert that is connected to other |