Geometry Nodes: Node group operators initial phase #108947

Merged
Hans Goudey merged 72 commits from node-group-operators into main 2023-06-29 13:58:01 +02:00
Member

This commit adds an operator to run a node group on object's geometry.
The UI is limited curves sculpt mode is supported for now, to simplify
the design.

A new geometry node editor context to edit operator groups is also
added. This allows changing any node group, rather than only node
groups that are part of the active modifier context.

3D viewport menus are added with any geometry node group
asset in a catalog that contains the Operator tag. Currently Blender
must be restarted to refresh the list of available operators.

This is only the first phase of the node group operator feature.
More will be added in next steps, including:

  • Allow controlling which modes assets are available in
  • Node group inputs displayed in the redo panel
  • Specific input nodes for operator-specific data (like selection)
  • Node group meta-data to control which object odes to support
  • Modal operator support

See #101778


To test:

  1. Add asset library with node group operators, or create asset and add "Operator" tag
    • Asset must be in catalog, not at top level
    • Node group must have geometry input and output
  2. Open curves sculpt mode
    • Cache is static without invalidation, so Blender must be reopened after changes to assets
  3. See assets added to menus, and new top-level menus for catalogs

image

This commit adds an operator to run a node group on object's geometry. The UI is limited curves sculpt mode is supported for now, to simplify the design. A new geometry node editor context to edit operator groups is also added. This allows changing any node group, rather than only node groups that are part of the active modifier context. 3D viewport menus are added with any geometry node group asset in a catalog that contains the `Operator` tag. Currently Blender must be restarted to refresh the list of available operators. This is only the first phase of the node group operator feature. More will be added in next steps, including: - Allow controlling which modes assets are available in - Node group inputs displayed in the redo panel - Specific input nodes for operator-specific data (like selection) - Node group meta-data to control which object odes to support - Modal operator support See #101778 --- To test: 1. Add asset library with node group operators, or create asset and add "Operator" tag - Asset must be in catalog, not at top level - Node group must have geometry input and output 2. Open curves sculpt mode - Cache is static without invalidation, so Blender must be reopened after changes to assets 3. See assets added to menus, and new top-level menus for catalogs ![image](/attachments/06b4da12-d4ab-4129-a942-ca1749dc1483)
Hans Goudey added 44 commits 2023-06-13 19:35:29 +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.
Hans Goudey added this to the Nodes & Physics project 2023-06-13 19:35:51 +02:00
Hans Goudey added this to the 4.0 milestone 2023-06-13 19:35:55 +02:00
Hans Goudey added the
Module
Nodes & Physics
Interest
Geometry Nodes
Interest
Modeling
labels 2023-06-13 19:36:22 +02:00
Hans Goudey added 2 commits 2023-06-13 22:59:04 +02:00
Hans Goudey added 3 commits 2023-06-18 00:29:32 +02:00
Hans Goudey added 2 commits 2023-06-18 02:29:30 +02:00
Hans Goudey added 2 commits 2023-06-18 03:50:34 +02:00
Hans Goudey added 3 commits 2023-06-19 15:11:16 +02:00
Hans Goudey changed title from WIP: Geometry Nodes: Node group operators initial phase to Geometry Nodes: Node group operators initial phase 2023-06-19 15:13:23 +02:00
Hans Goudey added 1 commit 2023-06-19 15:13:25 +02:00
Member

Couldn't find any obvious issues by just looking at the code. Didn't test it yet. Would be nice if you or someone else could share a .blend file with a few simple operators.

Also, I'd like to see a video of this in action hehe

Couldn't find any obvious issues by just looking at the code. Didn't test it yet. Would be nice if you or someone else could share a .blend file with a few simple operators. Also, I'd like to see a video of this in action hehe
Author
Member

I'm having some trouble making a screen recording, but this file has some basic curves operators for sculpt mode.

I'm having some trouble making a screen recording, but this file has some basic curves operators for sculpt mode.
Hans Goudey added 1 commit 2023-06-21 20:54:13 +02:00
Hans Goudey added 1 commit 2023-06-23 19:42:15 +02:00
Hans Goudey requested review from Lukas Tönne 2023-06-23 19:42:21 +02:00
Hans Goudey requested review from Jacques Lucke 2023-06-23 19:42:21 +02:00
Author
Member

Currently the PR includes support for points and meshes, and other modes, even though those aren't accessible in the UI. I'd rather leave those in though, to make sure the code stays object-type/mode agnostic, and because it would just be more work to add it back later.

Currently the PR includes support for points and meshes, and other modes, even though those aren't accessible in the UI. I'd rather leave those in though, to make sure the code stays object-type/mode agnostic, and because it would just be more work to add it back later.
Hans Goudey requested review from Julian Eisel 2023-06-23 19:43:50 +02:00
Member

I couldn't get my node group to show up in the "Mesh" or "Curve" menu.

  • Set the GN editor to "Operator" mode
  • Marked node group as asset
  • Added "Operator" tag in the asset browser

More instructions needed. I didn't spot anything obvious after skimming over the code.

EDIT: the operator from Hans' test file also does not appear in the menu.

I couldn't get my node group to show up in the "Mesh" or "Curve" menu. - Set the GN editor to "Operator" mode - Marked node group as asset - Added "Operator" tag in the asset browser More instructions needed. I didn't spot anything obvious after skimming over the code. EDIT: the operator from Hans' test file also does not appear in the menu.
Author
Member

3D viewport menus are added with any geometry node group
asset that contains the Operator tag, only in curves sculpt mode
for now. Currently Blender must be restarted to refresh the list of
available operators.

Does that help explain things? You mentioned "Mesh" but the mesh
object type isn't supported in the UI in this first commit.

the operator from Hans' test file also does not appear in the menu.

Are you in curves sculpt mode? Did you restart Blender?

>3D viewport menus are added with any geometry node group >asset that contains the Operator tag, only in curves sculpt mode >for now. Currently Blender must be restarted to refresh the list of >available operators. Does that help explain things? You mentioned "Mesh" but the mesh object type isn't supported in the UI in this first commit. >the operator from Hans' test file also does not appear in the menu. Are you in curves sculpt mode? Did you restart Blender?
Member

Does that help explain things? You mentioned "Mesh" but the mesh
object type isn't supported in the UI in this first commit.

Are you in curves sculpt mode? Did you restart Blender?

I tried both curve and mesh edit mode. I restarted Blender and reloaded the file. Might try again later.

> Does that help explain things? You mentioned "Mesh" but the mesh > object type isn't supported in the UI in this first commit. > Are you in curves sculpt mode? Did you restart Blender? I tried both curve and mesh edit mode. I restarted Blender and reloaded the file. Might try again later.
Author
Member

Okay, right, the description mentions that only curves sculpt mode is supported right now.

Okay, right, the description mentions that only curves sculpt mode is supported right now.
Hans Goudey added 2 commits 2023-06-26 14:59:27 +02:00
Julian Eisel reviewed 2023-06-26 17:44:05 +02:00
Julian Eisel left a comment
Member

Looks fine without digging too deep. Minor notes only.

Looks fine without digging too deep. Minor notes only.
@ -33,0 +49,4 @@
AssetItemTree build_filtered_all_catalog_tree(
const bContext &C,
const AssetFilterSettings &filter_settings,
FunctionRef<bool(const AssetMetaData &)> meta_data_filter);
Member

Would default this to nullptr. While in your case (geometry nodes stuff) it's necessary, I'm not sure if you'd need to filter by metadata usually.

Would default this to `nullptr`. While in your case (geometry nodes stuff) it's necessary, I'm not sure if you'd need to filter by metadata usually.
HooglyBoogly marked this conversation as resolved
@ -44,0 +51,4 @@
namespace blender::ed::asset {
AssetItemTree build_filtered_all_catalog_tree(
Member

Would suggest letting this take an AssetLibraryReference as parameter, there's nothing specific to the all asset library here really.

Would suggest letting this take an `AssetLibraryReference` as parameter, there's nothing specific to the all asset library here really.
HooglyBoogly marked this conversation as resolved
@ -130,0 +133,4 @@
namespace blender::ed::asset {
asset_system::AssetLibrary *get_all_library_once_available()
Member

Not sure if this function adds much, I'd just call the two lines in place. At least the location is weird, what does this have to do with the enum conversion? :)

Not sure if this function adds much, I'd just call the two lines in place. At least the location is weird, what does this have to do with the enum conversion? :)
HooglyBoogly marked this conversation as resolved
Hans Goudey added 4 commits 2023-06-26 22:02:14 +02:00
Jacques Lucke requested changes 2023-06-27 10:41:10 +02:00
@ -44,0 +89,4 @@
return true;
});
/* Build an own tree without any of the catalogs that don't have proper node group assets. */
Member

This comment seems outdated because it talks about node groups while this function seems to be more general.

This comment seems outdated because it talks about node groups while this function seems to be more general.
HooglyBoogly marked this conversation as resolved
@ -0,0 +253,4 @@
*node_tree,
op->properties,
compute_context,
geometry_orig,
Member

Should probably use std::move here.

Should probably use `std::move` here.
HooglyBoogly marked this conversation as resolved
@ -0,0 +298,4 @@
return BLI_strdup(description);
}
void GEOMETRY_OT_execute_node_group(wmOperatorType *ot)
Member

Shouldn't this have a poll function?

Shouldn't this have a poll function?
HooglyBoogly marked this conversation as resolved
@ -0,0 +322,4 @@
return CTX_wm_view3d(C);
}
// TODO: SHOULD BE SHARED
Member

Either actually implement the todo comment or add some more information about what you mean. Same below.

Either actually implement the todo comment or add some more information about what you mean. Same below.
HooglyBoogly marked this conversation as resolved
@ -0,0 +414,4 @@
menus.add_new("Select");
menus.add_new("Curves");
break;
case OB_MESH:
Member

This isn't supported yet, right? So maybe that can wait for a later patch that adds support for mesh edit mode.

This isn't supported yet, right? So maybe that can wait for a later patch that adds support for mesh edit mode.
Author
Member

This works, we just decided to limit the assets arbitrarily for now to keep the design simple. I'd rather not remove it just to add it again, but I could if you thought it was important. Keeping it is nice to show that much of the code is object-type agnostic.

This works, we just decided to limit the assets arbitrarily for now to keep the design simple. I'd rather not remove it just to add it again, but I could if you thought it was important. Keeping it is nice to show that much of the code is object-type agnostic.
@ -7436,2 +7436,4 @@
};
static const EnumPropertyItem geometry_nodes_type_items[] = {
{SNODE_GEOMETRY_MODIFIER, "MODIFIER", 0, "Modifier", ""},
Member

Give these enum items better descriptions.

Give these enum items better descriptions.
HooglyBoogly marked this conversation as resolved
@ -83,2 +90,4 @@
*/
GeoNodesModifierData *modifier_data = nullptr;
/**
*
Member

Missing comment text.

Missing comment text.
HooglyBoogly marked this conversation as resolved
Hans Goudey added 7 commits 2023-06-28 14:50:10 +02:00
Hans Goudey requested review from Jacques Lucke 2023-06-28 14:50:16 +02:00
Jacques Lucke approved these changes 2023-06-28 17:25:50 +02:00
Julian Eisel approved these changes 2023-06-28 22:27:32 +02:00
Julian Eisel left a comment
Member

Can’t really check again right now, but when I checked earlier things seemed quite fine.

Can’t really check again right now, but when I checked earlier things seemed quite fine.
Hans Goudey merged commit e4cc91a611 into main 2023-06-29 13:58:01 +02:00
Hans Goudey deleted branch node-group-operators 2023-06-29 13:58:02 +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#108947
No description provided.