From f1104c2828868b8ffd6135671f2ff3926365813a Mon Sep 17 00:00:00 2001 From: Pablo Dobarro Date: Wed, 15 Jul 2020 18:52:01 +0200 Subject: Fix T78369: Sculpt Vertex Colors not rendering in EEVEE The vertex colors node was using the M_COL attribute type but Sculpt Vertex Colors use CD_PROP_COLOR Now the Vertex Color node also fallbacks to legacy vertex colors if Scultp Vertex Colors are not enabled as experimental. Reviewed By: brecht Maniphest Tasks: T78369 Differential Revision: https://developer.blender.org/D8185 --- source/blender/draw/intern/draw_cache_impl_mesh.c | 26 +++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'source/blender/draw/intern/draw_cache_impl_mesh.c') diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 40de0794b9e..e69fb795948 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -202,17 +202,18 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPUV, name); type = CD_MTFACE; - if (layer == -1) { - layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPCOL, name); - type = CD_MCOL; - } - if (layer == -1) { if (U.experimental.use_sculpt_vertex_colors) { layer = CustomData_get_named_layer(cd_vdata, CD_PROP_COLOR, name); type = CD_PROP_COLOR; } } + + if (layer == -1) { + layer = CustomData_get_named_layer(cd_ldata, CD_MLOOPCOL, name); + type = CD_MCOL; + } + #if 0 /* Tangents are always from UV's - this will never happen. */ if (layer == -1) { layer = CustomData_get_named_layer(cd_ldata, CD_TANGENT, name); @@ -262,13 +263,26 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, } case CD_PROP_COLOR: { /* Sculpt Vertex Colors */ + bool use_mloop_cols = false; if (layer == -1) { layer = (name[0] != '\0') ? CustomData_get_named_layer(cd_vdata, CD_PROP_COLOR, name) : CustomData_get_render_layer(cd_vdata, CD_PROP_COLOR); + /* Fallback to Vertex Color data */ + if (layer == -1) { + layer = (name[0] != '\0') ? + CustomData_get_named_layer(cd_ldata, CD_MLOOPCOL, name) : + CustomData_get_render_layer(cd_ldata, CD_MLOOPCOL); + use_mloop_cols = true; + } } if (layer != -1) { - cd_used.sculpt_vcol |= (1 << layer); + if (use_mloop_cols) { + cd_used.vcol |= (1 << layer); + } + else { + cd_used.sculpt_vcol |= (1 << layer); + } } break; } -- cgit v1.2.3