I’m trying to make some custom nodes with the template example and I don’t understand how to assign a value to the output socket or how to use the input one.
I actually found a way to do that but I have no idea if it’s the correct way for it.
The goal is just use the value of a property in another nodes.
I though that a socket has always a value attached to it and if I connect any node, it will use that value. But if I understood well, I found out that it is the opposite and the python nodes has to scan for the connected nodes and send them the values.
Am I right?
This seems to work :
def update(self):
try:
output = self.outputs["FloatOutput"]
except:
output = None
# I don't know why I can't use self.outputs["FloatOutput"] directly here, it tells me that "output" is not defined
if output:
for link in output.links:
if link.is_valid:
link.to_socket.default_value = self.outputs["FloatOutput"].default_value
I have something else to ask about custom nodes. Now I can send values to other nodes and read it from input socket but how to update it in any situation? There is a update(self) method that can be used to update values when nodes are connected. But it is not updated when properties or frames are changed. How to to that?