[Bf-blender-cvs] [118803893e6] master: Cleanup: Simplify realizing of pointcloud instances

Hans Goudey noreply at git.blender.org
Fri Jul 16 21:29:52 CEST 2021


Commit: 118803893e65c52c02ed274f7be2d60c668d5b56
Author: Hans Goudey
Date:   Fri Jul 16 15:29:42 2021 -0400
Branches: master
https://developer.blender.org/rB118803893e65c52c02ed274f7be2d60c668d5b56

Cleanup: Simplify realizing of pointcloud instances

Just a small change to make the function slightly shorter.

===================================================================

M	source/blender/blenkernel/intern/geometry_set_instances.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc
index 47c8df03375..90a97264c8f 100644
--- a/source/blender/blenkernel/intern/geometry_set_instances.cc
+++ b/source/blender/blenkernel/intern/geometry_set_instances.cc
@@ -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;
     }



More information about the Bf-blender-cvs mailing list