Geometry Nodes: Initial tool-specific nodes #109517

Merged
Hans Goudey merged 111 commits from HooglyBoogly/blender:operator-selection-node into main 2023-08-04 20:59:12 +02:00
Member

Add three new nodes for operations and inputs specific to
node group operators.

  • Selection Whether elements are selected in the viewport
  • Set Selection Sets the edit/sculpt selection, on the point,
    face, or curve domains
  • 3D Cursor Gives the location and rotation of the 3D cursor,
    in the local space of the modified object.
  • Face Set The face set value from mesh sculpt mode,
    and whether the attribute exists.
  • Set Face Set Set sculpt face set values.

In the add menu and search, the nodes are only visible in the
"Operator" context of the geometry node editor. They also give
errors when executed by a modifier.


image
image

Add three new nodes for operations and inputs specific to node group operators. - **Selection** Whether elements are selected in the viewport - **Set Selection** Sets the edit/sculpt selection, on the point, face, or curve domains - **3D Cursor** Gives the location and rotation of the 3D cursor, in the local space of the modified object. - **Face Set** The face set value from mesh sculpt mode, and whether the attribute exists. - **Set Face Set** Set sculpt face set values. In the add menu and search, the nodes are only visible in the "Operator" context of the geometry node editor. They also give errors when executed by a modifier. --- ![image](/attachments/ae072e47-2ca6-4ed6-842f-ac2604e8f41a) ![image](/attachments/7f0c0cc0-a84f-4ca6-96c8-bd8e350c5927)
Hans Goudey added 82 commits 2023-06-29 16:06:41 +02:00
39dfa015a0 Geometry Nodes: Add node editor option to edit "Operator" node groups
This functions as a way to avoid having the context affect which node
groups are displayed. This is necessary since there is no concept of an
active operator and most node groups could be used as an operator.

It was considered to make this a more general "No Context" option for
the node editor. That still might happen eventually, but we want to
encourage users to use the modifier context since it allows the
various inspection features to work properly.
83cf2e6d08 Geometry Nodes: Add selection node for node group operators
Add an "Operator Selection" node, which gives the edit/sculpt mode
selection when a node is executed in an operator node group.

TODO:
- Decide how to support float selections (from sculpt mode)
Hans Goudey changed title from Geometry Nodes: Add input nodes for node group operators to WIP: Geometry Nodes: Add input nodes for node group operators 2023-06-29 16:06:48 +02:00
Hans Goudey added 1 commit 2023-06-29 16:14:11 +02:00
Hans Goudey added 2 commits 2023-06-29 16:38:29 +02:00
Hans Goudey added 2 commits 2023-06-29 16:44:39 +02:00
Hans Goudey added 1 commit 2023-06-29 18:52:25 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Add input nodes for node group operators to WIP: Geometry Nodes: Initial operator-specific nodes 2023-06-29 19:17:43 +02:00
Hans Goudey requested review from Dalai Felinto 2023-06-29 19:52:15 +02:00
Hans Goudey requested review from Lukas Tönne 2023-06-29 19:52:16 +02:00
Hans Goudey requested review from Jacques Lucke 2023-06-29 19:52:16 +02:00
Hans Goudey added the
Interest
Geometry Nodes
label 2023-06-29 19:52:23 +02:00
Hans Goudey added this to the 4.0 milestone 2023-06-29 19:52:56 +02:00
Hans Goudey added this to the Nodes & Physics project 2023-06-29 19:53:05 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Initial operator-specific nodes to Geometry Nodes: Initial operator-specific nodes 2023-06-29 19:53:10 +02:00
Hans Goudey added 2 commits 2023-06-29 19:54:05 +02:00
Hans Goudey added 1 commit 2023-07-02 17:31:40 +02:00
Hans Goudey added 3 commits 2023-07-02 19:01:39 +02:00
Contributor

Wouldn't it make more sense to have Face Set nodes in Mesh - Read or Mesh - Topology (and Set Face Set in Operations)? They can be used in regular node setups and they're specifically mesh attributes

Wouldn't it make more sense to have Face Set nodes in Mesh - Read or Mesh - Topology (and Set Face Set in Operations)? They can be used in regular node setups and they're specifically mesh attributes
Author
Member

They can be used in regular node setups

They can only be used in operator node groups. That's because sculpt face sets are with the ".sculpt_face_set" naming convention is UI data, not meant to be used procedurally. Anyway, in regular geometry nodes any face domain integer attribute can be used to serve the same purpose. The thing we're missing is copying face sets to a non-UI attribute, but that is trivial do do with this PR.

>They can be used in regular node setups They can only be used in operator node groups. That's because sculpt face sets are with the ".sculpt_face_set" naming convention is UI data, not meant to be used procedurally. Anyway, in regular geometry nodes any face domain integer attribute can be used to serve the same purpose. The thing we're missing is copying face sets to a non-UI attribute, but that is trivial do do with this PR.
Contributor

They can be used in regular node setups

They can only be used in operator node groups. That's because sculpt face sets are with the ".sculpt_face_set" naming convention is UI data, not meant to be used procedurally. Anyway, in regular geometry nodes any face domain integer attribute can be used to serve the same purpose. The thing we're missing is copying face sets to a non-UI attribute, but that is trivial do do with this PR.

Thanks for the clarification. If sculpt_face_sets are to be used procedurally (please), and they'll use the same nodes, I think it makes sense to do that before/alongside this PR, so that nodes won't have to be moved in Add menu categories in the future, but I guess that's quite trivial as well.

> >They can be used in regular node setups > > They can only be used in operator node groups. That's because sculpt face sets are with the ".sculpt_face_set" naming convention is UI data, not meant to be used procedurally. Anyway, in regular geometry nodes any face domain integer attribute can be used to serve the same purpose. The thing we're missing is copying face sets to a non-UI attribute, but that is trivial do do with this PR. Thanks for the clarification. If sculpt_face_sets are to be used procedurally (please), and they'll use the same nodes, I think it makes sense to do that before/alongside this PR, so that nodes won't have to be moved in Add menu categories in the future, but I guess that's quite trivial as well.
Author
Member

If sculpt_face_sets are to be used procedurally (please), and they'll use the same nodes

That's my point though, the sculpt face sets attribute isn't meant to be used procedurally, and we wouldn't have specific access nodes for them if it was different. The reason to have the access nodes in this PR is that .sculpt_face_set is not treated as a regular attribute for geometry nodes.

>If sculpt_face_sets are to be used procedurally (please), and they'll use the same nodes That's my point though, the sculpt face sets attribute isn't meant to be used procedurally, and we wouldn't have specific access nodes for them if it was different. The reason to have the access nodes in this PR is that `.sculpt_face_set` is _not_ treated as a regular attribute for geometry nodes.
Author
Member

Two things I'll do before committing:

  • Rename "Operator" to "Tool"
  • Rename "Operator Selection" to just "Selection" (rely on other UI features to make it clear that this is only for tools)
Two things I'll do before committing: - Rename "Operator" to "Tool" - Rename "Operator Selection" to just "Selection" (rely on other UI features to make it clear that this is only for tools)
Hans Goudey added 7 commits 2023-08-03 17:18:31 +02:00
Hans Goudey added 1 commit 2023-08-03 18:43:23 +02:00
Hans Goudey changed title from Geometry Nodes: Initial operator-specific nodes to Geometry Nodes: Initial tool-specific nodes 2023-08-03 18:45:45 +02:00
Hans Goudey added 1 commit 2023-08-03 18:46:11 +02:00
Hans Goudey added 2 commits 2023-08-04 01:05:21 +02:00
Hans Goudey added 1 commit 2023-08-04 17:05:49 +02:00
Jacques Lucke requested changes 2023-08-04 19:58:57 +02:00
Jacques Lucke left a comment
Member
  • Whenever I execute a mesh operator, the selection mode jumps back to points.
  • This might also cause another issue: I use an extrude node and want to output the side selection as new selection. However, after running the operator, the top face is selected too.
* Whenever I execute a mesh operator, the selection mode jumps back to points. * This might also cause another issue: I use an extrude node and want to output the side selection as new selection. However, after running the operator, the top face is selected too.
@ -0,0 +12,4 @@
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_output<decl::Vector>("Location").subtype(PROP_DISTANCE);
Member

PROP_XYZ

`PROP_XYZ`
Author
Member

Seems PROP_TRANSLATION is the proper subtype here actually (from the set position node)

Seems `PROP_TRANSLATION` is the proper subtype here actually (from the set position node)
Member

hm, makes sense too I guess

hm, makes sense too I guess
HooglyBoogly marked this conversation as resolved
@ -0,0 +27,4 @@
if (!check_tool_context_and_error(params)) {
return;
}
const float4x4 world_to_object(params.user_data()->operator_data->self_object->world_to_object);
Member

Arguably there should be the option to choose between world and object space, a bit similar to the Object Info node. If not, then it should at least be mentioned somewhere what space we're in.

Arguably there should be the option to choose between world and object space, a bit similar to the Object Info node. If not, then it should at least be mentioned somewhere what space we're in.
Author
Member

I guess I'd probably save that for later, to keep things simpler for now.

I guess I'd probably save that for later, to keep things simpler for now.
Member

Then add proper descriptions. In the node and in the PR.

Then add proper descriptions. In the node and in the PR.
HooglyBoogly marked this conversation as resolved
@ -0,0 +32,4 @@
const float3 location_global(cursor.location);
const math::Quaternion rotation_global(float4(cursor.rotation_quaternion));
params.set_output("Location", math::transform_point(world_to_object, location_global));
params.set_output("Rotation", math::to_quaternion(world_to_object) * rotation_global);
Member

Only output rotation when it's available, otherwise this hits an assert in debug build.

Only output rotation when it's available, otherwise this hits an assert in debug build.
HooglyBoogly marked this conversation as resolved
@ -0,0 +32,4 @@
case GeometryComponent::Type::Mesh:
switch (domain) {
case ATTR_DOMAIN_POINT:
return *attributes.lookup_or_default<bool>(".select_vert", domain, false);
Member

Are all these selection attributes always up to date or do we only keep one of them up to date depending on the selection mode?

Are all these selection attributes always up to date or do we only keep one of them up to date depending on the selection mode?
Author
Member

The three should always be up to date. When we set one, we interpolate the values to the others to make them consistent too.

The three should always be up to date. When we set one, we interpolate the values to the others to make them consistent too.
JacquesLucke marked this conversation as resolved
Hans Goudey added 4 commits 2023-08-04 20:27:13 +02:00
Hans Goudey added 1 commit 2023-08-04 20:30:51 +02:00
Author
Member

Thanks, I fixed the select mode issue in main: 85bac9d292

Using the side selection works now.

Thanks, I fixed the select mode issue in main: 85bac9d292af4bb2067d5db48a798b5729ce8be3 Using the side selection works now.
Hans Goudey requested review from Jacques Lucke 2023-08-04 20:32:03 +02:00
Jacques Lucke approved these changes 2023-08-04 20:54:15 +02:00
Jacques Lucke left a comment
Member

Seems to work well in my tests now.

Seems to work well in my tests now.
@ -73,6 +74,7 @@ class GatherLinkSearchOpParams {
/** The current node type. */
const bNodeType &node_type_;
const SpaceNode &snode_;
Member

It's probably fine and more future proof to just store the context in here, but either way is fine with me.

It's probably fine and more future proof to just store the context in here, but either way is fine with me.
Author
Member

Yeah, next time I need something from the context there I'll just do that. For now I think this is a bit clearer.

Yeah, next time I need something from the context there I'll just do that. For now I think this is a bit clearer.
Hans Goudey merged commit e3e6fb8ecf into main 2023-08-04 20:59:12 +02:00
Hans Goudey deleted branch operator-selection-node 2023-08-04 20:59:14 +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
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#109517
No description provided.