Fix T69051 Vertex Paint: Selection not show in vertex select mode.

This commit is contained in:
Clément Foucault 2019-08-26 18:43:46 +02:00
parent 1a6491639a
commit 7273dbd47b
Notes: blender-bot 2023-02-14 08:08:54 +01:00
Referenced by issue #69051, Vertex / Weight Paint. Blender does not show if vertex is selected.
2 changed files with 14 additions and 4 deletions

View File

@ -1433,7 +1433,7 @@ static void extract_pos_nor_loop_mesh(const MeshRenderData *mr,
int l,
const MLoop *mloop,
int UNUSED(p),
const MPoly *mpoly,
const MPoly *UNUSED(mpoly),
void *_data)
{
MeshExtract_PosNor_Data *data = _data;
@ -1442,9 +1442,9 @@ static void extract_pos_nor_loop_mesh(const MeshRenderData *mr,
copy_v3_v3(vert->pos, mvert->co);
vert->nor = data->packed_nor[mloop->v];
/* Flag for paint mode overlay. */
if (mpoly->flag & ME_HIDE)
if (mvert->flag & ME_HIDE)
vert->nor.w = -1;
else if (mpoly->flag & ME_FACE_SEL)
else if (mvert->flag & SELECT)
vert->nor.w = 1;
else
vert->nor.w = 0;
@ -1526,7 +1526,7 @@ static void *extract_lnor_init(const MeshRenderData *mr, void *buf)
{
static GPUVertFormat format = {0};
if (format.attr_len == 0) {
GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 3, GPU_FETCH_INT_TO_FLOAT_UNIT);
GPU_vertformat_attr_add(&format, "nor", GPU_COMP_I10, 4, GPU_FETCH_INT_TO_FLOAT_UNIT);
GPU_vertformat_alias_add(&format, "lnor");
}
GPUVertBuf *vbo = buf;
@ -1561,6 +1561,13 @@ static void extract_lnor_loop_mesh(
else {
((GPUPackedNormal *)data)[l] = GPU_normal_convert_i10_v3(mr->poly_normals[p]);
}
/* Flag for paint mode overlay. */
if (mpoly->flag & ME_HIDE)
((GPUPackedNormal *)data)[l].w = -1;
else if (mpoly->flag & ME_FACE_SEL)
((GPUPackedNormal *)data)[l].w = 1;
else
((GPUPackedNormal *)data)[l].w = 0;
}
static const MeshExtract extract_lnor = {

View File

@ -549,6 +549,7 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, int mode)
{
GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.lines_paint_mask);
GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.pos_nor);
GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.lnor);
}
GPU_BATCH_DISCARD_SAFE(cache->batch.surface);
GPU_BATCH_DISCARD_SAFE(cache->batch.wire_loops);
@ -1140,6 +1141,8 @@ void DRW_mesh_batch_cache_create_requested(
}
if (DRW_batch_requested(cache->batch.wire_loops, GPU_PRIM_LINES)) {
DRW_ibo_request(cache->batch.wire_loops, &mbufcache->ibo.lines_paint_mask);
/* Order matters. First ones override latest vbos' attribs. */
DRW_vbo_request(cache->batch.wire_loops, &mbufcache->vbo.lnor);
DRW_vbo_request(cache->batch.wire_loops, &mbufcache->vbo.pos_nor);
}
if (DRW_batch_requested(cache->batch.wire_edges, GPU_PRIM_LINES)) {