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.
This commit is contained in:
parent
3ec88ae21d
commit
8dd163160e
Notes:
blender-bot
2023-09-08 04:55:43 +02:00
Referenced by issue #94766, Regression: Texture coordinates from other object do not refresh if node inside group
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue