[Bf-blender-cvs] [d9ea72291fc] blender-v3.3-release: Fix T100842: Display Texture Paint UVs option in UV editor not working

Brecht Van Lommel noreply at git.blender.org
Tue Sep 6 16:09:00 CEST 2022


Commit: d9ea72291fcaa0f8653e25e2a1d2eb8109835f3a
Author: Brecht Van Lommel
Date:   Tue Sep 6 16:00:33 2022 +0200
Branches: blender-v3.3-release
https://developer.blender.org/rBd9ea72291fcaa0f8653e25e2a1d2eb8109835f3a

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

===================================================================

M	source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc

===================================================================

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;



More information about the Bf-blender-cvs mailing list