Cleanup: Simplify realizing of pointcloud instances

Just a small change to make the function slightly shorter.
This commit is contained in:
Hans Goudey 2021-07-16 15:29:42 -04:00
parent 0793ced8ad
commit 118803893e
Notes: blender-bot 2023-02-14 03:59:42 +01:00
Referenced by issue #96781, Regression: Blender crash when using a particle system + grease pencil line art modifier
Referenced by issue #89942, Sculpt: Grid overlay for Grab active point do not work.
Referenced by issue #89937, Attribute proximity broken after animating the "brush"
1 changed files with 2 additions and 3 deletions

View File

@ -565,6 +565,7 @@ static PointCloud *join_pointcloud_position_attribute(Span<GeometryInstanceGroup
}
PointCloud *new_pointcloud = BKE_pointcloud_new_nomain(totpoint);
MutableSpan new_positions{(float3 *)new_pointcloud->co, new_pointcloud->totpoint};
/* Transform each instance's point locations into the new point cloud. */
int offset = 0;
@ -576,9 +577,7 @@ static PointCloud *join_pointcloud_position_attribute(Span<GeometryInstanceGroup
}
for (const float4x4 &transform : set_group.transforms) {
for (const int i : IndexRange(pointcloud->totpoint)) {
const float3 old_position = pointcloud->co[i];
const float3 new_position = transform * old_position;
copy_v3_v3(new_pointcloud->co[offset + i], new_position);
new_positions[offset + i] = transform * float3(pointcloud->co[i]);
}
offset += pointcloud->totpoint;
}