Thanks for taking the time, James.
can you not just assign the color node to a variable then use that throughout
You cannot, unfortunately. Although, it seems like it does work at first. The node editor shows the shader correctly connected to both materials, but only first material (the one that is the parent of the shader) is able to actually use its output. new_corona_mat2 behaves like the shader is not connected at all.
The c4d.BaseList2d documentation states:
- If you are programming shader links you need to make sure that every shader is referenced only once; it is not allowed that a shader is referenced multiple times.
- If the referencing object is a shader the referenced shader must be a child of it, otherwise it must be inserted via InsertShader().
- Example 1: A tag references a shader. The shader must be inserted into the tag using tag.InsertShader().
- Example 2: A shader (A) references another shader (B): shader B must be a child of shader A.
I assume that's why Corona's node editor uses an intermediary node, along with some under-the-hood workings to pull off shared shaders. How this actually works is what I'd like to find out.