Fix #119702: Set Position node behaves incorrectly on instances with selection

The selection was not taken into account properly and uninitialized data was used.

Pull Request: https://projects.blender.org/blender/blender/pulls/120409
This commit is contained in:
Jacques Lucke
2024-04-09 13:11:19 +02:00
parent 1a37017244
commit d3c98e6753

View File

@@ -111,12 +111,11 @@ static void set_instances_position(bke::Instances &instances,
evaluator.add_with_destination(position_field, result.as_mutable_span());
evaluator.evaluate();
const IndexMask selection = evaluator.get_evaluated_selection_as_mask();
MutableSpan<float4x4> transforms = instances.transforms_for_write();
threading::parallel_for(transforms.index_range(), 2048, [&](const IndexRange range) {
for (const int i : range) {
transforms[i].location() = result[i];
}
});
selection.foreach_index(GrainSize(2048),
[&](const int i) { transforms[i].location() = result[i]; });
}
static void node_geo_exec(GeoNodeExecParams params)