forked from bartvdbraak/blender
fix [#29177] Select linked in face select mode doesn't stop on seams
This commit is contained in:
parent
a89071333e
commit
b9d270cc58
@ -366,6 +366,11 @@ static void *islandWalker_step(BMWalker *walker)
|
|||||||
|
|
||||||
l = BMIter_New(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
|
l = BMIter_New(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
|
||||||
for (; l; l=BMIter_Step(&liter)) {
|
for (; l; l=BMIter_Step(&liter)) {
|
||||||
|
/* could skip loop here too, but dont add unless we need it */
|
||||||
|
if (walker->mask_edge && !BMO_TestFlag(walker->bm, l->e, walker->mask_edge)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
f = BMIter_New(&iter, walker->bm, BM_FACES_OF_EDGE, l->e);
|
f = BMIter_New(&iter, walker->bm, BM_FACES_OF_EDGE, l->e);
|
||||||
for (; f; f=BMIter_Step(&iter)) {
|
for (; f; f=BMIter_Step(&iter)) {
|
||||||
if (walker->mask_face && !BMO_TestFlag(walker->bm, f, walker->mask_face)) {
|
if (walker->mask_face && !BMO_TestFlag(walker->bm, f, walker->mask_face)) {
|
||||||
@ -830,7 +835,7 @@ static BMWalker island_walker_type = {
|
|||||||
islandWalker_yield,
|
islandWalker_yield,
|
||||||
sizeof(islandWalker),
|
sizeof(islandWalker),
|
||||||
BMW_BREADTH_FIRST,
|
BMW_BREADTH_FIRST,
|
||||||
BM_FACE, /* valid restrict masks */
|
BM_EDGE | BM_FACE, /* valid restrict masks */
|
||||||
};
|
};
|
||||||
|
|
||||||
static BMWalker loop_walker_type = {
|
static BMWalker loop_walker_type = {
|
||||||
|
@ -1727,6 +1727,7 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
|
|||||||
{
|
{
|
||||||
Object *obedit= CTX_data_edit_object(C);
|
Object *obedit= CTX_data_edit_object(C);
|
||||||
ViewContext vc;
|
ViewContext vc;
|
||||||
|
BMesh *bm;
|
||||||
BMWalker walker;
|
BMWalker walker;
|
||||||
BMEditMesh *em;
|
BMEditMesh *em;
|
||||||
BMVert *eve;
|
BMVert *eve;
|
||||||
@ -1741,9 +1742,11 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
|
|||||||
em_setup_viewcontext(C, &vc);
|
em_setup_viewcontext(C, &vc);
|
||||||
em = vc.em;
|
em = vc.em;
|
||||||
|
|
||||||
if(vc.em->bm->totedge==0)
|
if(em->bm->totedge==0)
|
||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
|
bm= em->bm;
|
||||||
|
|
||||||
vc.mval[0]= event->mval[0];
|
vc.mval[0]= event->mval[0];
|
||||||
vc.mval[1]= event->mval[1];
|
vc.mval[1]= event->mval[1];
|
||||||
|
|
||||||
@ -1761,6 +1764,26 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
|
|||||||
return OPERATOR_CANCELLED;
|
return OPERATOR_CANCELLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (em->selectmode == SCE_SELECT_FACE) {
|
||||||
|
BMIter iter;
|
||||||
|
|
||||||
|
if (efa == NULL)
|
||||||
|
return OPERATOR_CANCELLED;
|
||||||
|
|
||||||
|
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
|
||||||
|
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
|
||||||
|
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* walk */
|
||||||
|
BMW_Init(&walker, bm, BMW_ISLAND, 0,BM_SELECT,0,0, BMW_NIL_LAY);
|
||||||
|
e = BMW_Begin(&walker, efa);
|
||||||
|
for (; efa; efa=BMW_Step(&walker)) {
|
||||||
|
BM_Select(bm, efa, sel);
|
||||||
|
}
|
||||||
|
BMW_End(&walker);
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (efa) {
|
if (efa) {
|
||||||
eed = bm_firstfaceloop(efa)->e;
|
eed = bm_firstfaceloop(efa)->e;
|
||||||
} else if (!eed) {
|
} else if (!eed) {
|
||||||
@ -1770,14 +1793,15 @@ static int select_linked_pick_invoke(bContext *C, wmOperator *op, wmEvent *event
|
|||||||
eed = eve->e;
|
eed = eve->e;
|
||||||
}
|
}
|
||||||
|
|
||||||
BMW_Init(&walker, em->bm, BMW_SHELL, 0,0,0,0, BMW_NIL_LAY);
|
BMW_Init(&walker, bm, BMW_SHELL, 0,0,0,0, BMW_NIL_LAY);
|
||||||
e = BMW_Begin(&walker, eed->v1);
|
e = BMW_Begin(&walker, eed->v1);
|
||||||
for (; e; e=BMW_Step(&walker)) {
|
for (; e; e=BMW_Step(&walker)) {
|
||||||
BM_Select(em->bm, e->v1, sel);
|
BM_Select(bm, e->v1, sel);
|
||||||
BM_Select(em->bm, e->v2, sel);
|
BM_Select(bm, e->v2, sel);
|
||||||
}
|
}
|
||||||
BMW_End(&walker);
|
BMW_End(&walker);
|
||||||
EDBM_select_flush(em, SCE_SELECT_VERTEX);
|
EDBM_select_flush(em, SCE_SELECT_VERTEX);
|
||||||
|
}
|
||||||
|
|
||||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
|
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
@ -1806,34 +1830,64 @@ static int select_linked_exec(bContext *C, wmOperator *UNUSED(op))
|
|||||||
{
|
{
|
||||||
Object *obedit= CTX_data_edit_object(C);
|
Object *obedit= CTX_data_edit_object(C);
|
||||||
BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh;
|
BMEditMesh *em= ((Mesh*)obedit->data)->edit_btmesh;
|
||||||
BLI_array_declare(verts);
|
BMesh *bm= em->bm;
|
||||||
BMVert **verts = NULL;
|
|
||||||
BMIter iter;
|
BMIter iter;
|
||||||
BMVert *v;
|
BMVert *v;
|
||||||
BMEdge *e;
|
BMEdge *e;
|
||||||
BMWalker walker;
|
BMWalker walker;
|
||||||
int i, tot;
|
|
||||||
|
|
||||||
tot = 0;
|
if (em->selectmode == SCE_SELECT_FACE) {
|
||||||
|
BMFace *efa;
|
||||||
|
|
||||||
|
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
|
||||||
|
if (BM_TestHFlag(efa, BM_SELECT) && !BM_TestHFlag(efa, BM_HIDDEN)) {
|
||||||
|
BM_SetHFlag(efa, BM_TMP_TAG);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BM_ClearHFlag(efa, BM_TMP_TAG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BM_ITER(e, &iter, bm, BM_EDGES_OF_MESH, NULL) {
|
||||||
|
if (!BM_TestHFlag(e, BM_SEAM)) BMO_SetFlag(bm, e, BM_SELECT);
|
||||||
|
else BMO_ClearFlag(bm, e, BM_SELECT); /* is this needed ? */
|
||||||
|
}
|
||||||
|
|
||||||
|
BMW_Init(&walker, bm, BMW_ISLAND, 0,BM_SELECT,0,0, BMW_NIL_LAY);
|
||||||
|
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
|
||||||
|
if (BM_TestHFlag(efa, BM_TMP_TAG)) {
|
||||||
|
e = BMW_Begin(&walker, efa);
|
||||||
|
for (; efa; efa=BMW_Step(&walker)) {
|
||||||
|
BM_Select(bm, efa, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BMW_End(&walker);
|
||||||
|
}
|
||||||
|
else {
|
||||||
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
|
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
|
||||||
if (BM_TestHFlag(v, BM_SELECT) && !BM_TestHFlag(v, BM_HIDDEN)) {
|
if (BM_TestHFlag(v, BM_SELECT) && !BM_TestHFlag(v, BM_HIDDEN)) {
|
||||||
BLI_array_growone(verts);
|
BM_SetHFlag(v, BM_TMP_TAG);
|
||||||
verts[tot++] = v;
|
}
|
||||||
|
else {
|
||||||
|
BM_ClearHFlag(v, BM_TMP_TAG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BMW_Init(&walker, em->bm, BMW_SHELL, 0,0,0,0, BMW_NIL_LAY);
|
BMW_Init(&walker, em->bm, BMW_SHELL, 0,0,0,0, BMW_NIL_LAY);
|
||||||
for (i=0; i<tot; i++) {
|
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
|
||||||
e = BMW_Begin(&walker, verts[i]);
|
if (BM_TestHFlag(v, BM_TMP_TAG)) {
|
||||||
|
e = BMW_Begin(&walker, v);
|
||||||
for (; e; e=BMW_Step(&walker)) {
|
for (; e; e=BMW_Step(&walker)) {
|
||||||
BM_Select(em->bm, e->v1, 1);
|
BM_Select(em->bm, e->v1, 1);
|
||||||
BM_Select(em->bm, e->v2, 1);
|
BM_Select(em->bm, e->v2, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
BMW_End(&walker);
|
BMW_End(&walker);
|
||||||
|
}
|
||||||
EDBM_select_flush(em, SCE_SELECT_VERTEX);
|
EDBM_select_flush(em, SCE_SELECT_VERTEX);
|
||||||
|
|
||||||
BLI_array_free(verts);
|
|
||||||
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
|
WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit);
|
||||||
|
|
||||||
return OPERATOR_FINISHED;
|
return OPERATOR_FINISHED;
|
||||||
|
Loading…
Reference in New Issue
Block a user