Node Wrangler Lazy Connect changed behaviour. #104470

Closed
opened 2023-03-08 19:37:02 +01:00 by Paul · 11 comments

System Information
Operating system: Windows-10-10.0.19044-SP0 64 Bits
Graphics card: AMD Radeon (TM) R9 390 Series ATI Technologies Inc. 4.5.14800 Core Profile Context 22.10.1 31.0.12019.16007

Blender Version
Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-03-08 01:03, hash: d6d2e98e5ede
Worked: 3.41

Lazy connect creates red line instead of new output.

  • Turn on node wrangler
    
  • Add math node
    
  • Make a group of it
    
  • Add another math inside this group
    
  • Use alt+right click drag from second math node to group output
    
    It produces red line connection while in 3.41 it was making another working group output.
**System Information** Operating system: Windows-10-10.0.19044-SP0 64 Bits Graphics card: AMD Radeon (TM) R9 390 Series ATI Technologies Inc. 4.5.14800 Core Profile Context 22.10.1 31.0.12019.16007 **Blender Version** Broken: version: 3.5.0 Beta, branch: blender-v3.5-release, commit date: 2023-03-08 01:03, hash: d6d2e98e5ede Worked: 3.41 Lazy connect creates red line instead of new output. * Turn on node wrangler * Add math node * Make a group of it * Add another math inside this group * Use alt+right click drag from second math node to group output It produces red line connection while in 3.41 it was making another working group output.
Paul added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-03-08 19:37:02 +01:00
Germano Cavalcante added
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-03-08 20:04:33 +01:00
Member

Bisecting points to this commit.

Bisecting points to [this commit](https://projects.blender.org/blender/blender/commit/70260960994d6cce3a33dfc16b4911a6cab9d4f2).
@HooglyBoogly ^
Member

This happened following an API change.

Node Wrangler needs to be refactored to check that new links’ input and output exist, and if not, create them, something like:

import bpy

node_tree = bpy.data.node_groups['NodeGroup']

src_node = node_tree.nodes['Math']
dst_node = node_tree.nodes['Group Output']

output_socket = src_node.outputs[0]
input_socket = dst_node.inputs[-1]

if dst_node.type == 'GROUP_OUTPUT' and type(input_socket) == bpy.types.NodeSocketVirtual:
    node_tree.outputs.new(type(output_socket).__name__, output_socket.name)
    input_socket = node_tree.nodes['Group Output'].inputs[-2]
    
if src_node.type == 'GROUP_INPUT' and type(output_socket) == bpy.types.NodeSocketVirtual:
    node_tree.inputs.new(type(input_socket).__name__, input_socket.name)
    output_socket = node_tree.nodes['Group Input'].outputs[-2]
    
node_tree.links.new(input_socket, output_socket)

This doesn’t look too practical, maybe there are better APIs I couldn’t find?

This happened following [an API change](https://wiki.blender.org/wiki/Reference/Release_Notes/3.5/Python_API#Node_Group_Input_Output_Creation_with_virtual_sockets). Node Wrangler needs to be refactored to check that new links’ input and output exist, and if not, create them, something like: ```python import bpy node_tree = bpy.data.node_groups['NodeGroup'] src_node = node_tree.nodes['Math'] dst_node = node_tree.nodes['Group Output'] output_socket = src_node.outputs[0] input_socket = dst_node.inputs[-1] if dst_node.type == 'GROUP_OUTPUT' and type(input_socket) == bpy.types.NodeSocketVirtual: node_tree.outputs.new(type(output_socket).__name__, output_socket.name) input_socket = node_tree.nodes['Group Output'].inputs[-2] if src_node.type == 'GROUP_INPUT' and type(output_socket) == bpy.types.NodeSocketVirtual: node_tree.inputs.new(type(input_socket).__name__, input_socket.name) output_socket = node_tree.nodes['Group Input'].outputs[-2] node_tree.links.new(input_socket, output_socket) ``` This doesn’t look too practical, maybe there are better APIs I couldn’t find?
Member

@pioverfour Thanks for checking, indeed that's probably the best way to do it.

@pioverfour Thanks for checking, indeed that's probably the best way to do it.
Author

Don't know if this can be helpful, but when I try to add two nodes (add or align vector to normal) with ctrl+shift+right click drag to each other, I'm getting this error:

Python: Traceback (most recent call last):
  File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\addons\node_wrangler\__init__.py", line 893, in modal
    bpy.ops.node.nw_merge_nodes(mode="MIX", merge_type="AUTO")
  File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\modules\bpy\ops.py", line 113, in __call__
    ret = _op_call(self.idname_py(), None, kw)
RuntimeError: Error: Python: Traceback (most recent call last):
  File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\addons\node_wrangler\__init__.py", line 2143, in execute
    add.operation = mode
TypeError: bpy_struct: item.attr = val: enum "MIX" not found in ('ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE', 'MULTIPLY_ADD', 'POWER', 'LOGARITHM', 'SQRT', 'INVERSE_SQRT', 'ABSOLUTE', 'EXPONENT', 'MINIMUM', 'MAXIMUM', 'LESS_THAN', 'GREATER_THAN', 'SIGN', 'COMPARE', 'SMOOTH_MIN', 'SMOOTH_MAX', 'ROUND', 'FLOOR', 'CEIL', 'TRUNC', 'FRACT', 'MODULO', 'WRAP', 'SNAP', 'PINGPONG', 'SINE', 'COSINE', 'TANGENT', 'ARCSINE', 'ARCCOSINE', 'ARCTANGENT', 'ARCTAN2', 'SINH', 'COSH', 'TANH', 'RADIANS', 'DEGREES')
Location: C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\modules\bpy\ops.py:113

Don't know if this can be helpful, but when I try to add two nodes (add or align vector to normal) with ctrl+shift+right click drag to each other, I'm getting this error: ``` Python: Traceback (most recent call last): File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\addons\node_wrangler\__init__.py", line 893, in modal bpy.ops.node.nw_merge_nodes(mode="MIX", merge_type="AUTO") File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\modules\bpy\ops.py", line 113, in __call__ ret = _op_call(self.idname_py(), None, kw) RuntimeError: Error: Python: Traceback (most recent call last): File "C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\addons\node_wrangler\__init__.py", line 2143, in execute add.operation = mode TypeError: bpy_struct: item.attr = val: enum "MIX" not found in ('ADD', 'SUBTRACT', 'MULTIPLY', 'DIVIDE', 'MULTIPLY_ADD', 'POWER', 'LOGARITHM', 'SQRT', 'INVERSE_SQRT', 'ABSOLUTE', 'EXPONENT', 'MINIMUM', 'MAXIMUM', 'LESS_THAN', 'GREATER_THAN', 'SIGN', 'COMPARE', 'SMOOTH_MIN', 'SMOOTH_MAX', 'ROUND', 'FLOOR', 'CEIL', 'TRUNC', 'FRACT', 'MODULO', 'WRAP', 'SNAP', 'PINGPONG', 'SINE', 'COSINE', 'TANGENT', 'ARCSINE', 'ARCCOSINE', 'ARCTANGENT', 'ARCTAN2', 'SINH', 'COSH', 'TANH', 'RADIANS', 'DEGREES') Location: C:\BLENDER ALPHA\daily\blender-3.5.0-beta+daily.5332537fc560\3.5\scripts\modules\bpy\ops.py:113 ```
Member

@genesis2303 Hi, thanks for the information. This error looks more like #104480, which was hopefully fixed today. Can you try again with a more recent build?

@genesis2303 Hi, thanks for the information. This error looks more like #104480, which was hopefully fixed today. Can you try again with a more recent build?
Author

@pioverfour as soon as I will see it in Blender Launcher, didn't see beta build today yet. On 3.6 alpha which would be the latest for now, I don't get error while quick adding nodes shortcut, but still get red line connections inside nodegroup.

@pioverfour as soon as I will see it in Blender Launcher, didn't see beta build today yet. On 3.6 alpha which would be the latest for now, I don't get error while quick adding nodes shortcut, but still get red line connections inside nodegroup.
Member

@genesis2303 Yes, the red lines are not fixed yet. But if you didn’t get the error it’s pretty nice already!

@genesis2303 Yes, the red lines are not fixed yet. But if you didn’t get the error it’s pretty nice already!
Author

@pioverfour yep clean adding no error, both vector nodes and float, and color nodes.

@pioverfour yep clean adding no error, both vector nodes and float, and color nodes.
Author

So this goes to like corrected 3.5.1?

So this goes to like corrected 3.5.1?
Paul closed this issue 2023-03-29 11:03:17 +02:00
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-03-29 11:03:18 +02:00
Paul reopened this issue 2023-03-29 11:03:25 +02:00
Blender Bot added
Status
Needs Triage
and removed
Status
Archived
labels 2023-03-29 11:03:26 +02:00
Member

So this goes to like corrected 3.5.1?

It will be fixed in 3.6, not any subversion of 3.5.

> So this goes to like corrected 3.5.1? It will be fixed in 3.6, not any subversion of 3.5.
Damien Picard added
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-03-29 11:08:25 +02:00
Damien Picard self-assigned this 2023-04-12 14:34:40 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-04-12 15:41:20 +02:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
4 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-addons#104470
No description provided.