Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2019-10-10 01:31:47 +0300
committerClément Foucault <foucault.clem@gmail.com>2019-10-10 01:31:47 +0300
commitf61a8a2abd07ee879f9bc860230e0dd3e6ee6a0c (patch)
treea61ad71884c9f224927c3a8457b4aa74ab2f75bb /source/blender/nodes
parent8163fda9fb8b89ce9a58fcbb6310b2bb9d78da73 (diff)
Fix T70614 EEVEE: Bump with texture connected to other branches don't work
Was caused by the bump node not being evaluated because the other branch was evaluated before. To fix this, we use fromnode instead of tonode. Also we fix a potential issue with recursiveness because ntree_shader_copy_branch() also use nodeChainIterBackwards() which would reset the iter_flag in the middle of the parent iteration. Use iter_flag as a bitflag for each iteration to fix this.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/shader/node_shader_tree.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c
index b2d979074fe..4bcd77496c1 100644
--- a/source/blender/nodes/shader/node_shader_tree.c
+++ b/source/blender/nodes/shader/node_shader_tree.c
@@ -629,7 +629,7 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree,
/* Count and tag all nodes inside the displacement branch of the tree. */
start_node->tmp_flag = 0;
int node_count = 1;
- nodeChainIterBackwards(ntree, start_node, ntree_branch_count_and_tag_nodes, &node_count);
+ nodeChainIterBackwards(ntree, start_node, ntree_branch_count_and_tag_nodes, &node_count, 1);
/* Make a full copy of the branch */
bNode **nodes_copy = MEM_mallocN(sizeof(bNode *) * node_count, __func__);
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
@@ -763,13 +763,13 @@ static void node_tag_branch_as_derivative(bNode *node, int dx)
}
}
-static bool ntree_shader_bump_branches(bNode *UNUSED(fromnode), bNode *tonode, void *userdata)
+static bool ntree_shader_bump_branches(bNode *fromnode, bNode *UNUSED(tonode), void *userdata)
{
bNodeTree *ntree = (bNodeTree *)userdata;
- if (tonode->type == SH_NODE_BUMP) {
+ if (fromnode->type == SH_NODE_BUMP) {
bNodeSocket *height_dx_sock, *height_dy_sock, *bump_socket, *bump_dx_socket, *bump_dy_socket;
- bNode *bump = tonode;
+ bNode *bump = fromnode;
bump_socket = ntree_shader_node_find_input(bump, "Height");
bump_dx_socket = ntree_shader_node_find_input(bump, "Height_dx");
bump_dy_socket = ntree_shader_node_find_input(bump, "Height_dy");
@@ -832,7 +832,7 @@ void ntree_shader_tag_nodes(bNodeTree *ntree, bNode *output_node, nTreeTags *tag
/* Make sure sockets links pointers are correct. */
ntreeUpdateTree(G.main, ntree);
- nodeChainIterBackwards(ntree, output_node, ntree_tag_bsdf_cb, tags);
+ nodeChainIterBackwards(ntree, output_node, ntree_tag_bsdf_cb, tags, 0);
}
/* This one needs to work on a local tree. */
@@ -861,7 +861,7 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree,
/* Duplicate bump height branches for manual derivatives.
*/
- nodeChainIterBackwards(localtree, output, ntree_shader_bump_branches, localtree);
+ nodeChainIterBackwards(localtree, output, ntree_shader_bump_branches, localtree, 0);
/* TODO(fclem): consider moving this to the gpu shader tree evaluation. */
nTreeTags tags = {