Fix #94413: Hide added input sockets on group inputs with hidden sockets #120067

Merged
Hans Goudey merged 16 commits from lone_noel/blender:node-group-hidden-sockets into main 2024-04-18 19:20:18 +02:00
Member

Improve working with multiple group input nodes, by automatically
hiding new node group input sockets on any group input node with
hidden extension socket.

Whenever the extension socket is hidden, the user can now expect
the socket visibility of the group input node to stay fixed.
When the extension socket is shown on the other hand, the group input
node will update when sockets are added to the group interface.


This PR started as an updated version of https://archive.blender.org/developer/D14531

Note: During review of that patch Jacques mentioned:

Hm, I'm unsure I like the behavior. Looking at the second video it really feels like the new input should be added to the selected group input node.

I can't really think of a use case where you'd want to add the new input in multiple places like that. Maybe we could add a visibility toggle in the Inputs list that indicates whether this input is shown in the currently selected Group Input. I don't find the current behavior super intuitive.

I went for the current approach anyway, because it's basically what users are used to - just more consistent.

When tying the addition of new sockets to the selection during the editing of the node group interface, it's easy for the interface and the group input nodes to unintentionally get out of sync, possibly leaving users confused, why some of their inputs are missing.

Improve working with multiple group input nodes, by automatically hiding new node group input sockets on any group input node with hidden extension socket. Whenever the extension socket is hidden, the user can now expect the socket visibility of the group input node to stay fixed. When the extension socket is shown on the other hand, the group input node will update when sockets are added to the group interface. --- This PR started as an updated version of https://archive.blender.org/developer/D14531 Note: During review of that patch Jacques mentioned: > Hm, I'm unsure I like the behavior. Looking at the second video it really feels like the new input should be added to the selected group input node. >I can't really think of a use case where you'd want to add the new input in multiple places like that. Maybe we could add a visibility toggle in the Inputs list that indicates whether this input is shown in the currently selected Group Input. I don't find the current behavior super intuitive. I went for the current approach anyway, because it's basically what users are used to - just more consistent. When tying the addition of new sockets to the selection during the editing of the node group interface, it's easy for the interface and the group input nodes to unintentionally get out of sync, possibly leaving users confused, why some of their inputs are missing.
Leon Schittek added 4 commits 2024-03-29 16:19:57 +01:00
Leon Schittek added this to the Nodes & Physics project 2024-03-29 16:20:03 +01:00
Hans Goudey reviewed 2024-03-29 17:00:07 +01:00
Hans Goudey left a comment
Member

I like the idea of making this a state, and the code looks reasonable. I'd still like to test this though, didn't get to that yet.

I like the idea of making this a state, and the code looks reasonable. I'd still like to test this though, didn't get to that yet.
@ -481,3 +481,3 @@
NODE_HIDDEN = 1 << 3,
NODE_ACTIVE = 1 << 4,
// NODE_ACTIVE_ID = 1 << 5, /* Deprecated. */
NODE_HIDE_UNUSED_SOCKETS = 1 << 5,
Member

Let's add a comment here. Suggestion:

For group input nodes: new group inputs aren't displayed in this node.

Let's add a comment here. Suggestion: `For group input nodes: new group inputs aren't displayed in this node.`
lone_noel marked this conversation as resolved
@ -187,2 +187,4 @@
VectorSet<bNodeSocket *> &new_sockets)
{
/* Only group inputs have the option to hide new sockets. */
const bool hide_new_group_input_sockets = (node.is_group_input()) &&
Member

Unnecessary parentheses around node.is_group_input()

Unnecessary parentheses around `node.is_group_input()`
lone_noel marked this conversation as resolved
Leon Schittek added 1 commit 2024-03-29 17:24:35 +01:00
Hans Goudey requested review from Jacques Lucke 2024-04-11 17:54:15 +02:00
Hans Goudey requested review from Hans Goudey 2024-04-11 17:54:15 +02:00
Jacques Lucke reviewed 2024-04-11 18:17:06 +02:00
Jacques Lucke left a comment
Member

I'm wondering whether this needs a new flag at all. What is the benefit of a new flag compared to just checking whether there are hidden sockets already on-demand?

I'm wondering whether this needs a new flag at all. What is the benefit of a new flag compared to just checking whether there are hidden sockets already on-demand?
@ -482,2 +482,3 @@
NODE_ACTIVE = 1 << 4,
// NODE_ACTIVE_ID = 1 << 5, /* Deprecated. */
/** For group input nodes: new group inputs aren't displayed in this node. */
NODE_HIDE_UNUSED_SOCKETS = 1 << 5,
Member

The naming of this seems quite misleading, because it doesn't really check whether sockets are unused or not.

The naming of this seems quite misleading, because it doesn't really check whether sockets are unused or not.
lone_noel marked this conversation as resolved
Leon Schittek added 5 commits 2024-04-14 16:14:09 +02:00
Author
Member

I'm wondering whether this needs a new flag at all. What is the benefit of a new flag compared to just checking whether there are hidden sockets already on-demand?

I was hoping that the flag was more explicit and originally I thought it might be nice to expose this in the UI. But since that's off the table, just checking directly seems fine (and probably more clear, when the flag's name was bad anyway).

> I'm wondering whether this needs a new flag at all. What is the benefit of a new flag compared to just checking whether there are hidden sockets already on-demand? I was hoping that the flag was more explicit and originally I thought it might be nice to expose this in the UI. But since that's off the table, just checking directly seems fine (and probably more clear, when the flag's name was bad anyway).
Jacques Lucke requested changes 2024-04-14 18:38:40 +02:00
Jacques Lucke left a comment
Member

I kind of think that the versioning should be removed here for now. It can be added separately if people think that this behavior is desirable. For now it seems somewhat unrelated.

I kind of think that the versioning should be removed here for now. It can be added separately if people think that this behavior is desirable. For now it seems somewhat unrelated.
@ -186,2 +186,3 @@
Vector<bNodeSocket *> &old_sockets,
VectorSet<bNodeSocket *> &new_sockets)
VectorSet<bNodeSocket *> &new_sockets,
const bool hide_new_socket)
Member

hide_new_sockets

`hide_new_sockets`
lone_noel marked this conversation as resolved
@ -416,9 +420,12 @@ static void refresh_node_sockets_and_panels(bNodeTree &ntree,
}
Vector<bNodeSocket *> old_outputs;
bool has_hidden_socket = false;
Member

has_hidden_output_socket

`has_hidden_output_socket`
lone_noel marked this conversation as resolved
Leon Schittek added 2 commits 2024-04-14 21:03:43 +02:00
Author
Member

I kind of think that the versioning should be removed here for now. It can be added separately if people think that this behavior is desirable.

I thought about this again. Currently, adding a group input via the link search hides the new sockets on other group input nodes.
So without the versioning, we can end up in situations where, when adding an input via the sidebar, the socket isn't added to any of the existing group input nodes because all of them have some sockets hidden.
But I don't have an issue with adding the versioning later.

Another option:
What do you think about checking for the visibility of just the extension socket to determine whether a socket should be visible when creating an input via the sidebar?
That would completely remove the need for versioning while also allowing us to keep the current behavior described above, where adding group inputs via link-drag search hides the input on all other group input nodes.

> I kind of think that the versioning should be removed here for now. It can be added separately if people think that this behavior is desirable. I thought about this again. Currently, adding a group input via the link search hides the new sockets on other group input nodes. So without the versioning, we can end up in situations where, when adding an input via the sidebar, the socket isn't added to *any* of the existing group input nodes because all of them have some sockets hidden. But I don't have an issue with adding the versioning later. Another option: What do you think about checking for the visibility of just the extension socket to determine whether a socket should be visible when creating an input via the sidebar? That would completely remove the need for versioning while also allowing us to keep the current behavior described above, where adding group inputs via link-drag search hides the input on all other group input nodes.
Member

What do you think about checking for the visibility of just the extension socket to determine whether a socket should be visible when creating an input via the sidebar?

That sounds good to me too.

> What do you think about checking for the visibility of just the extension socket to determine whether a socket should be visible when creating an input via the sidebar? That sounds good to me too.
Leon Schittek added 2 commits 2024-04-16 23:33:48 +02:00
Hans Goudey approved these changes 2024-04-17 14:18:59 +02:00
Hans Goudey left a comment
Member

This is so simple now! And it works well in my testing.

This is so simple now! And it works well in my testing.
Hans Goudey requested review from Jacques Lucke 2024-04-17 14:19:09 +02:00
Jacques Lucke approved these changes 2024-04-17 18:44:01 +02:00
Jacques Lucke left a comment
Member

I have one more inline comment, but LGTM otherwise.

I have one more inline comment, but LGTM otherwise.
@ -395,0 +400,4 @@
* When the extension socket on group input nodes is hidden, we consider the socket visibility
* fixed and don't want to add newly created group inputs.
*/
static bool hide_new_group_input_sockets(const bNode &node)
Member

I think this function should assert that the node is a group input node.

I think this function should assert that the node is a group input node.
lone_noel marked this conversation as resolved
Leon Schittek added 2 commits 2024-04-18 19:16:03 +02:00
Hans Goudey merged commit 9b21dffe45 into main 2024-04-18 19:20:18 +02:00
Leon Schittek deleted branch node-group-hidden-sockets 2024-04-18 19:21:33 +02:00
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#120067
No description provided.