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
This commit is contained in:
илья _
2025-06-02 18:47:44 +02:00
committed by Jacques Lucke
parent bb6a88b95d
commit 2add72df04

View File

@@ -1116,16 +1116,16 @@ static void duplicate_instances(GeometrySet &geometry_set,
std::unique_ptr<bke::Instances> dst_instances = std::make_unique<bke::Instances>();
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(),