diff options
author | Jacques Lucke <jacques@blender.org> | 2022-02-14 11:08:54 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-02-14 11:08:54 +0300 |
commit | 33dde170cecf04b97597e02281e28bd98bb26b3f (patch) | |
tree | bd8e40eb340dc32ae0777c1b62c51b566148c8f7 /source/blender/blenkernel/intern/node_tree_update.cc | |
parent | 517afcc858b09ecb51e73b2cfbcaffeba75a9933 (diff) |
Fix T95749: missing update when normal node changes
This node is a bit of a weird case, because it uses the value stored in an
output socket as an input. So when we want to determine if the Dot
changed, we also have to check if the Normal output changed.
A cleaner solution would be to refactor this by either storing the normal
on the node directly (instead of in an output socket), or by exposing it
by a separate input. This refactor should be done separately though.
Diffstat (limited to 'source/blender/blenkernel/intern/node_tree_update.cc')
-rw-r--r-- | source/blender/blenkernel/intern/node_tree_update.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index bea73ec8065..711aee57b5a 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -1482,7 +1482,8 @@ class NodeTreeMainUpdater { while (!sockets_to_check.is_empty()) { const SocketRef &in_out_socket = *sockets_to_check.pop(); - const bNode &bnode = *in_out_socket.node().bnode(); + const NodeRef &node = in_out_socket.node(); + const bNode &bnode = *node.bnode(); const bNodeSocket &bsocket = *in_out_socket.bsocket(); if (bsocket.changed_flag != NTREE_CHANGED_NOTHING) { return true; @@ -1507,7 +1508,7 @@ class NodeTreeMainUpdater { } else { const OutputSocketRef &socket = in_out_socket.as_output(); - for (const InputSocketRef *input_socket : socket.node().inputs()) { + for (const InputSocketRef *input_socket : node.inputs()) { if (input_socket->is_available()) { bool &pushed = pushed_by_socket_id[input_socket->id()]; if (!pushed) { @@ -1516,6 +1517,18 @@ class NodeTreeMainUpdater { } } } + /* The Normal node has a special case, because the value stored in the first output socket + * is used as input in the node. */ + if (bnode.type == SH_NODE_NORMAL && socket.index() == 1) { + BLI_assert(socket.name() == "Dot"); + const OutputSocketRef &normal_output = node.output(0); + BLI_assert(normal_output.name() == "Normal"); + bool &pushed = pushed_by_socket_id[normal_output.id()]; + if (!pushed) { + sockets_to_check.push(&normal_output); + pushed = true; + } + } } } return false; |