Fix #112439: Don't hide sockets of Reroute node #112447

Closed
Iliya Katushenock wants to merge 10 commits from mod_moder:tmp_fix_dont_hide_rerout into main

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

Reroute node consists only of a socket, it has no body.
Don't allow hiding sockets of reroutes anymore, since it could make the
node invisible or prevent links from being connected to it.

The versioning ensures that the sockets on reroute nodes are not hidden.

Reroute node consists only of a socket, it has no body. Don't allow hiding sockets of reroutes anymore, since it could make the node invisible or prevent links from being connected to it. The versioning ensures that the sockets on reroute nodes are not hidden.
Iliya Katushenock added the
Interest
User Interface
label 2023-09-16 15:00:38 +02:00
Iliya Katushenock added 1 commit 2023-09-16 15:00:54 +02:00
Iliya Katushenock added this to the Nodes & Physics project 2023-09-16 15:00:59 +02:00
Member

Hi, thanks for looking into this.

Right now this fix has a few issues, since the is_visible() method is used in quite a few more places than just drawing the sockets.

E.g. node_find_indicated_socket ignores hidden sockets, so if you hide a socket of a reroute, it will be drawn, but you can't connect to it - with no indication why.

To me it seems safer to either (a.) change is_visible() itself to include the specific check for reroute nodes (and also check for any other uses of SOCK_HIDDEN that might cause trouble) or (b.) adjust the hide sockets operator so reroute sockets can't be hidden.

The latter seems more correct to me, but it leaves the possibility for scripts and add-ons to still hide reroute sockets so they all have to handle this edge case by themselves.

Hi, thanks for looking into this. Right now this fix has a few issues, since the `is_visible()` method is used in quite a few more places than just drawing the sockets. E.g. `node_find_indicated_socket` ignores hidden sockets, so if you hide a socket of a reroute, it will be drawn, but you can't connect to it - with no indication why. To me it seems safer to either (a.) change `is_visible()` itself to include the specific check for reroute nodes (and also check for any other uses of `SOCK_HIDDEN` that might cause trouble) or (b.) adjust the hide sockets operator so reroute sockets can't be hidden. The latter seems more correct to me, but it leaves the possibility for scripts and add-ons to still hide reroute sockets so they all have to handle this edge case by themselves.
Iliya Katushenock added 2 commits 2023-09-19 20:24:00 +02:00
Iliya Katushenock requested review from Leon Schittek 2023-09-19 20:25:29 +02:00
Leon Schittek reviewed 2023-09-21 07:43:15 +02:00
Leon Schittek left a comment
Member

Haven't been able to actually test this, yet, but this makes sense to me in general - a bit unsure about the changes to the RNA setter since I'm not very familiar with that.

Haven't been able to actually test this, yet, but this makes sense to me in general - a bit unsure about the changes to the RNA setter since I'm not very familiar with that.
@ -1189,0 +1191,4 @@
LISTBASE_FOREACH (bNodeTree *, ntree, &bmain->nodetrees) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->is_reroute()) {
blender::bke::node_find_enabled_input_socket(*node, "Input")->flag &= ~SOCK_HIDDEN;
Member

I think this should also un-hide the output socket.
While it's not actually drawn, it being hidden could cause links being unable to connect to it like mentioned before.

I think this should also un-hide the output socket. While it's not actually drawn, it being hidden could cause links being unable to connect to it like mentioned before.
mod_moder marked this conversation as resolved
Iliya Katushenock added 3 commits 2023-09-22 19:17:35 +02:00
Leon Schittek approved these changes 2023-09-24 13:19:19 +02:00
Leon Schittek left a comment
Member

Works great now, thanks! Looks good to me aside from maybe that one comment.
I also smoothed over the phrasing of the PR description/commit message a bit - hope you don't mind.

I'd still like someone from the module to have a look.

Works great now, thanks! Looks good to me aside from maybe that one comment. I also smoothed over the phrasing of the PR description/commit message a bit - hope you don't mind. I'd still like someone from the module to have a look.
@ -1354,2 +1354,4 @@
}
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 400, 25)) {
/* Convert sockets with both input and output flag into two separate sockets. */
Member

The previous phrasing /* Unhide all Reroute nodes. */ seemed clearer to me. I have to admit I'm not quite sure what this comment is saying.

The previous phrasing `/* Unhide all Reroute nodes. */` seemed clearer to me. I have to admit I'm not quite sure what this comment is saying.
Author
Member

This was my mistake, this comment from above code block.

This was my mistake, this comment from above code block.
mod_moder marked this conversation as resolved
Leon Schittek requested review from Hans Goudey 2023-09-24 13:22:06 +02:00
Iliya Katushenock added 2 commits 2023-09-24 14:35:08 +02:00
Hans Goudey approved these changes 2023-09-25 19:56:48 +02:00
@ -1357,0 +1359,4 @@
FOREACH_NODETREE_BEGIN (bmain, ntree, id) {
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
if (node->is_reroute()) {
blender::bke::node_find_enabled_input_socket(*node, "Input")->flag &= ~SOCK_HIDDEN;
Member

I think it's clearer to just use static_cast<bNodeSocket *>(node->inputs.first) here rather then tying this behavior to a bkenkernel function unnecessarily.

I think it's clearer to just use `static_cast<bNodeSocket *>(node->inputs.first)` here rather then tying this behavior to a bkenkernel function unnecessarily.
mod_moder marked this conversation as resolved
Iliya Katushenock added 1 commit 2023-09-25 22:01:33 +02:00
Iliya Katushenock added this to the 4.1 milestone 2023-09-27 15:35:37 +02:00
Iliya Katushenock added 1 commit 2023-09-27 16:15:56 +02:00
Iliya Katushenock removed this from the 4.1 milestone 2023-09-27 18:09:20 +02:00
Author
Member
https://projects.blender.org/blender/blender/pulls/112965
Iliya Katushenock deleted branch tmp_fix_dont_hide_rerout 2023-09-27 18:38:03 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
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
3 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#112447
No description provided.