diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-05-12 11:25:20 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-05-12 11:29:13 +0300 |
commit | 0eb2244f0ae785aec08e608458804b780ea4957b (patch) | |
tree | 97203b66ad5820bf22ee0a79b5d99acc4855741e /source/blender/nodes | |
parent | 295b6e8230de011dcce62716c76604dd93b9880c (diff) |
color attributes: Fix broken vertex color node
Fall back onto the old behavior (use the render
color attribute) if the vertex color node's
attribute name is blank.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r-- | source/blender/nodes/shader/nodes/node_shader_vertex_color.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc index a2a9aa9ad91..cba944c671c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc @@ -42,10 +42,20 @@ static int node_shader_gpu_vertex_color(GPUMaterial *mat, GPUNodeStack *out) { NodeShaderVertexColor *vertexColor = (NodeShaderVertexColor *)node->storage; - /* NOTE: using CD_AUTO_FROM_NAME instead of CD_MCOL or CD_PROP_COLOR as geometry nodes may - * overwrite data which will also change the CustomDataType. This will also make EEVEE and Cycles + /* NOTE: using CD_AUTO_FROM_NAME instead of CD_MCOL or CD_PROP_COLOR for named attributes + * as geometry nodes may overwrite data which will also change the CustomDataType. + * This will also make EEVEE and Cycles * consistent. See T93179. */ - GPUNodeLink *vertexColorLink = GPU_attribute(mat, CD_AUTO_FROM_NAME, vertexColor->layer_name); + + GPUNodeLink *vertexColorLink; + + if (vertexColor->layer_name[0]) { + vertexColorLink = GPU_attribute(mat, CD_AUTO_FROM_NAME, vertexColor->layer_name); + } + else { /* Fall back on active render color attribute. */ + vertexColorLink = GPU_attribute(mat, CD_MCOL, vertexColor->layer_name); + } + return GPU_stack_link(mat, node, "node_vertex_color", in, out, vertexColorLink); } |