diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-09-06 17:00:33 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-09-06 17:08:30 +0300 |
commit | d9ea72291fcaa0f8653e25e2a1d2eb8109835f3a (patch) | |
tree | 82bd0a60f93c30ca412ff8814d66e0b903a19867 /source/blender/draw/intern/mesh_extractors | |
parent | 8b11ed392c10f813c33d61cfdb5efebd9a679255 (diff) |
Fix T100842: Display Texture Paint UVs option in UV editor not working
In 8cf52e8226cb we assumed that the UV IBO's are only needed in edit mode,
however the UV lines also need to work in texture paint mode. So prefer to
use bmesh when available to fix the original bug, but don't assume the face
is hidden when there is no bmesh.
Differential Revision: https://developer.blender.org/D15895
Diffstat (limited to 'source/blender/draw/intern/mesh_extractors')
-rw-r--r-- | source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc index f51c96af0b0..e2d939b18a1 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc @@ -212,9 +212,16 @@ static void extract_edituv_lines_iter_poly_mesh(const MeshRenderData *mr, const MLoop *mloop = mr->mloop; const int ml_index_end = mp->loopstart + mp->totloop; - const BMFace *efa = bm_original_face_get(mr, mp_index); - const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; - const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; + bool mp_hidden, mp_select; + if (mr->bm) { + const BMFace *efa = bm_original_face_get(mr, mp_index); + mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; + mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; + } + else { + mp_hidden = (mp->flag & ME_HIDE) != 0; + mp_select = (mp->flag & ME_FACE_SEL) != 0; + } for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { const MLoop *ml = &mloop[ml_index]; @@ -285,9 +292,16 @@ static void extract_edituv_lines_iter_subdiv_mesh(const DRWSubdivCache *subdiv_c MeshExtract_EditUvElem_Data *data = static_cast<MeshExtract_EditUvElem_Data *>(_data); int *subdiv_loop_edge_index = (int *)GPU_vertbuf_get_data(subdiv_cache->edges_orig_index); - const BMFace *efa = bm_original_face_get(mr, coarse_poly - mr->mpoly); - const bool mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; - const bool mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; + bool mp_hidden, mp_select; + if (mr->bm) { + const BMFace *efa = bm_original_face_get(mr, coarse_poly - mr->mpoly); + mp_hidden = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_HIDDEN) : true; + mp_select = (efa) ? BM_elem_flag_test_bool(efa, BM_ELEM_SELECT) : false; + } + else { + mp_hidden = (coarse_poly->flag & ME_HIDE) != 0; + mp_select = (coarse_poly->flag & ME_FACE_SEL) != 0; + } uint start_loop_idx = subdiv_quad_index * 4; uint end_loop_idx = (subdiv_quad_index + 1) * 4; |