Fix #120399: Hidden socket in the Viewer is not shown when a new link to it is created #120503

Open
Weikang-Qiu wants to merge 1 commits from Weikang-Qiu/blender:reset-socke-hidden-after-link-creation into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

This simple PR fix #120399.

The hidden socket in the Viewer is not shown when a new link to it is created. This is because the hidden property of the socket is not updated when a new link to it is created.
Fixing it by simply manually update the property after a new link is created.

This simple PR fix #120399. The hidden socket in the Viewer is not shown when a new link to it is created. This is because the hidden property of the socket is not updated when a new link to it is created. Fixing it by simply manually update the property after a new link is created.
Weikang-Qiu added 1 commit 2024-04-11 04:51:42 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2024-04-11 13:21:15 +02:00
Iliya Katushenock added the
Interest
Geometry Nodes
label 2024-04-11 13:21:19 +02:00
Iliya Katushenock requested changes 2024-04-11 13:26:24 +02:00
Dismissed
Iliya Katushenock left a comment
Member

Thanks for the fix\

Thanks for the fix\
Iliya Katushenock reviewed 2024-04-11 13:34:39 +02:00
@ -2888,6 +2888,8 @@ bNodeLink *nodeAddLink(
link->tosock = fromsock;
}
tosock->flag &= ~SOCK_HIDDEN;

AAAA, my comment wasn't attached!

This is few incorrect. Today still many nodes keep use socket hiding as way to do the business.
And from python API this will cause the case where usually invisible links will make a lot of invisible sockets visible.
Better to do this in the code of viewer node connection to this link (check node_link_viewer_get_socket).

AAAA, my comment wasn't attached! This is few incorrect. Today still many nodes keep use socket hiding as way to do the business. And from python API this will cause the case where usually invisible links will make a lot of invisible sockets visible. Better to do this in the code of viewer node connection to this link (check `node_link_viewer_get_socket`).
Weikang-Qiu marked this conversation as resolved
Weikang-Qiu force-pushed reset-socke-hidden-after-link-creation from e376448d50 to 5a4ee562ee 2024-04-11 16:38:50 +02:00 Compare
Author
Contributor

Thanks for your insights. I have made the socket unhidden in the node_link_viewer_get_socket

Thanks for your insights. I have made the socket unhidden in the `node_link_viewer_get_socket`
Iliya Katushenock approved these changes 2024-04-11 16:41:23 +02:00
Dismissed
Iliya Katushenock requested review from Hans Goudey 2024-04-11 16:41:30 +02:00
Iliya Katushenock requested changes 2024-04-11 16:44:21 +02:00
Dismissed
Iliya Katushenock left a comment
Member

Actually, add the same thing for geometry socket (both can be hidden).

Actually, add the same thing for geometry socket (both can be hidden).
Iliya Katushenock reviewed 2024-04-11 16:46:02 +02:00
@ -454,8 +454,10 @@ static bNodeSocket *node_link_viewer_get_socket(bNodeTree &ntree,
BLI_assert(data_type != CD_AUTO_FROM_NAME);
storage.data_type = data_type;
nodes::update_node_declaration_and_sockets(ntree, viewer_node);
bNodeSocket *tgt_socket = static_cast<bNodeSocket *>(viewer_node.inputs.last);

Naming of socket also can be few better. What do you think about value_socket?

Naming of socket also can be few better. What do you think about `value_socket`?
Weikang-Qiu marked this conversation as resolved
Author
Contributor

Actually, add the same thing for geometry socket (both can be hidden).

I see. So does the viewer node in compositor viewer node I guess? maybe modifying the control flow would be better

> Actually, add the same thing for geometry socket (both can be hidden). I see. So does the viewer node in compositor viewer node I guess? maybe modifying the control flow would be better
Weikang-Qiu closed this pull request 2024-04-11 16:53:38 +02:00

No, geometry nodes use separate viewer node. Not sure if compositor have the same issue.

No, geometry nodes use separate viewer node. Not sure if compositor have the same issue.
Author
Contributor

I can confirm compositor viewer has the same issue. and the function node_link_viewer_get_socket also applies to compositor view node
5a4ee562ee/source/blender/editors/space_node/node_relationships.cc (L436)

I can confirm compositor viewer has the same issue. and the function `node_link_viewer_get_socket` also applies to compositor view node https://projects.blender.org/blender/blender/src/commit/5a4ee562eeb996b2136efe3685bba7e5cb49e3dc/source/blender/editors/space_node/node_relationships.cc#L436

Feel free to fix this as well/

Feel free to fix this as well/
Iliya Katushenock reopened this pull request 2024-04-11 17:04:23 +02:00
Iliya Katushenock reviewed 2024-04-11 17:13:32 +02:00
@ -435,2 +435,3 @@
{
if (viewer_node.type != GEO_NODE_VIEWER) {
bNodeSocket *viewer_socket = nullptr;
if (viewer_node.type != GEO_NODE_VIEWER || src_socket.type == SOCK_GEOMETRY) {
Not the best idea to wrap everything in nesting branches. See: https://devtalk.blender.org/t/some-anti-patterns/26490#mixing-precondition-checks-with-core-functionality-2
Author
Contributor

I see. Does that mean I am going to set socket->flag ~= SOCK_HIDDEN three times in the code? Or create another function to wrap all of this?

I see. Does that mean I am going to set `socket->flag ~= SOCK_HIDDEN` three times in the code? Or create another function to wrap all of this?

I am okay with just 3 time call. Another one idea might be to add this on caller side.

I am okay with just 3 time call. Another one idea might be to add this on caller side.
Author
Contributor

Oh yeah, my brain wasn't functioning. Adding on the caller side looks better to me.

Oh yeah, my brain wasn't functioning. Adding on the caller side looks better to me.
Weikang-Qiu marked this conversation as resolved
@ -444,0 +450,4 @@
BLI_assert(data_type != CD_AUTO_FROM_NAME);
storage.data_type = data_type;
nodes::update_node_declaration_and_sockets(ntree, viewer_node);
viewer_socket = static_cast<bNodeSocket *>(viewer_node.inputs.last);

This make this fix Diff few more complicated to reuse one variable and one operation in the end by changing of all function.

This make this fix Diff few more complicated to reuse one variable and one operation in the end by changing of all function.
Weikang-Qiu marked this conversation as resolved
Weikang-Qiu force-pushed reset-socke-hidden-after-link-creation from b037c9ee34 to aa58910d82 2024-04-11 17:38:51 +02:00 Compare
Iliya Katushenock approved these changes 2024-04-11 17:40:50 +02:00

Thanks, looks much nicer/

Thanks, looks much nicer/
Merge conflict checking is in progress. Try again in few moments.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u reset-socke-hidden-after-link-creation:Weikang-Qiu-reset-socke-hidden-after-link-creation
git checkout Weikang-Qiu-reset-socke-hidden-after-link-creation
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 Assignees
2 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#120503
No description provided.