From fa9e878e79357d613a85a50050292f93b5bf41fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Fri, 13 May 2022 09:25:14 +0200 Subject: Fix T97330: UV points missing with some modifiers When extracting UV point indices, only the vertex points coming from the original geometry should be drawn. For this, the routines (for subdivision and coarse meshes) would only consider a vertex to be real if the extraction type is `MAPPED`, and that an origin index layer on the vertices exist with a valid origin index for the current vertex. However, if the extraction type is `MESH`, which can happen with for example an empty Geometry Node modifier, or with deferred subdivision, this would consider every vertex to not be "real" and therefore hidden from the UV editor. This reworks the condition for "realness" to also consider a vertex to be real if there is no origin layer on the vertices. The check on the extraction type is removed as it becomes redundant. This only modifies the check in the UV data extraction for point indices, however similar checks exist throughout the extraction code, these will be dealt with separately in master. Differential Revision: https://developer.blender.org/D14773 --- .../draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'source') 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 43aa52f08c8..2c4e7bfa802 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 @@ -387,8 +387,7 @@ static void extract_edituv_points_iter_poly_mesh(const MeshRenderData *mr, for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { const MLoop *ml = &mloop[ml_index]; - const bool real_vert = (mr->extract_type == MR_EXTRACT_MAPPED && (mr->v_origindex) && - mr->v_origindex[ml->v] != ORIGINDEX_NONE); + const bool real_vert = !mr->v_origindex || mr->v_origindex[ml->v] != ORIGINDEX_NONE; edituv_point_add( data, ((mp->flag & ME_HIDE) != 0) || !real_vert, (mp->flag & ME_FACE_SEL) != 0, ml_index); } @@ -449,9 +448,8 @@ static void extract_edituv_points_iter_subdiv_mesh(const DRWSubdivCache *subdiv_ uint end_loop_idx = (subdiv_quad_index + 1) * 4; for (uint i = start_loop_idx; i < end_loop_idx; i++) { const int vert_origindex = subdiv_loop_vert_index[i]; - const bool real_vert = (mr->extract_type == MR_EXTRACT_MAPPED && (mr->v_origindex) && - vert_origindex != -1 && - mr->v_origindex[vert_origindex] != ORIGINDEX_NONE); + const bool real_vert = !mr->v_origindex || (vert_origindex != -1 && + mr->v_origindex[vert_origindex] != ORIGINDEX_NONE); edituv_point_add(data, ((coarse_quad->flag & ME_HIDE) != 0) || !real_vert, (coarse_quad->flag & ME_FACE_SEL) != 0, @@ -543,8 +541,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr, for (int ml_index = mp->loopstart; ml_index < ml_index_end; ml_index += 1) { const MLoop *ml = &mloop[ml_index]; - const bool real_fdot = (mr->extract_type == MR_EXTRACT_MAPPED && mr->p_origindex && - mr->p_origindex[mp_index] != ORIGINDEX_NONE); + const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); const bool subd_fdot = BLI_BITMAP_TEST(facedot_tags, ml->v); edituv_facedot_add(data, ((mp->flag & ME_HIDE) != 0) || !real_fdot || !subd_fdot, @@ -553,8 +550,7 @@ static void extract_edituv_fdots_iter_poly_mesh(const MeshRenderData *mr, } } else { - const bool real_fdot = (mr->extract_type == MR_EXTRACT_MAPPED && mr->p_origindex && - mr->p_origindex[mp_index] != ORIGINDEX_NONE); + const bool real_fdot = !mr->p_origindex || (mr->p_origindex[mp_index] != ORIGINDEX_NONE); edituv_facedot_add( data, ((mp->flag & ME_HIDE) != 0) || !real_fdot, (mp->flag & ME_FACE_SEL) != 0, mp_index); } -- cgit v1.2.3