Hiding all inputs and outputs on nodes in Blender using Python API

For ease of display, all input and output sockets on nodes, both shader and geometry, can be hidden from the user. Hiding unused node inputs and outputs may be necessary to simplify the visual perception of the node tree, which can be very large and complex and does not need to be overloaded with unnecessary information.

To control the display of input and output sockets on nodes, each socket has the “hide” property of boolean type. If its value is False, the input/output socket is visually displayed on the node. If the value is True, the socket is hidden and becomes invisible.

For example, let’s hide all inputs and outputs on some node, for example, on the Principled BSDF.

A pointer to the node itself:

Loop through all its input sockets and hide them.

For convenience, we can not only hide the socket, but invert the value of its “hide” property. In this case, each time the script runs, the input socket will either be hidden if it was displayed, or shown back if it was hidden.

The same applies to output sockets.

For Geometry Nodes, everything works exactly the same.

For example, do the same operation for the Dial Gizmo node.

For its input sockets.

And for outputs.

Note that if a socket has a link from another node connected to it, even setting the “hide” property to True will not hide this socket.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments