Geometry Nodes: Operator to wrap a modifier's node group #104546
Merged
Hans Goudey
merged 19 commits from 2023-02-14 18:22:04 +01:00
HooglyBoogly/blender:geometry-nodes-wrapper-operator
into main
Reviewers
Request review
No reviewers
Labels
Clear labels
This issue affects/is about backward or forward compatibility
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
Apply labels
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
This issue affects/is about backward or forward 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
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
Issues relating to security: https://wiki.blender.org/wiki/Process/Vulnerability_Reports
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 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
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
Milestone
Set milestone
Clear milestone
No items
No Milestone
Projects
Set Project
Clear projects
No project
Assignees
Assign users
Clear assignees
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#104546
Reference in New Issue
There is no content yet.
Delete Branch "HooglyBoogly/blender:geometry-nodes-wrapper-operator"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
As described in #104171, add an operator that creates new node groups that
contain the current node group and named attribute nodes to deal with the
outputs. This saves manual work when moving a high-level modifier to the
node editor for better procedural control.
Very nice!
The operator should also assign a sensible name to the node-group that is being created.
If we are fine with the word
wrapper
(I am), It could be<nodegroup_name>.wrapper
.The name of the operator should probably contain the word
node
, otherwise I can imagine people being confused what it does and where their modifier went. I'd propose something likeWrap in Node Group
or evenConvert to Node
.Seems good to me now!
@ -8,3 +8,2 @@
def geometry_node_group_empty_new():
group = bpy.data.node_groups.new(data_("Geometry Nodes"), 'GeometryNodeTree')
def geometry_node_group_empty_new(name=data_("Geometry Nodes"), add_link=True):
Better use two separate functions that call a common function instead of adding optional parameters to this one.
@ -27,0 +30,4 @@
modifier = context.modifier
else:
modifier = context.object.modifiers.active
if modifier.type != 'NODES':
modifier may be
None
@ -31,10 +41,148 @@ def geometry_modifier_poll(context):
# Test object support for geometry node modifier
if not ob or ob.type not in {'MESH', 'POINTCLOUD', 'VOLUME', 'CURVE', 'FONT', 'CURVES'}:
return False
if not get_context_modifier(context):
Use
get_context_modifer(context) is None
.@ -38,0 +94,4 @@
"""Create a new node group wrapping the modifier's group"""
bl_idname = "object.new_geometry_node_group_wrapper"
bl_label = "Create Wrapper Node Group"
The name is still kind of ugly. Maybe something like
Move to Nodes
(description:Move inputs and outputs set in the modifier to a new node group
) or what Simon suggested.Yeah, good idea!
@ -38,0 +121,4 @@
# Copy default values for inputs and create named attribute input nodes.
input_nodes = []
first_geometry_input = None
for input in old_group.inputs:
Avoid using
input
as variable name because this is a built-in function in Python.@ -38,0 +136,4 @@
elif input.bl_socket_idname == 'NodeSocketGeometry':
if not first_geometry_input:
first_geometry_input = group_node_input
Make sure vscode removes trailing spaces automatically.
@ -38,0 +142,4 @@
# Adjust locations of named attribute input nodes and group input node to make some space.
if input_nodes:
for i, node in enumerate(input_nodes):
node.location[0] = -175
Can you use
.x
?Hmm, yes!
@ -38,0 +172,4 @@
group_output_node.location[0] = (len(store_nodes) + 1) * 175
group.links.new(first_geometry_output, store_nodes[0].inputs["Geometry"])
for i in range(len(store_nodes))[:-1]:
Seems like you could move the
- 1
intorange(...)
.@ -22,2 +22,3 @@
group.links.new(output_node.inputs[0], input_node.outputs[0])
if add_link:
group.links.new(output_node.inputs[0], input_node.outputs[0])
Return the input and output node from the function, and move this line into
geometry_node_group_empty_new
.@ -38,0 +98,4 @@
class CreateModifierWrapperGroup(Operator):
"""Move inputs and outputs from in the modifier to a new node group"""
bl_idname = "object.new_geometry_node_group_wrapper"
The class name and idname should be updated to respect the new label.
@ -70,11 +224,7 @@ class NewGeometryNodeTreeAssign(Operator):
return geometry_modifier_poll(context)
This poll function now returns false when there is no modifier, which breaks
New
button to create a geometry node tree on a new object.cyk referenced this pull request2023-02-17 04:39:33 +01:00
Reviewers