Geometry Nodes: Add option to hide input in modifier #104517

Merged
Jacques Lucke merged 6 commits from HooglyBoogly/blender:geometry-nodes-ui-hide-in-modifier into main 2023-02-11 16:11:13 +01:00
4 changed files with 20 additions and 1 deletions

View File

@ -1465,6 +1465,11 @@ static void std_node_socket_interface_draw(bContext * /*C*/, uiLayout *layout, P
}
uiItemR(layout, ptr, "hide_value", DEFAULT_FLAGS, nullptr, 0);
const bNodeTree *node_tree = reinterpret_cast<const bNodeTree *>(ptr->owner_id);
HooglyBoogly marked this conversation as resolved
Review

Default Value seems wrong, it's just the value, has nothing to do with "default" really, does it?

`Default Value` seems wrong, it's just the value, has nothing to do with "default" really, does it?
Review

Yeah, fair. I was thinking about the context of the "Default Value" term in the node editor, but "Value" is simpler and gets the same idea across.

Yeah, fair. I was thinking about the context of the "Default Value" term in the node editor, but "Value" is simpler and gets the same idea across.
if (sock->in_out == SOCK_IN && node_tree->type == NTREE_GEOMETRY) {
uiItemR(col, ptr, "hide_in_modifier", DEFAULT_FLAGS, nullptr, 0);
}
}
static void node_socket_virtual_draw_color(bContext * /*C*/,

View File

@ -282,6 +282,10 @@ typedef enum eNodeSocketFlag {
* type is obvious and the name takes up too much space.
*/
SOCK_HIDE_LABEL = (1 << 12),
/**
* Only used for geometry nodes. Don't show the socket value in the modifier interface.
*/
SOCK_HIDE_IN_MODIFIER = (1 << 13),
} eNodeSocketFlag;
typedef struct bNode {

View File

@ -11203,6 +11203,14 @@ static void rna_def_node_socket_interface(BlenderRNA *brna)
prop, "Hide Value", "Hide the socket input value even when the socket is not connected");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
prop = RNA_def_property(srna, "hide_in_modifier", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDE_IN_MODIFIER);
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_ui_text(prop,
"Hide in Modifier",
"Don't show the input value in the geometry nodes modifier interface");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
prop = RNA_def_property(srna, "attribute_domain", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_attribute_domain_items);
RNA_def_property_ui_text(

View File

@ -1736,7 +1736,9 @@ static void panel_draw(const bContext *C, Panel *panel)
int socket_index;
LISTBASE_FOREACH_INDEX (bNodeSocket *, socket, &nmd->node_group->inputs, socket_index) {
draw_property_for_socket(*C, layout, nmd, &bmain_ptr, ptr, *socket, socket_index);
if (!(socket->flag & SOCK_HIDE_IN_MODIFIER)) {
draw_property_for_socket(*C, layout, nmd, &bmain_ptr, ptr, *socket, socket_index);
}
}
}