diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-15 19:52:01 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-15 19:55:33 +0300 |
commit | f1104c2828868b8ffd6135671f2ff3926365813a (patch) | |
tree | 6931dfcba93adb23b12df96d079d179a819e49ec /source/blender/draw | |
parent | eb54624a9a1dcfe93eec8bc98db0c0bbcccc1732 (diff) |
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
Diffstat (limited to 'source/blender/draw')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 26 |
1 files changed, 20 insertions, 6 deletions
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 @@ -203,16 +203,17 @@ static DRW_MeshCDMask mesh_cd_calc_used_gpu_layers(const Mesh *me, 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; } |