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
This commit is contained in:
parent
eb54624a9a
commit
f1104c2828
Notes:
blender-bot
2023-02-14 08:42:54 +01:00
Referenced by issue #78369, Sculpt Vertex Colors render as black color (when the Vertex Color node is used, Attribute node is fine)
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue