Drag to add node search prioritizes wrong node type #94815

Open
opened 2022-01-11 13:41:12 +01:00 by Ludvik Koutny · 10 comments
Contributor

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: 922ae55a16
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.
image.png

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
**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: `922ae55a16` 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. ![image.png](https://archive.blender.org/developer/F12800847/image.png) **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
Author
Contributor

Added subscriber: @Rawalanche

Added subscriber: @Rawalanche
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

Added subscriber: @HooglyBoogly

Added subscriber: @HooglyBoogly
Member

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.

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 self-assigned this 2022-02-01 14:36:27 +01:00

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 @HooglyBoogly ?

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 @HooglyBoogly ?
Member

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.

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.

Added subscriber: @BEHE

Added subscriber: @BEHE

isn't this already done

isn't this already done
Philipp Oeser removed the
Interest
Nodes & Physics
label 2023-02-10 08:44:18 +01:00

It this issue still actual?

It this issue still actual?
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
7 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#94815
No description provided.