From 2add72df04451b043ded09cfeb9cccc8989d0c40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=B8=D0=BB=D1=8C=D1=8F=20=5F?= Date: Mon, 2 Jun 2025 18:47:44 +0200 Subject: [PATCH] Fix: Geometry Nodes: Duplicate Elements node propagates instance handles incorrectly The old code did not take the case into account when there is a non-full selection is passed in. Pull Request: https://projects.blender.org/blender/blender/pulls/139556 --- .../geometry/nodes/node_geo_duplicate_elements.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc index 0440d4c87e8..da93dc67639 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_duplicate_elements.cc @@ -1116,16 +1116,16 @@ static void duplicate_instances(GeometrySet &geometry_set, std::unique_ptr dst_instances = std::make_unique(); dst_instances->resize(duplicates.total_size()); - for (const int i_selection : selection.index_range()) { - const IndexRange range = duplicates[i_selection]; + selection.foreach_index([&](const int i_src, const int i_dst) { + const IndexRange range = duplicates[i_dst]; if (range.is_empty()) { - continue; + return; } - const int old_handle = src_instances.reference_handles()[i_selection]; + const int old_handle = src_instances.reference_handles()[i_src]; const bke::InstanceReference reference = src_instances.references()[old_handle]; const int new_handle = dst_instances->add_reference(reference); dst_instances->reference_handles_for_write().slice(range).fill(new_handle); - } + }); bke::gather_attributes_to_groups( src_instances.attributes(),