From dc797e12106eb4f73f4e6a14ded6798dd5201383 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 3 Jan 2025 19:55:15 +0100 Subject: [PATCH] Revert "Fix #132408: crash when outputting anonymous attribute from foreach zone" This breaks some tests. This reverts commit e9482798185c15cc308e2cdcfe07ce4d1ca84a77. --- .../intern/node_tree_reference_lifetimes.cc | 20 ------------------- .../node_geo_foreach_geometry_element.cc | 6 ++++++ 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/source/blender/blenkernel/intern/node_tree_reference_lifetimes.cc b/source/blender/blenkernel/intern/node_tree_reference_lifetimes.cc index 9c1e764df1e..5edf6388734 100644 --- a/source/blender/blenkernel/intern/node_tree_reference_lifetimes.cc +++ b/source/blender/blenkernel/intern/node_tree_reference_lifetimes.cc @@ -414,8 +414,6 @@ static bool pass_left_to_right(const bNodeTree &tree, } const bNode *input_node = zone->input_node; const bNode *output_node = node; - const auto *storage = static_cast( - node->storage); const int src_index = input_node->input_socket(0).index_in_tree(); for (const bNodeSocket *output_socket : output_node->output_sockets()) { if (output_socket->type == SOCK_GEOMETRY) { @@ -423,24 +421,6 @@ static bool pass_left_to_right(const bNodeTree &tree, r_potential_data_by_socket[dst_index] |= r_potential_data_by_socket[src_index]; } } - - /* Propagate references from the inside to the outside. Like in the repeat zone, new - * references created in the zone stay local inside the zone and are not propagated to the - * outside. Instead, the foreach-element output node creates new references. */ - const BitVector<> outside_references = get_references_coming_from_outside_zone( - *zone, r_potential_data_by_socket, r_potential_reference_by_socket); - for (const int item_i : IndexRange(storage->generation_items.items_num)) { - const int src_index = - node->input_socket(storage->main_items.items_num + item_i).index_in_tree(); - const int dst_index = - node->output_socket(1 + storage->main_items.items_num + item_i).index_in_tree(); - bits::inplace_or_masked(r_potential_data_by_socket[dst_index], - outside_references, - r_potential_data_by_socket[src_index]); - bits::inplace_or_masked(r_potential_reference_by_socket[dst_index], - outside_references, - r_potential_reference_by_socket[src_index]); - } break; } case GEO_NODE_REPEAT_OUTPUT: { diff --git a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc index edbecfc2afc..56f05e157d6 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_foreach_geometry_element.cc @@ -236,6 +236,8 @@ static void node_declare(NodeDeclarationBuilder &b) "The original input geometry with potentially new attributes that are output by the " "zone"); + aal::RelationsInNode &relations = b.get_anonymous_attribute_relations(); + const bNode *node = b.node_or_null(); const bNodeTree *tree = b.tree_or_null(); if (node && tree) { @@ -282,6 +284,10 @@ static void node_declare(NodeDeclarationBuilder &b) if (socket_type == SOCK_GEOMETRY) { previous_input_geometry_index = input_decl.index(); previous_output_geometry_index = output_decl.index(); + aal::PropagateRelation relation; + relation.from_geometry_input = input_decl.index(); + relation.to_geometry_output = output_decl.index(); + relations.propagate_relations.append(relation); input_decl.description( "Geometry generated in the current iteration. Will be joined with geometries from all "