Get python access to selected node input/output socket


It’s possible in the node editor to “select” a node input by Shift+LeftMouseClick (in the screenshot above Emission > Strength and Material Output > Volume inputs are selected)
So I wonder if it is possible via python to know what is the input I highlighted.

For the wider picture, I wish to make a little addon that lets the user to pick an input, drag it and drop a new linked node with the starting value: eg I drag that Strength input from Emission node, release the mouse into empty space and then a new Value node gets created with a value of 6.000
Similarly it would work with RGBs and Vectors.

The inputs are numerated from ‘up’ to ‘down’ position in the node. So, in the image, your highlighted
input is ‘node.inputs[1]’.

1 Like

Thanks for replying. What I would like to know is if it’s possible to retrieve the input [number] being clicked

Bumping this for devs…

1 Like

Maybe see the node wrangler add-on for an implementation, it can handle clicking on node outputs.

1 Like

I actually took a quick look, but parsing 4000+ lines is hard…
Anyway, what I need is not in Node Wrangler. I disabled it and, in the compositor node editor I can Ctrl+Shift+Click on a specific output to link it to a viewer node. That. The info editor doesn’t give clues on what happens.