.new() does not work when trying to create new sockets on a group input or group output node #50417

Closed
opened 2017-01-11 23:46:54 +01:00 by Jacob Morris · 9 comments

Broken: 2.75-2.78
Worked: I ran code like this before and it worked, but I cannot remember a version number

Short description of error
Adding a new input socket to a group output node and adding a new output socket to a group input node do not work. If you run the code below, the lines that try and add sockets have no affect. I found a workaround, which is linking to the NodeSocketVirtual multiple times.

Exact steps for others to reproduce the error

import bpy

mat = bpy.data.materials.new("test")
mat.use_nodes = True    
ng = bpy.data.node_groups.new(name="issue", type="ShaderNodeTree")
nodes = ng.nodes

n = mat.node_tree.nodes.new("ShaderNodeGroup")
n.node_tree = ng

group_in = nodes.new("NodeGroupInput")
group_in.location = (-200, 0)
group_out = nodes.new("NodeGroupOutput")
group_out.location = (200, 0)
diff = nodes.new("ShaderNodeBsdfDiffuse")

group_in.outputs.new("NodeSocketColor", "color")  # line has no affect
group_out.inputs.new("NodeSocketShader", "shader")  # line has  no affect


- ng.links.new(group_in.outputs[0], diff.inputs[0])
- ng.links.new(group_in.outputs[1], diff.inputs[1])
Broken: 2.75-2.78 Worked: I ran code like this before and it worked, but I cannot remember a version number **Short description of error** Adding a new input socket to a group output node and adding a new output socket to a group input node do not work. If you run the code below, the lines that try and add sockets have no affect. I found a workaround, which is linking to the NodeSocketVirtual multiple times. **Exact steps for others to reproduce the error** ``` import bpy mat = bpy.data.materials.new("test") mat.use_nodes = True ng = bpy.data.node_groups.new(name="issue", type="ShaderNodeTree") nodes = ng.nodes n = mat.node_tree.nodes.new("ShaderNodeGroup") n.node_tree = ng group_in = nodes.new("NodeGroupInput") group_in.location = (-200, 0) group_out = nodes.new("NodeGroupOutput") group_out.location = (200, 0) diff = nodes.new("ShaderNodeBsdfDiffuse") group_in.outputs.new("NodeSocketColor", "color") # line has no affect group_out.inputs.new("NodeSocketShader", "shader") # line has no affect - ng.links.new(group_in.outputs[0], diff.inputs[0]) - ng.links.new(group_in.outputs[1], diff.inputs[1]) ```
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

Added subscriber: @BlendingJake

Added subscriber: @BlendingJake
Jacob Morris changed title from .new does not work when trying to create new sockets on a group input or group output node to .new() does not work when trying to create new sockets on a group input or group output node 2017-01-12 15:27:29 +01:00
Member

Added subscriber: @TheOnlyJoey

Added subscriber: @TheOnlyJoey
Member

I can not reproduce this working on 2.77 which does not match with the report, which version did this work on, can you retest please?

Have you tested with the 'a' releases?

I can not reproduce this working on 2.77 which does not match with the report, which version did this work on, can you retest please? Have you tested with the 'a' releases?
Author

In #50417#412525, @TheOnlyJoey wrote:
I can not reproduce this working on 2.77 which does not match with the report, which version did this work on, can you retest please?

Have you tested with the 'a' releases?

I just tested 2.75-2.78a and none of them work. I have in the past run code that used .new() to create sockets on group input and group outputs nodes, but I cannot remember a version number.

> In #50417#412525, @TheOnlyJoey wrote: > I can not reproduce this working on 2.77 which does not match with the report, which version did this work on, can you retest please? > > Have you tested with the 'a' releases? I just tested 2.75-2.78a and none of them work. I have in the past run code that used .new() to create sockets on group input and group outputs nodes, but I cannot remember a version number.
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member
ng.outputs.new("NodeSocketColor", "color")  
ng.inputs.new("NodeSocketShader", "shader")

will probably work.

``` ng.outputs.new("NodeSocketColor", "color") ng.inputs.new("NodeSocketShader", "shader") ``` will probably work.
Author

In #50417#412596, @LazyDodo wrote:

ng.outputs.new("NodeSocketColor", "color")  
ng.inputs.new("NodeSocketShader", "shader")

will probably work.

That does seem to work! However, why would group_input.outputs.new() and group_output.inputs.new() not work?

> In #50417#412596, @LazyDodo wrote: > ``` > ng.outputs.new("NodeSocketColor", "color") > ng.inputs.new("NodeSocketShader", "shader") > ``` > will probably work. That does seem to work! However, why would group_input.outputs.new() and group_output.inputs.new() not work?
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Joey Ferwerda self-assigned this 2017-01-19 17:00:54 +01:00
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#50417
No description provided.