Fix T75128: Select Linked fails when the selection is a delimiter

Starting select linked failed when the selected vertex or edge
was it's self delimiting.

Support using these elements for linked select
as long as they're part of an isolated selection.
This commit is contained in:
Campbell Barton 2020-04-07 17:43:27 +10:00
parent ffe599b4bd
commit cdbb61704d
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by issue #75128, Select Linked works incorrectly
3 changed files with 31 additions and 6 deletions

View File

@ -2431,6 +2431,22 @@ bool BM_edge_is_all_face_flag_test(const BMEdge *e, const char hflag, const bool
return true;
}
bool BM_edge_is_any_face_flag_test(const BMEdge *e, const char hflag)
{
if (e->l) {
BMLoop *l_iter, *l_first;
l_iter = l_first = e->l;
do {
if (BM_elem_flag_test(l_iter->f, hflag)) {
return true;
}
} while ((l_iter = l_iter->radial_next) != l_first);
}
return false;
}
/* convenience functions for checking flags */
bool BM_edge_is_any_vert_flag_test(const BMEdge *e, const char hflag)
{

View File

@ -226,6 +226,8 @@ bool BM_edge_is_all_face_flag_test(const BMEdge *e,
bool BM_edge_is_any_vert_flag_test(const BMEdge *e, const char hflag) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_edge_is_any_face_flag_test(const BMEdge *e, const char hflag) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_face_is_any_vert_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT

View File

@ -3201,8 +3201,12 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
BMEdge *e;
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
if (!BMO_edge_flag_test(bm, e, BMO_ELE_TAG)) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
/* Check the edge for selected faces,
* this supports stepping off isolated vertices which would otherwise be ignored. */
if (BM_edge_is_any_face_flag_test(e, BM_ELEM_SELECT)) {
BM_elem_flag_disable(e->v1, BM_ELEM_TAG);
BM_elem_flag_disable(e->v2, BM_ELEM_TAG);
}
}
}
}
@ -3258,10 +3262,13 @@ static int edbm_select_linked_exec(bContext *C, wmOperator *op)
if (delimit) {
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
BM_elem_flag_set(
e,
BM_ELEM_TAG,
(BM_elem_flag_test(e, BM_ELEM_SELECT) && BMO_edge_flag_test(bm, e, BMO_ELE_TAG)));
/* Check the edge for selected faces,
* this supports stepping off isolated edges which would otherwise be ignored. */
BM_elem_flag_set(e,
BM_ELEM_TAG,
(BM_elem_flag_test(e, BM_ELEM_SELECT) &&
(BMO_edge_flag_test(bm, e, BMO_ELE_TAG) ||
!BM_edge_is_any_face_flag_test(e, BM_ELEM_SELECT))));
}
}
else {