[Bf-blender-cvs] [8dd163160e4] master: Fix T94766: texture coordinates from other object do not refresh

Jacques Lucke noreply at git.blender.org
Mon Jan 10 13:08:03 CET 2022


Commit: 8dd163160e411c19989a046c1b93c274a3da3e3e
Author: Jacques Lucke
Date:   Mon Jan 10 13:02:25 2022 +0100
Branches: master
https://developer.blender.org/rB8dd163160e411c19989a046c1b93c274a3da3e3e

Fix T94766: texture coordinates from other object do not refresh

The core issue is that flushing dependencies are created from an object
to a node tree when it contains e.g. a Texture Coordinate node.
That is an issue because the evaluation of the node tree itself does not
depend on the object (node tree evaluation is essentially a no-op).

Only other systems that parse and evaluate the node tree in a specific
context actually depend on e.g. the position of the referenced object.
It can even be the case that the node tree depends on objects that
the actual evaluator (geometry nodes modifier/material) does not depend
on, because a node is not connected to the output.

Geometry nodes makes the distinction between dependencies to the
node tree and to the evaluator already. Shader nodes do not.
Therefore, shader nodes need a flushing relation from node groups
to their parent node groups.

This brings back some unnecessary updates from rB7e712b2d6a0d
(e.g. when creating a node group from nodes that are not connected
to the output). This is a bit unfortunate, but refactoring how
dependencies work with shader nodes is a out of scope for this fix.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 51eefd7e31d..1c09417e9ab 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2530,8 +2530,13 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
        * changed. The parent node group is currently explicitly tagged for update in
        * #ED_node_tree_propagate_change. In the future we could move this relation to the
        * depsgraph, but then the depsgraph has to do some more static analysis of the node tree to
-       * see which groups the output actually depends on. */
-      add_relation(group_output_key, ntree_output_key, "Group Node", RELATION_FLAG_NO_FLUSH);
+       * see which groups the output actually depends on.
+       *
+       * Furthermore, shader nodes currently depend on relations being created from e.g. objects to
+       * nodes. Geometry nodes do not depend on these relations, because they are explicitly
+       * created by the modifier (which is the thing that actually depends on the objects). */
+      const int relation_flag = (group_ntree->type == NTREE_SHADER) ? 0 : RELATION_FLAG_NO_FLUSH;
+      add_relation(group_output_key, ntree_output_key, "Group Node", relation_flag);
     }
     else {
       BLI_assert_msg(0, "Unknown ID type used for node");



More information about the Bf-blender-cvs mailing list