Compositor node tree .links.new does not create group input/output in Blender 3.5 beta #105701

Closed
opened 2023-03-12 20:22:26 +01:00 by Ben Rugg · 10 comments

System Information
Operating system: macOS-12.6.2-arm64-arm-64bit 64 Bits
Graphics card: Metal API Apple M1 Max 1.2

Blender Version
Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-03-11 07:27, hash: 7d22b1135248
Worked: (newest version of Blender that worked as expected)

Short description of error
Compositor node tree .links.new does not create group input/output in Blender 3.5 beta. (This works in all previous versions of Blender).

Exact steps for others to reproduce the error

# create a new compositor node group and add its input and output nodes
scene = bpy.context.scene
scene.use_nodes = True
compositor_nodes = scene.node_tree.nodes

node_tree = bpy.data.node_groups.new('new_group', 'CompositorNodeTree')

node_group = compositor_nodes.new('CompositorNodeGroup')
node_group.node_tree = node_tree
node_group.location = (400, 500)

group_input = node_tree.nodes.new(type='NodeGroupInput')
group_input.location = (0, 30)

group_output = node_tree.nodes.new(type='NodeGroupOutput')
group_output.location = (620, 0)

# create a new image mix rgb node in the group, just as an example
mix_node = node_tree.nodes.new(type='CompositorNodeMixRGB')
mix_node.location = (350, 75)

# create links to the group input and output nodes
# NOTE: HERE IS THE BUG. The links are created, but actual input and 
# outputs are not. In previous versions of Blender, the group would now
# have a usable input and output.
node_tree.links.new(group_input.outputs[0], mix_node.inputs[1])
node_tree.links.new(mix_node.outputs.get('Image'), group_output.inputs[0])

This seems to be replicable every time, on both Mac and Windows.

**System Information** Operating system: macOS-12.6.2-arm64-arm-64bit 64 Bits Graphics card: Metal API Apple M1 Max 1.2 **Blender Version** Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-03-11 07:27, hash: `7d22b1135248` Worked: (newest version of Blender that worked as expected) **Short description of error** Compositor node tree `.links.new` does not create group input/output in Blender 3.5 beta. (This works in all previous versions of Blender). **Exact steps for others to reproduce the error** ``` # create a new compositor node group and add its input and output nodes scene = bpy.context.scene scene.use_nodes = True compositor_nodes = scene.node_tree.nodes node_tree = bpy.data.node_groups.new('new_group', 'CompositorNodeTree') node_group = compositor_nodes.new('CompositorNodeGroup') node_group.node_tree = node_tree node_group.location = (400, 500) group_input = node_tree.nodes.new(type='NodeGroupInput') group_input.location = (0, 30) group_output = node_tree.nodes.new(type='NodeGroupOutput') group_output.location = (620, 0) # create a new image mix rgb node in the group, just as an example mix_node = node_tree.nodes.new(type='CompositorNodeMixRGB') mix_node.location = (350, 75) # create links to the group input and output nodes # NOTE: HERE IS THE BUG. The links are created, but actual input and # outputs are not. In previous versions of Blender, the group would now # have a usable input and output. node_tree.links.new(group_input.outputs[0], mix_node.inputs[1]) node_tree.links.new(mix_node.outputs.get('Image'), group_output.inputs[0]) ``` This seems to be replicable every time, on both Mac and Windows.
Ben Rugg added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-12 20:22:27 +01:00

#105619 (comment) #100770 (comment)
Hello. This problem can be described by these 2 answers ^. After referring to them, I will close this as expected behavior.

https://projects.blender.org/blender/blender/issues/105619#issuecomment-898440 https://projects.blender.org/blender/blender/issues/100770#issuecomment-892687 Hello. This problem can be described by these 2 answers ^. After referring to them, I will close this as expected behavior.
Blender Bot added
Status
Archived
and removed
Status
Needs Triage
labels 2023-03-12 20:38:40 +01:00
Iliya Katushenock added the
Interest
Nodes & Physics
Interest
Python API
labels 2023-03-12 20:38:49 +01:00
Author

@mod_moder Thank you for the quick response. I think this is very similar (and not quite a duplicate) to #105283 and #105619. I believe all three issues are regressions, and not intended behavior.

(As far as I can tell, there is no fix or workaround for this change in python).

@mod_moder Thank you for the quick response. I think this is very similar (and not quite a duplicate) to #105283 and #105619. I believe all three issues are regressions, and not intended behavior. (As far as I can tell, there is no fix or workaround for this change in python).

This is not a regression. You just need to manually create a socket for a node group (as in answer number 2) and then connect them with a link (as in answer number 1)

This is not a regression. You just need to manually create a socket for a node group (as in answer number 2) and then connect them with a link (as in answer number 1)
Author

@mod_moder Ok, understood. I still can't get that change to work. I have tried every variation of this: node_tree.inputs.new('RGBA', 'Image') and it always throws the error RuntimeError: Error: Unable to create socket.

I recognize that this is not a support forum, but any help you can send my way would be much appreciated!

@mod_moder Ok, understood. I still can't get that change to work. I have tried every variation of this: `node_tree.inputs.new('RGBA', 'Image')` and it always throws the error `RuntimeError: Error: Unable to create socket`. I recognize that this is not a support forum, but any help you can send my way would be much appreciated!

Hm, I'm not sure myself. I'll ask someone who is familiar with python api better than me

Hm, I'm not sure myself. I'll ask someone who is familiar with python api better than me
Author

@mod_moder thank you so much

@mod_moder thank you so much

@benrugg (as Jacques suggested) Try NodeSocketColor instead of GRBA

@benrugg (as Jacques suggested) Try `NodeSocketColor` instead of `GRBA`
Author

@mod_moder thank you, that works! And blessedly, it works in previous versions of Blender as well 😅

I believe this change is going to affect many people, and will need to be documented very clearly.

@mod_moder thank you, that works! And blessedly, it works in previous versions of Blender as well 😅 I believe this change is going to affect many people, and will need to be documented very clearly.
Author
For anyone finding this issue in the future, here is the fix (see the NOTE near the end):
# create a new compositor node group and add its input and output nodes
scene = bpy.context.scene
scene.use_nodes = True
compositor_nodes = scene.node_tree.nodes

node_tree = bpy.data.node_groups.new('new_group', 'CompositorNodeTree')

node_group = compositor_nodes.new('CompositorNodeGroup')
node_group.node_tree = node_tree
node_group.location = (400, 500)

group_input = node_tree.nodes.new(type='NodeGroupInput')
group_input.location = (0, 30)

group_output = node_tree.nodes.new(type='NodeGroupOutput')
group_output.location = (620, 0)

# create a new image mix rgb node in the group, just as an example
mix_node = node_tree.nodes.new(type='CompositorNodeMixRGB')
mix_node.location = (350, 75)

# create the group input and output sockets
# NOTE: This is the new required step with Blender 3.5+
node_tree.inputs.new('NodeSocketColor', 'Image')
node_tree.outputs.new('NodeSocketColor', 'Image')

# create links to the group input and output nodes
node_tree.links.new(group_input.outputs[0], mix_node.inputs[1])
node_tree.links.new(mix_node.outputs.get('Image'), group_output.inputs[0])
##### For anyone finding this issue in the future, here is the fix (see the NOTE near the end): ```Py # create a new compositor node group and add its input and output nodes scene = bpy.context.scene scene.use_nodes = True compositor_nodes = scene.node_tree.nodes node_tree = bpy.data.node_groups.new('new_group', 'CompositorNodeTree') node_group = compositor_nodes.new('CompositorNodeGroup') node_group.node_tree = node_tree node_group.location = (400, 500) group_input = node_tree.nodes.new(type='NodeGroupInput') group_input.location = (0, 30) group_output = node_tree.nodes.new(type='NodeGroupOutput') group_output.location = (620, 0) # create a new image mix rgb node in the group, just as an example mix_node = node_tree.nodes.new(type='CompositorNodeMixRGB') mix_node.location = (350, 75) # create the group input and output sockets # NOTE: This is the new required step with Blender 3.5+ node_tree.inputs.new('NodeSocketColor', 'Image') node_tree.outputs.new('NodeSocketColor', 'Image') # create links to the group input and output nodes node_tree.links.new(group_input.outputs[0], mix_node.inputs[1]) node_tree.links.new(mix_node.outputs.get('Image'), group_output.inputs[0]) ```
Member

I believe this change is going to affect many people, and will need to be documented very clearly.

It is mentioned here https://wiki.blender.org/wiki/Reference/Release_Notes/3.5/Python_API

> I believe this change is going to affect many people, and will need to be documented very clearly. It is mentioned here https://wiki.blender.org/wiki/Reference/Release_Notes/3.5/Python_API
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105701
No description provided.