0
$\begingroup$

I am trying to remove output socket from custom group. Unfortunately, when i use code below only socket outside of the node is removed, but "group_output" node inside the custom group still has said output socket. [][1]

File if you want to see it for yourself. Selected grouped node and run the script

The code below will try to remove first output socket of selected custom group.

import bpy

obj = bpy.context.object
mat = obj.active_material
nodes = [ n for n in mat.node_tree.nodes if n.select ]
    
if nodes:
    for n in nodes:
        n.outputs.remove(n.outputs[0])
$\endgroup$

1 Answer 1

1
$\begingroup$

Question is answered: when removing output socket you have to refer to the node_tree.outputs and not to the outputs of the node itself. In this case everything works fine

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.