Setting all default_values of nodes to 0 does not result in expected black output What I am trying to accomplish?

I am iterating over all nodes of one named material from the output node and going backwards and want to set all inputs.default_value to 0.

I use the Code from sambler on blender.stackoverflow to iterate.


Why does it has no impact if I just set the input.default_values on the outermost level. There is a "Node Group" and I do have to set the default_values for it's child nodes to get any change at all. I would have expected the outer two RGB inputs "Paint Color" and "Specular Color" to be the input for the "Node Group" and therefore affect the rendering. This would be the behaviour of the blender UI and I expected the API model behind it to behave the same.
What node attributes beside "default_value" am I missing, as clearly default_value and in case of default_values of multiple dimensions like RGBA default_value[0..3] are not the only possible input values in the node_tree, otherwise I would expect a black output again (the outer spherelike object has only assigned this one material!)


Which scene am I using?

Scene: Metallic Paint by elbrujodelatribu on blendswap

What output do I expect

The object to be black as the material has only two RGB inputs for the "Paint Color" as well as the "Specular Color" and both the volume as well as the displacement input should not matter.

What do I get



This is the image with all inputs.default_values set to 0. The red outer object should actually be black but it still has a huge red component as well as a strong reflection.
Some nodes like the RGB nodes have only outputs and they have to be processed as well if one wants to controll all possible inputs using the API. Also some nodes could have additional variables like "operation" mode or "use_clamp" in the Multiply node.



To gain complete control it is necessary to look at inputs as well as outputs. In the node setup above the RGB nodes are the main expected user input/control. These nodes do not have any input-(sockets) only one output(-socket). In the node editor this is obvious as the RGB node has no input socket. Working with the autocompletion in the blender python console does not reveal this information as easily.



If we expand the metallic paint material in this blendswap scene by elbrujodealtribu we see that there are even more cases to consider. The Multiply node has also a boolean use_clamp this will require special treatment. The second value of the multiply node is not linked and therefore would require to be set while the first value of the Multiply node is linked and therefore does not require to be set. Therefore each type of node (node.type) will likely require special treatment