2
$\begingroup$

Is there a way to get the position (x/y coordinates) of a socket on a node in the node editor?

I'm working on auto layout functionality and having the actual socket position would make it much more useful.

$\endgroup$
2
$\begingroup$

You can get the location of a Node as well as the width and height, but the position of the socket does not seem to be available. This is likely to be because nodes can be in collapsed or expanded states and so a particular socket may or may not be visible at any given time.

You should be able to get pretty far knowing the dimensions and location of the node itself though. You know that all inputs are on the left side and all outputs on the right, and you can find out which nodes are linked to which, so you could do a topological sort and arrange the nodes with some minimum amount of spacing.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.