6
$\begingroup$

I am trying to add a new input NodeSocket to an existing node using the below code:

tree = bpy.context.scene.node_tree
tree.nodes['File Output'].inputs.new('RGBA', 'Image')
tree.nodes['File Output'].update()

Below are the nodes that I have created for my blend file.

enter image description here

As shown in the above image, the "File Output" node has 5 input sockets. The above code should add a 6th one, however it is not adding. Am I missing something here?

$\endgroup$

1 Answer 1

7
$\begingroup$

Found out from here that instead of adding sockets to these node using the node.inputs collection, the node.file_slots or node.layer_slots collections should be used. Both of them work, they just provide slightly different properties for use with simple files or multi-layer EXR.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks. output_node.layer_slots.new("my_new_input_socket") $\endgroup$ Aug 25, 2018 at 21:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .