rip tool wasnt working on a single edge selection in some cases (own error in recent fix).
This commit is contained in:
@@ -202,7 +202,7 @@ extern "C" {
|
||||
#include "DNA_customdata_types.h" /* BMesh struct in bmesh_class.h uses */
|
||||
|
||||
#include <stdlib.h>
|
||||
// #include "BLI_utildefines.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bmesh_class.h"
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user