Fix T96278: missing update after alpha socket connection

Differential Revision: https://developer.blender.org/D14299
This commit is contained in:
Jacques Lucke 2022-03-18 10:49:54 +01:00
parent c7954d5904
commit 7509a74116
Notes: blender-bot 2023-02-14 07:08:26 +01:00
Referenced by issue #96278, Viewport/EEVEE: Alpha socket connection/disconnection does not cause an update to the image texture node.
1 changed files with 10 additions and 0 deletions

View File

@ -1455,6 +1455,16 @@ class NodeTreeMainUpdater {
socket_hash = noise::hash(socket_hash, input_socket_hash);
}
}
/* The Image Texture node has a special case. The behavior of the color output changes
* depending on whether the Alpha output is linked. */
if (node.bnode()->type == SH_NODE_TEX_IMAGE && socket.index() == 0) {
BLI_assert(socket.name() == "Color");
const OutputSocketRef &alpha_socket = node.output(1);
BLI_assert(alpha_socket.name() == "Alpha");
if (alpha_socket.is_directly_linked()) {
socket_hash = noise::hash(socket_hash);
}
}
hash_by_socket_id[socket.id()] = socket_hash;
sockets_to_check.pop();
}