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:
authorJacques Lucke <jacques@blender.org>2022-01-10 15:02:25 +0300
committerJacques Lucke <jacques@blender.org>2022-01-10 15:02:57 +0300
commit8dd163160e411c19989a046c1b93c274a3da3e3e (patch)
tree80269fdf08e2d94ea5e6f70593126705bbbdc88e /source/blender/depsgraph/intern
parent3ec88ae21df95546914863d80de4a76c8d3e3476 (diff)
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.
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc9
1 files changed, 7 insertions, 2 deletions
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");