Geometry Nodes: Make displaying "Manage" panel optional

Often displaying the "Manage" panel is not very useful, or at least it
isn't worth taking up the screen real-estate. This commit adds an option
for showing the panel in the modifier, and adds an option to the node
group which is used to initialize the modifier option when creating a
modifier for a node group asset.

Pull Request: https://projects.blender.org/blender/blender/pulls/146775
This commit is contained in:
Hans Goudey
2025-09-25 16:00:07 +02:00
committed by Hans Goudey
parent 901835a2c7
commit fc4fc2d16c
10 changed files with 53 additions and 6 deletions

View File

@@ -1121,6 +1121,10 @@ class NODE_PT_node_tree_properties(Panel):
row.operator("node.default_group_width_set", text="", icon='NODE')
if group.bl_idname == "GeometryNodeTree":
row = layout.row()
row.active = group.is_modifier
row.prop(group, "show_modifier_manage_panel")
header, body = layout.panel("group_usage")
header.label(text="Usage")
if body:

View File

@@ -286,6 +286,11 @@ static wmOperatorStatus modifier_add_asset_exec(bContext *C, wmOperator *op)
/* Don't show the data-block selector since it's not usually necessary for assets. */
nmd->flag |= NODES_MODIFIER_HIDE_DATABLOCK_SELECTOR;
SET_FLAG_FROM_TEST(nmd->flag,
node_group->geometry_node_asset_traits &&
(node_group->geometry_node_asset_traits->flag &
GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL),
NODES_MODIFIER_HIDE_MANAGE_PANEL);
STRNCPY_UTF8(nmd->modifier.name, DATA_(node_group->id.name + 2));
BKE_modifier_unique_name(&object->modifiers, &nmd->modifier);

View File

@@ -1890,7 +1890,8 @@ static wmOperatorStatus shade_auto_smooth_exec(bContext *C, wmOperator *op)
smooth_by_angle_nmd->node_group = node_group;
id_us_plus(&node_group->id);
MOD_nodes_update_interface(object, smooth_by_angle_nmd);
smooth_by_angle_nmd->flag |= NODES_MODIFIER_HIDE_DATABLOCK_SELECTOR;
smooth_by_angle_nmd->flag |= NODES_MODIFIER_HIDE_DATABLOCK_SELECTOR |
NODES_MODIFIER_HIDE_MANAGE_PANEL;
STRNCPY_UTF8(smooth_by_angle_nmd->modifier.name, DATA_(node_group->id.name + 2));
BKE_modifier_unique_name(&object->modifiers, &smooth_by_angle_nmd->modifier);
}

View File

@@ -3113,6 +3113,11 @@ static wmOperatorStatus drop_geometry_nodes_invoke(bContext *C,
if (!RNA_boolean_get(op->ptr, "show_datablock_in_modifier")) {
nmd->flag |= NODES_MODIFIER_HIDE_DATABLOCK_SELECTOR;
}
SET_FLAG_FROM_TEST(nmd->flag,
node_tree->geometry_node_asset_traits &&
(node_tree->geometry_node_asset_traits->flag &
GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL),
NODES_MODIFIER_HIDE_MANAGE_PANEL);
nmd->node_group = node_tree;
id_us_plus(&node_tree->id);

View File

@@ -2571,6 +2571,7 @@ typedef struct NodesModifierData {
typedef enum NodesModifierFlag {
NODES_MODIFIER_HIDE_DATABLOCK_SELECTOR = (1 << 0),
NODES_MODIFIER_HIDE_MANAGE_PANEL = (1 << 1),
} NodesModifierFlag;
typedef struct MeshToVolumeModifierData {

View File

@@ -1068,8 +1068,9 @@ typedef enum GeometryNodeAssetTraitFlag {
GEO_NODE_ASSET_GREASE_PENCIL = (1 << 9),
/* Only used by Grease Pencil for now. */
GEO_NODE_ASSET_PAINT = (1 << 10),
GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL = (1 << 11),
} GeometryNodeAssetTraitFlag;
ENUM_OPERATORS(GeometryNodeAssetTraitFlag, GEO_NODE_ASSET_PAINT);
ENUM_OPERATORS(GeometryNodeAssetTraitFlag, GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL);
/* Data structs, for `node->storage`. */

View File

@@ -8047,6 +8047,12 @@ static void rna_def_modifier_nodes(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, nullptr);
prop = RNA_def_property(srna, "show_manage_panel", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", NODES_MODIFIER_HIDE_MANAGE_PANEL);
RNA_def_property_ui_text(prop, "Show Manage Panel", "");
RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, nullptr);
prop = RNA_def_property(srna, "node_warnings", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop,
"rna_NodesModifier_node_warnings_iterator_begin",

View File

@@ -2285,6 +2285,15 @@ static void rna_GeometryNodeTree_is_type_grease_pencil_set(PointerRNA *ptr, bool
geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_GREASE_PENCIL, value);
}
static bool rna_GeometryNodeTree_modifier_manage_panel_get(PointerRNA *ptr)
{
return !geometry_node_asset_trait_flag_get(ptr, GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL);
}
static void rna_GeometryNodeTree_modifier_manage_panel_set(PointerRNA *ptr, bool value)
{
geometry_node_asset_trait_flag_set(ptr, GEO_NODE_ASSET_HIDE_MODIFIER_MANAGE_PANEL, !value);
}
static bool random_value_type_supported(const EnumPropertyItem *item)
{
return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_BOOL, CD_PROP_INT32);
@@ -9536,6 +9545,18 @@ static void rna_def_geometry_nodetree(BlenderRNA *brna)
"rna_GeometryNodeTree_is_type_grease_pencil_get",
"rna_GeometryNodeTree_is_type_grease_pencil_set");
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update_asset");
prop = RNA_def_property(srna, "show_modifier_manage_panel", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop,
"rna_GeometryNodeTree_modifier_manage_panel_get",
"rna_GeometryNodeTree_modifier_manage_panel_set");
RNA_def_property_boolean_negative_sdna(prop, nullptr, "flag", 0);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(
prop,
"Show Manage Panel",
"Turn on the option to display the manage panel when creating a modifier");
RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
}
static StructRNA *define_specific_node(BlenderRNA *brna,

View File

@@ -302,6 +302,7 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v)
blender::wm::OpCallContext::InvokeDefault,
UI_ITEM_NONE);
layout->prop(&ptr, "show_group_selector", UI_ITEM_NONE, std::nullopt, ICON_NONE);
layout->prop(&ptr, "show_manage_panel", UI_ITEM_NONE, std::nullopt, ICON_NONE);
}
}

View File

@@ -984,10 +984,12 @@ void draw_geometry_nodes_modifier_ui(const bContext &C, PointerRNA *modifier_ptr
}
}
if (uiLayout *panel_layout = layout.panel_prop(
&C, modifier_ptr, "open_manage_panel", IFACE_("Manage")))
{
draw_manage_panel(&C, panel_layout, modifier_ptr, nmd);
if ((nmd.flag & NODES_MODIFIER_HIDE_MANAGE_PANEL) == 0) {
if (uiLayout *panel_layout = layout.panel_prop(
&C, modifier_ptr, "open_manage_panel", IFACE_("Manage")))
{
draw_manage_panel(&C, panel_layout, modifier_ptr, nmd);
}
}
}