Node wrangler: Lazy Connect with menu doesn't work for some nodes. #94290

Closed
opened 2021-12-21 08:36:31 +01:00 by NXSK · 21 comments

System Information
Operating system: win10 20H2
Graphics card: RTX 3090

Blender Version
Broken: 3.0 stable

Short description of error
The Lazy Connect with menu operator from the node wrangler addon sometimes connects wrong sockets.
Steps to reproduce

Enable node wrangler addon.
Go to geometry nodes editor, and add a Raycast node.
Use alt+shift RMB drag to connect the group input (or any other node) to the Raycast node.
Select the Source Position socket as the input to connect to in the menu.
The link is not connected to the right socket.

**System Information** Operating system: win10 20H2 Graphics card: RTX 3090 **Blender Version** Broken: 3.0 stable **Short description of error** The Lazy Connect with menu operator from the node wrangler addon sometimes connects wrong sockets. **Steps to reproduce** Enable node wrangler addon. Go to geometry nodes editor, and add a `Raycast` node. Use `alt+shift RMB` drag to connect the group input (or any other node) to the `Raycast` node. Select the `Source Position` socket as the input to connect to in the menu. The link is not connected to the right socket.
Author

Added subscriber: @NXSK

Added subscriber: @NXSK

#98246 was marked as duplicate of this issue

#98246 was marked as duplicate of this issue

blender/blender#98768 was marked as duplicate of this issue

blender/blender#98768 was marked as duplicate of this issue

blender/blender#96334 was marked as duplicate of this issue

blender/blender#96334 was marked as duplicate of this issue
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Thanks for the report. Can you please provide a .blend file where "Lazy connect" is failing?

Thanks for the report. Can you please provide a .blend file where "Lazy connect" is failing?
Author

2022-01-10 22-59-15-326.mp4
@PratikPB2123

As this video, lazy connect is confused when connecting raycast node. And it should connect the float curve node with the value port, but it goes factor port.

[2022-01-10 22-59-15-326.mp4](https://archive.blender.org/developer/F12799109/2022-01-10_22-59-15-326.mp4) @PratikPB2123 As this video, lazy connect is confused when connecting raycast node. And it should connect the float curve node with the value port, but it goes factor port.
Member

Added subscriber: @wannes.malfait

Added subscriber: @wannes.malfait
Member

Changed status from 'Needs User Info' to: 'Confirmed'

Changed status from 'Needs User Info' to: 'Confirmed'
Member

Thanks for the report.

The connection to the Factor socket instead of the Value socket is not a bug. At the moment the code has no special knowledge about which sockets are preferred for certain nodes. Maybe this could be added with the new link dragging features.

The failed connection with the raycast node is a bug however. The problem was that only the enabled sockets are shown in the menu, but the socket indices were wrong (the index increment should have been outside the if statement).
Something like this should fix it:

diff --git a/node_wrangler.py b/node_wrangler.py
index fd29a46b..43cbd80f 100644
--- a/node_wrangler.py
+++ b/node_wrangler.py
@@ -4380,12 +4380,11 @@ class NWConnectionListOutputs(Menu, NWBase):
         nodes, links = get_nodes_links(context)
 
         n1 = nodes[context.scene.NWLazySource]
-        index=0
-        for o in n1.outputs:
+
+        for index, output in enumerate(n1.outputs):
             # Only show sockets that are exposed.
-            if o.enabled:
-                layout.operator(NWCallInputsMenu.bl_idname, text=o.name, icon="RADIOBUT_OFF").from_socket=index     
-            index+=1
+            if output.enabled:
+                layout.operator(NWCallInputsMenu.bl_idname, text=output.name, icon="RADIOBUT_OFF").from_socket=index
 
 
 class NWConnectionListInputs(Menu, NWBase):
@@ -4398,17 +4397,15 @@ class NWConnectionListInputs(Menu, NWBase):
 
         n2 = nodes[context.scene.NWLazyTarget]
 
-        index = 0
-        for i in n2.inputs:
+        for index, input in enumerate(n2.inputs):
             - Only show sockets that are exposed.
             - This prevents, for example, the scale value socket
             - of the vector math node being added to the list when
             - the mode is not 'SCALE'.
-            if i.enabled:
-                op = layout.operator(NWMakeLink.bl_idname, text=i.name, icon="FORWARD")
+            if input.enabled:
+                op = layout.operator(NWMakeLink.bl_idname, text=input.name, icon="FORWARD")
                 op.from_socket = context.scene.NWSourceSocket
                 op.to_socket = index
-                index+=1


 class NWMergeMathMenu(Menu, NWBase):


Thanks for the report. The connection to the Factor socket instead of the Value socket is not a bug. At the moment the code has no special knowledge about which sockets are preferred for certain nodes. Maybe this could be added with the new link dragging features. The failed connection with the raycast node is a bug however. The problem was that only the enabled sockets are shown in the menu, but the socket indices were wrong (the index increment should have been outside the if statement). Something like this should fix it: ``` diff --git a/node_wrangler.py b/node_wrangler.py index fd29a46b..43cbd80f 100644 --- a/node_wrangler.py +++ b/node_wrangler.py @@ -4380,12 +4380,11 @@ class NWConnectionListOutputs(Menu, NWBase): nodes, links = get_nodes_links(context) n1 = nodes[context.scene.NWLazySource] - index=0 - for o in n1.outputs: + + for index, output in enumerate(n1.outputs): # Only show sockets that are exposed. - if o.enabled: - layout.operator(NWCallInputsMenu.bl_idname, text=o.name, icon="RADIOBUT_OFF").from_socket=index - index+=1 + if output.enabled: + layout.operator(NWCallInputsMenu.bl_idname, text=output.name, icon="RADIOBUT_OFF").from_socket=index class NWConnectionListInputs(Menu, NWBase): @@ -4398,17 +4397,15 @@ class NWConnectionListInputs(Menu, NWBase): n2 = nodes[context.scene.NWLazyTarget] - index = 0 - for i in n2.inputs: + for index, input in enumerate(n2.inputs): - Only show sockets that are exposed. - This prevents, for example, the scale value socket - of the vector math node being added to the list when - the mode is not 'SCALE'. - if i.enabled: - op = layout.operator(NWMakeLink.bl_idname, text=i.name, icon="FORWARD") + if input.enabled: + op = layout.operator(NWMakeLink.bl_idname, text=input.name, icon="FORWARD") op.from_socket = context.scene.NWSourceSocket op.to_socket = index - index+=1 class NWMergeMathMenu(Menu, NWBase): ```
Wannes Malfait changed title from Node wrangler can not connect certain nodes correctly in geometry nodes. to Node wrangler: Lazy Connect with menu doesn't work for some nodes. 2022-01-12 16:32:56 +01:00

Added subscriber: @SHREY-AGGARWAL

Added subscriber: @SHREY-AGGARWAL

Is this issue solved?

Is this issue solved?
Shrey Aggarwal self-assigned this 2022-02-03 03:29:19 +01:00
Member

In #94290#1294714, @SHREY-AGGARWAL wrote:
Is this issue solved?

No not yet. I see that you claimed this task, do you have a revision?

> In #94290#1294714, @SHREY-AGGARWAL wrote: > Is this issue solved? No not yet. I see that you claimed this task, do you have a revision?

Added subscriber: @Rin-San

Added subscriber: @Rin-San

I make it like this.
nodeRepair.gif

The menu for connected nodes will no longer display options that cannot be connected.

I don't know if this is a good idea.

I make it like this. ![nodeRepair.gif](https://archive.blender.org/developer/F12920163/nodeRepair.gif) The menu for connected nodes will no longer display options that cannot be connected. I don't know if this is a good idea.
Member

Added subscribers: @DaveHuman, @lone_noel

Added subscribers: @DaveHuman, @lone_noel
Member

Added subscribers: @tempdevnova, @iss

Added subscribers: @tempdevnova, @iss
Member

Added subscribers: @billyand, @OmarEmaraDev, @pioverfour

Added subscribers: @billyand, @OmarEmaraDev, @pioverfour

This issue was referenced by b2d470058e

This issue was referenced by b2d470058ebffa59c5fdd87ff4f129bd3f17120c
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
8 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#94290
No description provided.