diff options
author | Miguel Porces <cmporces> | 2019-10-01 21:21:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-10-01 21:21:17 +0300 |
commit | cca1649b20162939e4be1d8ea51fedfc511a6f15 (patch) | |
tree | 63437702fe1ce3e61f34136d23acd4ad3457b075 /source/blender/editors | |
parent | b196c42d4adea394ffcb42b2412874133881b3b4 (diff) |
Nodes: discard hidden sockets when grouping a single node.
At the moment, grouping a single node that has hidden sockets, exposes all
sockets in the node group. This patch just filters hidden sockets, so that
the node group's interface remains the same as the node being grouped.
Differential Revision: https://developer.blender.org/D5533
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_group.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 588fc4d4307..08ac84cbb2f 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -717,7 +717,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, ListBase anim_basepaths = {NULL, NULL}; float min[2], max[2], center[2]; int totselect; - bool expose_all = false; + bool expose_visible = false; bNode *input_node, *output_node; /* XXX rough guess, not nice but we don't have access to UI constants here ... */ @@ -735,7 +735,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, /* auto-add interface for "solo" nodes */ if (totselect == 1) { - expose_all = true; + expose_visible = true; } /* move nodes over */ @@ -879,8 +879,8 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, } } - /* expose all unlinked sockets too */ - if (expose_all) { + /* expose all unlinked sockets too but only the visible ones*/ + if (expose_visible) { for (node = ngroup->nodes.first; node; node = node->next) { if (node_group_make_use_node(node, gnode)) { for (sock = node->inputs.first; sock; sock = sock->next) { @@ -892,6 +892,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, break; } } + if (sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) { + skip = true; + } if (skip) { continue; } @@ -913,6 +916,9 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, skip = true; } } + if (sock->flag & (SOCK_HIDDEN | SOCK_UNAVAIL)) { + skip = true; + } if (skip) { continue; } |