Changing the order of sockets in Blender Geometry Nodes groups

We can change the order of sockets in a Blender Geometry Nodes node group manually by simply dragging it – in the N-panel in the Group – Interface tab, hold down the desired socket and drag it with the mouse to the desired place. We can move a socket in a group node to a new location using the Blender Python API with the move() function of the “interface” object.

Starting from Blender 4.1, all manipulations with node sockets are performed through the “interface” object of the node tree.

Pointer to the Geometry Nodes node tree for the current active object:

Pointer to the “interface” object of the node tree:

For example, let’s move the Float socket, which is in seventh place in order in the Group Output node, to the second place.

We can get a pointer to the desired socket by its name:

or by its type:

or, most simply, by its index number:

To move it to the second place in order, we need to use the move() function, passing in its parameters a pointer to the socket to be moved, and the index of the place where it needs to be moved.

After execution of this function, the socket will be moved to the specified position. Please note that the position index is calculated starting from zero, so 1 means move to the second place.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments