Fix #106396: UV stitch crash with hidden faces

This was the case with hidden faces and `Sync Selection` turned ON.

Caused by 8f543a73ab.

Since 8f543a73ab, the UV element map
respects the hidden state of geometry, but stitching [which also
respected this on its own even prior to the culprit commit in its
calculation of connectivity] did this differently [it only skipped
hidden geo when UV_SYNC_SELECTION was OFF -- even though UVs would not
be visible which is probably the real error here, I believe there is
this principle that we "dont act on stuff we dont see"].

To fix this, also skip hidden geo (even with UV_SYNC_SELECTION = ON) in
the stitch calculation of connectivity, just as
`BM_uv_element_map_create` does it.

Should go into 3.3 LTS as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/106493
This commit is contained in:
Philipp Oeser
2023-04-04 12:10:30 +02:00
committed by Philipp Oeser
parent f2f8884f95
commit 58c54b5859
2 changed files with 6 additions and 3 deletions

View File

@@ -974,7 +974,7 @@ UvElementMap *BM_uv_element_map_create(BMesh *bm,
const bool use_seams,
const bool do_islands)
{
/* In uv sync selection, all UVs are visible. */
/* In uv sync selection, all UVs (from unhidden geometry) are visible. */
const bool face_selected = !(scene->toolsettings->uv_flag & UV_SYNC_SELECTION);
BMVert *ev;

View File

@@ -1889,9 +1889,12 @@ static StitchState *stitch_init(bContext *C,
counter = 0;
/* Now, on to generate our uv connectivity data */
const bool face_selected = !(ts->uv_flag & UV_SYNC_SELECTION);
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
if (!(ts->uv_flag & UV_SYNC_SELECTION) &&
(BM_elem_flag_test(efa, BM_ELEM_HIDDEN) || !BM_elem_flag_test(efa, BM_ELEM_SELECT))) {
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
continue;
}
if (face_selected && !BM_elem_flag_test(efa, BM_ELEM_SELECT)) {
continue;
}