Fix T71374 EEVEE: Fix Node group socket not converting inputs as in Cycles

Pretty straight Forward. Create a temp node during sockets expansion to
force the conversion to float.
This commit is contained in:
Clément Foucault 2020-01-23 17:40:40 +01:00
parent 39ae4804a8
commit c2e21b2329
Notes: blender-bot 2023-02-14 10:37:50 +01:00
Referenced by issue #76592, shade node Fraction issue
Referenced by issue #71374, Node group discrepancies between EEVEE and Cycles
1 changed files with 9 additions and 0 deletions

View File

@ -332,7 +332,16 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree)
bNodeSocket *group_socket = group_node->inputs.first;
for (; group_socket; group_socket = group_socket->next) {
if (group_socket->link != NULL) {
bNodeLink *link = group_socket->link;
/* Fix the case where the socket is actually converting the data. (see T71374)
* We only do the case of lossy conversion to float.*/
if ((group_socket->type == SOCK_FLOAT) && (link->fromsock->type != link->tosock->type)) {
bNode *node = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW);
nodeAddLink(localtree, link->fromnode, link->fromsock, node, node->inputs.first);
nodeAddLink(localtree, node, node->outputs.first, group_node, group_socket);
}
continue;
}