From fc4fc2d16c11da4e2e9b2c2b458d4e46aabd1f90 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 25 Sep 2025 16:00:07 +0200 Subject: [PATCH] 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 --- scripts/startup/bl_ui/space_node.py | 4 ++++ .../editors/object/add_modifier_assets.cc | 5 +++++ source/blender/editors/object/object_edit.cc | 3 ++- .../editors/object/object_relations.cc | 5 +++++ source/blender/makesdna/DNA_modifier_types.h | 1 + source/blender/makesdna/DNA_node_types.h | 3 ++- .../blender/makesrna/intern/rna_modifier.cc | 6 ++++++ .../blender/makesrna/intern/rna_nodetree.cc | 21 +++++++++++++++++++ .../blender/modifiers/intern/MOD_ui_common.cc | 1 + .../nodes/intern/geometry_nodes_caller_ui.cc | 10 +++++---- 10 files changed, 53 insertions(+), 6 deletions(-) diff --git a/scripts/startup/bl_ui/space_node.py b/scripts/startup/bl_ui/space_node.py index 68029878b7f..f5cca87c3bd 100644 --- a/scripts/startup/bl_ui/space_node.py +++ b/scripts/startup/bl_ui/space_node.py @@ -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: diff --git a/source/blender/editors/object/add_modifier_assets.cc b/source/blender/editors/object/add_modifier_assets.cc index d0fb527fdc2..93c89c72d24 100644 --- a/source/blender/editors/object/add_modifier_assets.cc +++ b/source/blender/editors/object/add_modifier_assets.cc @@ -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); diff --git a/source/blender/editors/object/object_edit.cc b/source/blender/editors/object/object_edit.cc index e52d92fa121..92b86a3c01c 100644 --- a/source/blender/editors/object/object_edit.cc +++ b/source/blender/editors/object/object_edit.cc @@ -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); } diff --git a/source/blender/editors/object/object_relations.cc b/source/blender/editors/object/object_relations.cc index 3ceaf7c4817..585e06508fb 100644 --- a/source/blender/editors/object/object_relations.cc +++ b/source/blender/editors/object/object_relations.cc @@ -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); diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 2b5d1b26a2e..2c8a08e42fd 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -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 { diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 73f42e1dfa6..5cb15d5a74e 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -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`. */ diff --git a/source/blender/makesrna/intern/rna_modifier.cc b/source/blender/makesrna/intern/rna_modifier.cc index d860d6ab6dc..2a3ab3231aa 100644 --- a/source/blender/makesrna/intern/rna_modifier.cc +++ b/source/blender/makesrna/intern/rna_modifier.cc @@ -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", diff --git a/source/blender/makesrna/intern/rna_nodetree.cc b/source/blender/makesrna/intern/rna_nodetree.cc index 7afee6b195a..71b4a307266 100644 --- a/source/blender/makesrna/intern/rna_nodetree.cc +++ b/source/blender/makesrna/intern/rna_nodetree.cc @@ -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, diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index b9b1efd16f2..32c27157bd2 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -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); } } diff --git a/source/blender/nodes/intern/geometry_nodes_caller_ui.cc b/source/blender/nodes/intern/geometry_nodes_caller_ui.cc index 7d322673f2a..ee4afec83b3 100644 --- a/source/blender/nodes/intern/geometry_nodes_caller_ui.cc +++ b/source/blender/nodes/intern/geometry_nodes_caller_ui.cc @@ -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); + } } }