3
$\begingroup$

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.

  1. 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.
  2. 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

The final image with all values expected to be 0

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.

$\endgroup$
1
  • $\begingroup$ The reason that I did neither add a screenshot for the result without changing the material inputs to 0 as well as screenshot of the node setup is that blender.stackoverflow does not allow more than 2 links as long as the reputation is below 10. $\endgroup$ Commented Nov 1, 2015 at 23:46

1 Answer 1

2
$\begingroup$

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.

Node Setup for the example scene above

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.

Unlinked input-output

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

$\endgroup$
2
  • 1
    $\begingroup$ Could you please add some more details? $\endgroup$
    – PGmath
    Commented Nov 2, 2015 at 16:14
  • $\begingroup$ @PGmath, is this more helpful now? $\endgroup$ Commented Nov 2, 2015 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .