Fix T92324: crash caused by recursive instancing

This fixes one (of possibly multiple) root issues. The collection passed into
the Collection Info node must not contain the current object, because that
would result in a dependency cycle and recursive instancing.
This commit is contained in:
Jacques Lucke 2021-10-29 10:10:58 +02:00
parent cf771807b7
commit 2887d87232
Notes: blender-bot 2023-02-14 00:29:15 +01:00
Referenced by issue #92324, Crash caused by recursive instances
1 changed files with 8 additions and 2 deletions

View File

@ -71,6 +71,14 @@ static void geo_node_collection_info_exec(GeoNodeExecParams params)
params.set_output("Geometry", geometry_set_out);
return;
}
const Object *self_object = params.self_object();
const bool is_recursive = BKE_collection_has_object_recursive_instanced(collection,
(Object *)self_object);
if (is_recursive) {
params.error_message_add(NodeWarningType::Error, "Collection contains current object");
params.set_output("Geometry", geometry_set_out);
return;
}
const bNode &bnode = params.node();
NodeGeometryCollectionInfo *node_storage = (NodeGeometryCollectionInfo *)bnode.storage;
@ -79,8 +87,6 @@ static void geo_node_collection_info_exec(GeoNodeExecParams params)
InstancesComponent &instances = geometry_set_out.get_component_for_write<InstancesComponent>();
const Object *self_object = params.self_object();
const bool separate_children = params.get_input<bool>("Separate Children");
if (separate_children) {
const bool reset_children = params.get_input<bool>("Reset Children");