Fix: #136269: Geometry Nodes: crash due to missing collection in depsgraph

When the collection is disabled and was only referenced by a node tree, it was
missing from the depsgraph. The Geometry Nodes modifier tried to add a relation
to it, but it couldn't because the collection was not in the depsgraph in the first place.

Now, the collection is always added to the depsgraph when it's referenced by a
node tree that's in the depsgraph too. This makes the existing code that adds the
relation from the collection to the Geometry Nodes modifier work.

Pull Request: https://projects.blender.org/blender/blender/pulls/136328
This commit is contained in:
илья _
2025-04-04 15:55:07 +02:00
committed by Jacques Lucke
parent 3562433ae7
commit 2a092a623b
2 changed files with 12 additions and 0 deletions

View File

@@ -2008,6 +2008,9 @@ void DepsgraphNodeBuilder::build_nodetree(bNodeTree *ntree)
else if (id_type == ID_VF) {
build_vfont((VFont *)id);
}
else if (id_type == ID_GR) {
build_collection(nullptr, reinterpret_cast<Collection *>(id));
}
else if (bnode->is_group()) {
bNodeTree *group_ntree = (bNodeTree *)id;
build_nodetree(group_ntree);

View File

@@ -3055,6 +3055,15 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree)
ComponentKey vfont_key(id, NodeType::GENERIC_DATABLOCK);
add_relation(vfont_key, ntree_output_key, "VFont -> Node");
}
else if (id_type == ID_GR) {
/* Build relations in the collection itself, but don't hook it up to the tree.
* Relations from the collection to the tree are handled by the modifier's update_depsgraph()
* callback.
*
* Other node trees do not currently support references to collections. Once they do this
* code needs to be reconsidered. */
build_collection(nullptr, reinterpret_cast<Collection *>(id));
}
else if (bnode->is_group()) {
bNodeTree *group_ntree = (bNodeTree *)id;
build_nodetree(group_ntree);