diff options
author | Jacques Lucke <jacques@blender.org> | 2022-11-10 17:50:46 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-11-10 17:50:46 +0300 |
commit | 6295bdfd38d3a4be8ee34ea6648473b4bbddf504 (patch) | |
tree | 7a358deef5a18a7cfdea56bd3815e033ad221f66 | |
parent | 6e2437d82b8c1fcc2b6cb9bba9753b5b46df377c (diff) |
Fix T102340: crash when adding image file in node group
The crash happened because the geometry nodes modifier is evaluated
before the node tree has been preprocessed. While there was a transitive
but non-flushing relation between these two depsgraph nodes.
However the relation between the modifier and the `ntree_output` depsgraph
node was ignored, because it had `DEPSOP_FLAG_NEEDS_UPDATE` *not* set
(which is actually correct, because not all node tree changes change its output).
Because this relation is ignored (e.g. in `calculate_pending_parents_for_node`)
the transitive relation is ignored as well.
The solution in this patch is to explicitly add this transitive non-flushing relation
to make sure the modifier only runs after the node tree has been preprocessed,
even when the node tree output has not changed. An alternative fix could be
to handle all links always but skip the execution of depsgraph nodes that are not
needed. This way all links are always taken into account. This solution would
require some deeper changes though and would be much more risky.
Also fixes T102402.
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_build.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index 6da290d6c4e..9eeb074bbaa 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -138,9 +138,14 @@ void DEG_add_node_tree_output_relation(DepsNodeHandle *node_handle, { deg::OperationKey ntree_output_key( &node_tree->id, deg::NodeType::NTREE_OUTPUT, deg::OperationCode::NTREE_OUTPUT); + deg::OperationKey ntree_preprocess_key(&node_tree->id, + deg::NodeType::NTREE_GEOMETRY_PREPROCESS, + deg::OperationCode::NTREE_GEOMETRY_PREPROCESS); deg::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle); deg_node_handle->builder->add_node_handle_relation( ntree_output_key, deg_node_handle, description); + deg_node_handle->builder->add_node_handle_relation( + ntree_preprocess_key, deg_node_handle, description, deg::RELATION_FLAG_NO_FLUSH); } void DEG_add_object_cache_relation(DepsNodeHandle *node_handle, |