By default, shader nodes in Blender have all input and output sockets in the shape of a circle. However, if necessary, the shape of the socket can be changed.
We can change the shape of the socket for any shader node through the “display_shape” property of the corresponding node input or output.
For example, for the first input of the active node:
We can get the current socket shape like this:
1 2 3 |
bpy.context.object.active_material.node_tree.nodes.active.inputs[0].display_shape # 'CIRCLE' |
And change the shape for this input with a simple assignment:
1 |
bpy.context.object.active_material.node_tree.nodes.active.inputs[0].display_shape = 'SQUARE' |
The following values are available for assignment:
- CIRCLE
- SQUARE
- DIAMOND
- CIRCLE_DOT
- SQUARE_DOT
- DIAMOND_DOT
The Geometry Nodes socket’s shape cannot be changed, because in geometry nodes, each type of socket is assigned to a specific data type that can interact with the current input or output of the node.
Although we can get the current value of the socket shape for a geometry node:
1 2 3 |
bpy.context.object.modifiers['GeometryNodes'].node_group.nodes.active.inputs[0].display_shape # 'CIRCLE' |