Hi I was wondering if someone could help me understand this better.
For my script, I’ve added a material with a single ‘Blackbody’ node and I want to access its output which is in RGBA. I’ve attempted something like this: bpy.data.materials['MyMaterial'].node_tree.nodes['Blackbody'].outputs
though I think this is only referencing the actual output of the node to be linked with other nodes.
I also tried something like creating a new variable that stores the RGBA components from the default_value, though it seems that default_value never changes (as the name would suggest).
My question is; is it even possible to read these values? Is this a limitation? Am I doing it wrong and if so how should I go about doing this? I’m just a bit lost so any explanation would be very appreciated!
The nodes in a nodegraph are only a visual representation they do not actually do anything, at render time they get compiled into a shader program that’ll either run on the gpu or cpu but you can’t query a nodes outputs from python. It also doesn’t really make a whole lot of sense in most cases, when you query the output of a noise texture in a node graph what are you expecting to see there? or a glossy node?
if you need the output of a node, sticking it into an emission node and baking it is an option…
‘Outputs’, like inputs, is only a socket… if this socket is NodeSocketColor, you can read a color values from it… or a float if is a NodeSocketFloat. ??
Edit… my answer is more a question than an answer.
‘Outputs’, like inputs, is only a socket… if this socket is NodeSocketColor, you can read a color values from it… or a float if is a NodeSocketFloat
Think the point was that the value you read isn’t very useful (ie when you read the output of a math node that adds 2+3 it won’t be 5) since the nodes in a materials nodegraph are only a blueprint for the shader it doesn’t execute any of the logic.
i am also looking to achieve something like this, can please help me in fetching RGB values of object material for all the frames where shader nodes have been used to change colors ? I cannot able to fetch values with scripting by using bpy.data, materials[‘material1’].node_tree.nodes[‘separate RGB’].outputs