Details
Diff Detail
- Repository
- rB Blender
Event Timeline
Thanks for the patch. I think the node should be able to avoid calculating the color output if it's not required. That can use uninitialized_single_output_if_required, which returns an empty span if the output is not needed.
Honestly it feels weird for this node to output a color if it's just the same on value on every channel, implicit conversion should make that unnecessary. But that's not something to change in this patch.
It's also odd how it sometimes only uses one element from the vector, but still has a vector input-- that's a bad practice IMO. But that's also out of scope here. I made a task so we don't forget to look into that: T91907
Assuming you've verified the output is the same as the shader nodes, the code looks fine to me.
| source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc | ||
|---|---|---|
| 100–108 | Declare intermediate variables const wherever possible. | |
Yes, I think this code has travelled from Blender Internal > Cycles and now GN/FN. The color output certainly doesn't make any sense.
