Maniphest T94815

Drag to add node search prioritizes wrong node type
Confirmed, LowBUG

Assigned To
Shrey Aggarwal (shrey_agg)
Authored By
Ludvik Koutny (rawalanche)
Jan 11 2022, 1:41 PM
Tags
  • BF Blender
  • Geometry Nodes
  • Nodes & Physics
  • Good First Issue
Subscribers
Behe eddine (Behija)
Hans Goudey (HooglyBoogly)
Ludvik Koutny (rawalanche)
Pratik Borhade (PratikPB2123)

Description

System Information
Operating system: Windows-10-10.0.19042-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 496.76

Blender Version
Broken: version: 3.1.0 Alpha, branch: master, commit date: 2022-01-10 22:45, hash: rB922ae55a16a9
Worked: (newest version of Blender that worked as expected)

Short description of error
When using node socket drag search, the search results prioritize wrong type of the node considering the socket type it was dragged out of. When dragging out a Vector type socket, and searching for "Combine", the search prioritizes Combine RGB node instead of Combine XYZ node, which is more appropriate for the given socket type.

Exact steps for others to reproduce the error

  1. In GN editor, drag out a Vector type input out of any node
  2. Search for "combine"

Result: The highlighted result is Combine RGB node
Expected: The highlighted result is Combine XYZ node

Revisions and Commits

Event Timeline

Ludvik Koutny (rawalanche) created this task.Jan 11 2022, 1:41 PM
Pratik Borhade (PratikPB2123) added projects: Geometry Nodes, Nodes & Physics.Jan 12 2022, 11:22 AM
Pratik Borhade (PratikPB2123) added a subscriber: Pratik Borhade (PratikPB2123).
Richard Antalik (ISS) changed the task status from Needs Triage to Confirmed.Jan 18 2022, 8:38 PM
Hans Goudey (HooglyBoogly) triaged this task as Low priority.Jan 31 2022, 8:37 PM
Hans Goudey (HooglyBoogly) added a project: Good First Issue.
Hans Goudey (HooglyBoogly) changed the subtype of this task from "Report" to "Bug".
Hans Goudey (HooglyBoogly) moved this task from Backlog/Bugs to Community Tasks on the Geometry Nodes board.
Hans Goudey (HooglyBoogly) added a subscriber: Hans Goudey (HooglyBoogly).

I think this should work differently, like the expected behavior mentioned in this report. I'll add this as a Good First Issue, since it's a nice task to get started with.

Hints: Check for uses of gather_link_search_ops, and uses of the weight argument to params.add_item in those functions. The shader math node would be a good place to look at first.

Shrey Aggarwal (shrey_agg) claimed this task.Feb 1 2022, 2:36 PM
Shrey Aggarwal (shrey_agg) added a comment.Feb 2 2022, 12:29 PM

So far as I have seen the weight parameter decides the priority of the nodes displayed in the pop-up. But they are not characterized by the socket which is calling them. For eg. If the Vector Socket of any node is dragged out, the pop-up shows all the possible socket connections of all the nodes in no defined manner. In my Opinion it should show all the Vector type sockets first and then all the other sockets. Right now the weights are assigned by :

const int weight = (&socket == main_socket) ? 0 : -1 - i;

which is the same for all the sockets no matter what their type is.

What we can do is we can assign the weights using the "type" of sockets like SOCK_VECTOR, SOCK_FLOAT, etc . We can check if the "type" of socket matches the "type" of calling socket then we assign the weight 0 to them and rest less than 0. For this we need to create a function bool matches_type(const bNodeSocket &socket) in the class SocketDeclaration which will return true if the type of both the socket matches. Something like this:

const int weight = (socket.matches_type(params.other_socket())) ? 0 : -1 - i;

Am I going in the right direction @Hans Goudey (HooglyBoogly) ?

Hans Goudey (HooglyBoogly) added a comment.Feb 2 2022, 11:04 PM

Hmm, I think it would be simpler to just give the Combine XYZ and Combine RGB nodes special implementations of gather_link_search_ops that accounts for this. No need to generalize it further I don't think.

Hans Goudey (HooglyBoogly) moved this task from Community Tasks to Waiting for Feedback/Review on the Geometry Nodes board.Feb 15 2022, 12:41 AM
Jacques Lucke (JacquesLucke) moved this task from Waiting for Feedback/Review to Community Tasks on the Geometry Nodes board.Mar 7 2022, 1:03 PM
Behe eddine (Behija) added a subscriber: Behe eddine (Behija).Apr 18 2022, 7:29 PM

isn't this already done

Hans Goudey (HooglyBoogly) moved this task from Community Tasks to Waiting for Feedback/Review on the Geometry Nodes board.Apr 28 2022, 8:19 PM