Nodes: Add icon and separate "New Group" operators

The current placement of the operators make it easy for them to blend in with
other group nodes in that menu.

This patch adds an icon to better indicate the nature of these operators, and
have separators between it and other entries of the menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/147330
This commit is contained in:
quackarooni
2025-10-04 11:55:54 +02:00
committed by Jacques Lucke
parent 2b8d005a13
commit 268d8dd94b

View File

@@ -270,7 +270,11 @@ class NodeMenu(Menu):
@classmethod
def new_empty_group(cls, layout):
"""Group Node with a newly created empty group as its assigned nodetree."""
props = layout.operator(cls.new_empty_group_operator_id, text="New Group", text_ctxt=i18n_contexts.default)
props = layout.operator(
cls.new_empty_group_operator_id,
text="New Group",
text_ctxt=i18n_contexts.default,
icon='ADD')
if hasattr(props, "use_transform"):
props.use_transform = cls.use_transform
@@ -284,14 +288,14 @@ class NodeMenu(Menu):
node_tree = space_node.edit_tree
all_node_groups = context.blend_data.node_groups
operators = []
operators.append(cls.new_empty_group(layout))
if node_tree in all_node_groups.values():
layout.separator()
cls.node_operator(layout, "NodeGroupInput")
cls.node_operator(layout, "NodeGroupOutput")
operators = []
operators.append(cls.new_empty_group(layout))
if node_tree:
from nodeitems_builtins import node_tree_group_type