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.
'''A custom node'''
bl_idname = 'CustomNodeType'
bl_label = 'Custom Node'
def init(self, context):
It creates well the sockets, but then, how to manipulate them and give a real value to the outputs of the node?
do u need to do it that way ?
I have another way to set I/O
but not like that !
but depends also what you want to do with it
can you elaborate a little !
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 :
output = self.outputs["FloatOutput"]
output = None
# I don't know why I can't use self.outputs["FloatOutput"] directly here, it tells me that "output" is not defined
for link in output.links:
link.to_socket.default_value = self.outputs["FloatOutput"].default_value
sorry might be possible but have not really work with this method
there might be some other thread using this method !
What is your method? Maybe it is better
try to run this script
with this you can set almost any of the mat or links for any nodes
addcubecolor1.blend (103 KB)
Oh no no, I was talking about the Python nodes. I need new nodes that doesn’t exist and that is not possible to do with groups.
I suppose the solution I found is correct, but don’t find a lot of documentation about it.
like custom nodes !
don’t have much on that would also like to see more !
but I guess idea should be the same for I/O or links !
hope some one else can show some examples for custom nodes
there is a template for custom nodes in text editor !
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?
I know that atom did work on custom nodes with frames
try to search for custom nodes in forum !