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 | |
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')
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_codegen.c | 2 |
3 files changed, 24 insertions, 7 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; } diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 780c3d6a217..695214bcc2f 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -1015,7 +1015,8 @@ static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, Pointer if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); - if (RNA_collection_length(&dataptr, "sculpt_vertex_colors")) { + if (U.experimental.use_sculpt_vertex_colors && + RNA_collection_length(&dataptr, "sculpt_vertex_colors")) { uiItemPointerR( layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL); } diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index c1e7933d7ba..0a1d6f560b6 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -649,6 +649,8 @@ static const char *attr_prefix_get(CustomDataType type) return "t"; case CD_MCOL: return "c"; + case CD_PROP_COLOR: + return "c"; case CD_AUTO_FROM_NAME: return "a"; default: |