diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-14 12:49:03 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-14 12:49:35 +0300 |
commit | bf5e9ef2df3e755069ba9a1ce06d375d670e139c (patch) | |
tree | 9ee6841483a21cc9cbcec731794722b6cf7c911b /source/blender/blenkernel | |
parent | c6642f06ab2655e47705e69bc6c0f0f35d964ada (diff) |
Fix T96402: fix case when material output is contained in node group
For now just assume that a node group without output sockets is
an output node. Ideally, we would use run-time information stored
on the node group itself to determine if the group contains a
top-level output node (e.g. Material Output). That can be
implemented separately.
In the larger scheme of things, top-level outputs within node
groups seem to break the node group abstraction and reusability
a bit.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/node_tree_update.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index b1575ae833f..85061018383 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -1339,8 +1339,7 @@ class NodeTreeMainUpdater { { Vector<const SocketRef *> sockets; for (const NodeRef *node : tree.nodes()) { - const bNode *bnode = node->bnode(); - if (bnode->typeinfo->nclass != NODE_CLASS_OUTPUT && bnode->type != NODE_GROUP_OUTPUT) { + if (!this->is_output_node(*node)) { continue; } for (const InputSocketRef *socket : node->inputs()) { @@ -1352,6 +1351,24 @@ class NodeTreeMainUpdater { return sockets; } + bool is_output_node(const NodeRef &node) const + { + const bNode &bnode = *node.bnode(); + if (bnode.typeinfo->nclass == NODE_CLASS_OUTPUT) { + return true; + } + if (bnode.type == NODE_GROUP_OUTPUT) { + return true; + } + /* Assume node groups without output sockets are outputs. */ + /* TODO: Store whether a node group contains a top-level output node (e.g. Material Output) in + * run-time information on the node group itself. */ + if (bnode.type == NODE_GROUP && node.outputs().is_empty()) { + return true; + } + return false; + } + /** * Computes a hash that changes when the node tree topology connected to an output node changes. * Adding reroutes does not have an effect on the hash. |