Detecting What Sockets Are Connected To Self Node?

Hi All,

I have been trying to figure out a reliable way to interrogate node sockets so I can fetch the correctly connected value. Does anyone have any working code for this task? I have seen simple example code, but it becomes more complicated when you are mixing types and there are multiple outputs.

Blender does not seem to have a way to fetch the exact socket that is connected to any given input.

Consider my screen shot. What line of code would I put in my String Node draw event to correctly fetch the connected socket value? I can not just blindly fetch an index (such as [0]) so I am stuck trying to figure out which socket is connected to the self at any given time.

Quite confusing…:spin:

Attachments


For HiveGUI, I ended up with a “straitjacket” solution: maintaining the connectivity state myself, and detecting all updates (add connection, remove connection) from the Blender scene.

A simpler solution (untested) is to get the NodeLink using StringNode.inputs[0].links[0]. You can then use link.from_node and link.from_socket.