Geometry Nodes: Add default input option for node groups #113175

Merged
Hans Goudey merged 12 commits from HooglyBoogly/blender:bnode-group-default-input into main 2023-10-12 14:04:51 +02:00
Member

In order to recreate the behavior of some builtin nodes
which have implicit inputs for ID/Index or positions, provide
a hard-coded list of default/unconnected fields for sockets.

The point is to let assets recreate the behavior of builtin
nodes in a simple way that's easy to change in the future if
this becomes a more generalized feature. A hardcoded list
makes this predictable and simple in the meantime.

When the option is set to something besides "Default Value"
it overrides the "Hide Value" option. Otherwise the default
input would conflict with the visible default value button.

This makes it possible to add #109846 as an asset in the
essentials bundle. The design is meant to be easily
extendable for shader nodes, though that isn't included in
this commit.


image
image

In order to recreate the behavior of some builtin nodes which have implicit inputs for ID/Index or positions, provide a hard-coded list of default/unconnected fields for sockets. The point is to let assets recreate the behavior of builtin nodes in a simple way that's easy to change in the future if this becomes a more generalized feature. A hardcoded list makes this predictable and simple in the meantime. When the option is set to something besides "Default Value" it overrides the "Hide Value" option. Otherwise the default input would conflict with the visible default value button. This makes it possible to add #109846 as an asset in the essentials bundle. The design is meant to be easily extendable for shader nodes, though that isn't included in this commit. --- ![image](/attachments/7545f025-36bc-476d-8129-3ef012675515) ![image](/attachments/979be5a9-061b-4be6-aefc-e547d967fa6a)
361 KiB
Hans Goudey added 1 commit 2023-10-02 21:30:52 +02:00
d5d376cdfb WIP: Geometry Nodes: Add default input option for node groups
In order to recreate the behavior of some builtin nodes
which have implicit inputs for ID/Index or positions, provide
a hard-coded list of default/unconnected fields for sockets.

The point is to let assets recreate the behavior of builtin
nodes in a simple way that's easy to change in the future if
this becomes a more generalized feature. A hardcoded list
makes this predictable and simple in the meantime.
Hans Goudey added this to the Nodes & Physics project 2023-10-02 21:31:06 +02:00
Hans Goudey added the
Interest
Geometry Nodes
label 2023-10-02 21:31:34 +02:00
Contributor

Will it be possible to have one of texture coordinates as default for vector inputs in Shader Nodes? I have multiple texture assets that are problematic to share because they appear fully white without connecting it to Tex Coordinates node.

Will it be possible to have one of texture coordinates as default for vector inputs in Shader Nodes? I have multiple texture assets that are problematic to share because they appear fully white without connecting it to Tex Coordinates node.
Hans Goudey added 3 commits 2023-10-08 22:20:00 +02:00
Hans Goudey added 1 commit 2023-10-08 22:26:51 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Add default input option for node groups to Geometry Nodes: Add default input option for node groups 2023-10-08 22:27:02 +02:00
Hans Goudey requested review from Lukas Tönne 2023-10-08 22:27:12 +02:00
Hans Goudey requested review from Jacques Lucke 2023-10-08 22:27:12 +02:00
Jacques Lucke requested changes 2023-10-09 12:02:38 +02:00
Jacques Lucke left a comment
Member

It feels like the option should still show for other socket types besides int and vector, but maybe be grayed out or only show a single option. Having generic options like this appear and disappear based on socket type seems wrong.

The interaction with the hide-value flag should be mentioned in the patch description more explicitly.

It feels like the option should still show for other socket types besides int and vector, but maybe be grayed out or only show a single option. Having generic options like this appear and disappear based on socket type seems wrong. The interaction with the hide-value flag should be mentioned in the patch description more explicitly.
@ -119,2 +121,4 @@
ENUM_OPERATORS(NodeTreeInterfacePanelFlag, NODE_INTERFACE_PANEL_DEFAULT_CLOSED);
typedef enum GeometryNodeDefaultInputType {
GEO_NODE_DEFAULT_FIELD_INPUT_NONE = 0,
Member

GEO_NODE_DEFAULT_INPUT_VALUE, GEO_NODE_DEFAULT_INPUT_FIELD_INDEX, etc.
Either this, or the enum name should become more field specific.

`GEO_NODE_DEFAULT_INPUT_VALUE`, `GEO_NODE_DEFAULT_INPUT_FIELD_INDEX`, etc. Either this, or the enum name should become more field specific.
Member

+1, i don't see why a default non-constant value would be specific to fields. For example, i could imagine having scene time as a default input value for floats, or perhaps a unique seed for randomization nodes.

+1, i don't see why a default non-constant value would be specific to fields. For example, i could imagine having scene time as a default input value for floats, or perhaps a unique seed for randomization nodes.
HooglyBoogly marked this conversation as resolved
@ -207,3 +207,4 @@
public:
/** Some input sockets can have non-trivial values in the case when they are unlinked. This
* callback computes the default input of a values in geometry nodes when nothing is linked. */
std::unique_ptr<ImplicitInputValueFn> implicit_input_fn_;
Member

Remove trailing underscore for public members.

Remove trailing underscore for public members.
HooglyBoogly marked this conversation as resolved
Author
Member

It feels like the option should still show for other socket types besides int and vector, but maybe be grayed out or only show a single option. Having generic options like this appear and disappear based on socket type seems wrong.

Hmm, I'm not sure I agree that having an empty list for many socket types is better than not showing it at all. There are many other properties that are specific to certain socket types that we show conditionally.

Maybe it would be better if the property name was "Default Field"? Then at least there wouldn't be an expectation that it worked with sockets like geometry or image?

>It feels like the option should still show for other socket types besides int and vector, but maybe be grayed out or only show a single option. Having generic options like this appear and disappear based on socket type seems wrong. Hmm, I'm not sure I agree that having an empty list for many socket types is better than not showing it at all. There are many other properties that are specific to certain socket types that we show conditionally. Maybe it would be better if the property name was "Default Field"? Then at least there wouldn't be an expectation that it worked with sockets like geometry or image?
Hans Goudey added 1 commit 2023-10-10 11:02:08 +02:00
Member

Hmm, I'm not sure I agree that having an empty list for many socket types is better than not showing it at all. There are many other properties that are specific to certain socket types that we show conditionally.

Afaik, there is always some generic reason for why we show a property only for some socket types. One such reason can be that it supports fields. Here the reason is very much tied to the set of defaults we currently have, but we could totally have defaults (or even default fields) for other socket types like Float (not saying we should).

Showing the socket only for field types and naming the input "Default Field" seems fine.

> Hmm, I'm not sure I agree that having an empty list for many socket types is better than not showing it at all. There are many other properties that are specific to certain socket types that we show conditionally. Afaik, there is always some generic reason for why we show a property only for some socket types. One such reason can be that it supports fields. Here the reason is very much tied to the set of defaults we currently have, but we could totally have defaults (or even default fields) for other socket types like Float (not saying we should). Showing the socket only for field types and naming the input "Default Field" seems fine.
Hans Goudey added 3 commits 2023-10-11 12:52:01 +02:00
Hans Goudey requested review from Jacques Lucke 2023-10-11 12:53:32 +02:00
Author
Member

I still kept the property hidden for socket types that don't use it, because it seemed pretty ugly to show the enum with only one option. I still rename the default "None" to "Default Value" so that's more purposeful, and I also inverted the "active" behavior to make it so it's no "Hide Value" that becomes ineffective rather than this new property. I think that's more intuitive.

I still kept the property hidden for socket types that don't use it, because it seemed pretty ugly to show the enum with only one option. I still rename the default "None" to "Default Value" so that's more purposeful, and I also inverted the "active" behavior to make it so it's no "Hide Value" that becomes ineffective rather than this new property. I think that's more intuitive.
Jacques Lucke requested changes 2023-10-11 16:00:37 +02:00
Jacques Lucke left a comment
Member

This needs some changes in field inferencing. It's currently wrong inside the node group as well as outside.

image

Also the "Single Value" checkbox should be disabled when a default input field is set.

This needs some changes in field inferencing. It's currently wrong inside the node group as well as outside. ![image](/attachments/634f86f6-ca42-4f4a-80fc-0cdaad54d1f9) Also the "Single Value" checkbox should be disabled when a default input field is set.
Hans Goudey added 3 commits 2023-10-12 11:47:54 +02:00
Hans Goudey requested review from Jacques Lucke 2023-10-12 11:48:01 +02:00
Jacques Lucke approved these changes 2023-10-12 13:38:38 +02:00
Lukas Tönne approved these changes 2023-10-12 13:54:40 +02:00
Hans Goudey merged commit 20d8f27ed2 into main 2023-10-12 14:04:51 +02:00
Hans Goudey deleted branch bnode-group-default-input 2023-10-12 14:04:53 +02:00
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
4 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#113175
No description provided.