diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-04-20 03:16:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-04-20 03:16:57 +0400 |
commit | 384f87cd1cbb3549daa448e499184eec5183ae97 (patch) | |
tree | d3aa4223b4cb31776fc022670588691791b0fb01 /source/blender/editors/mesh | |
parent | 028dbb132d7a0f27adb9fab539fc9409043ea742 (diff) |
rip tool wasnt working on a single edge selection in some cases (own error in recent fix).
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_rip.c | 37 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 8 |
2 files changed, 20 insertions, 25 deletions
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 3d310e5ea90..8ae05e3b1b8 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -361,7 +361,7 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) float d; const int totedge_orig = bm->totedge; - EdgeLoopPair *eloop_pairs; + EdgeLoopPair *eloop_pairs = NULL; /* running in face mode hardly makes sense, so convert to region loop and rip */ if (em->bm->totfacesel) { @@ -388,7 +388,10 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) /* handle case of one vert selected. identify * closest edge around that vert to mouse cursor, * then rip two adjacent edges in the vert fan. */ + if (bm->totvertsel == 1 && bm->totedgesel == 0 && bm->totfacesel == 0) { + /* --- Vert-Rip --- */ + BMEditSelection ese; int totboundary_edge = 0; singlesel = TRUE; @@ -540,8 +543,13 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) dist = FLT_MAX; } else { + /* --- Edge-Rip --- */ int totedge; int all_minifold; + + /* important this runs on the original selection, before tempering with tagging */ + eloop_pairs = edbm_ripsel_looptag_helper(bm); + /* expand edge selection */ BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { e2 = NULL; @@ -598,11 +606,9 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } } - eloop_pairs = edbm_ripsel_looptag_helper(bm); - if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b", BM_ELEM_TAG, BM_ELEM_SELECT, TRUE)) { - MEM_freeN(eloop_pairs); + if (eloop_pairs) MEM_freeN(eloop_pairs); return OPERATOR_CANCELLED; } @@ -612,26 +618,10 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) EDBM_op_finish(em, &bmop, op, TRUE); BKE_report(op->reports, RPT_ERROR, "No edges could be ripped"); - MEM_freeN(eloop_pairs); + if (eloop_pairs) MEM_freeN(eloop_pairs); return OPERATOR_CANCELLED; } -#if 1 - edbm_ripsel_deselect_helper(bm, eloop_pairs, - ar, projectMat, fmval); - MEM_freeN(eloop_pairs); -#else - { - /* simple per edge selection check, saves a lot of code and is almost good enough */ - BMOIter siter; - BMO_ITER (e, &siter, bm, &bmop, "edgeout", BM_EDGE) { - if (edbm_rip_edge_side_measure(e, ar, projectMat, fmval) > 0.0f) { - BM_elem_select_set(bm, e, FALSE); - } - } - } -#endif - if (singlesel) { BMVert *v_best = NULL; float l_prev_co[3], l_next_co[3], l_corner_co[3]; @@ -676,6 +666,11 @@ static int edbm_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } #endif } + else { + edbm_ripsel_deselect_helper(bm, eloop_pairs, + ar, projectMat, fmval); + MEM_freeN(eloop_pairs); + } EDBM_selectmode_flush(em); diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 26c50fb4feb..2c1c25b2a91 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -350,7 +350,7 @@ static short edbm_extrude_vert(Object *obedit, BMEditMesh *em, const char hflag, BMEdge *eed; /* ensure vert flags are consistent for edge selections */ - BM_ITER_MESH(eed, &iter, em->bm, BM_EDGES_OF_MESH) { + BM_ITER_MESH (eed, &iter, em->bm, BM_EDGES_OF_MESH) { if (BM_elem_flag_test(eed, hflag)) { if (hflag & BM_ELEM_SELECT) { BM_elem_select_set(em->bm, eed->v1, TRUE); @@ -2663,7 +2663,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) } /* get the cut curve */ - RNA_BEGIN(op->ptr, itemptr, "path") { + RNA_BEGIN (op->ptr, itemptr, "path") { RNA_float_get_array(&itemptr, "loc", (float *)&curve[len]); len++; if (len >= MAX_CUTS) { @@ -3917,7 +3917,7 @@ static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed) { BMVert *ve; BMIter iter; - char *block/* Just to mark protected vertices */, *t_blk; + char *block /* Just to mark protected vertices */, *t_blk; int *randblock, *vmap, *t_idx, *r_idx; int totvert, randomized = 0, /*protected = 0, */ i; @@ -3945,7 +3945,7 @@ static void hashvert_flag(BMEditMesh *em, int flag, unsigned int seed) vmap = randblock; randblock = MEM_mallocN(sizeof(int) * randomized, "randvert randblock"); memcpy(randblock, vmap, randomized * sizeof(int)); - BLI_array_randomize ((void*)randblock, sizeof(int), randomized, seed); + BLI_array_randomize((void *)randblock, sizeof(int), randomized, seed); t_blk = block + totvert - 1; t_idx = vmap + totvert - 1; r_idx = randblock + randomized - 1; |