[Bf-blender-cvs] [3a1583972a1] master: Fix T104256: Curve to points node skips curve domain attributes

Hans Goudey noreply at git.blender.org
Mon Feb 6 22:30:49 CET 2023


Commit: 3a1583972a1ccf24b543cad8f9fa7df4e6509938
Author: Hans Goudey
Date:   Mon Feb 6 16:15:35 2023 -0500
Branches: master
https://developer.blender.org/rB3a1583972a1ccf24b543cad8f9fa7df4e6509938

Fix T104256: Curve to points node skips curve domain attributes

7536abbe16bd8672ca38e2b8 forgot to port the curve domain attributes.

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

M	source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc

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

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
index 42f93c31384..075ed8a6ce4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc
@@ -79,6 +79,25 @@ static void fill_rotation_attribute(const Span<float3> tangents,
   });
 }
 
+static void copy_curve_domain_attributes(const AttributeAccessor curve_attributes,
+                                         MutableAttributeAccessor point_attributes)
+{
+  curve_attributes.for_all([&](const bke::AttributeIDRef &id,
+                               const bke::AttributeMetaData &meta_data) {
+    if (curve_attributes.is_builtin(id)) {
+      return true;
+    }
+    if (meta_data.domain != ATTR_DOMAIN_CURVE) {
+      return true;
+    }
+    point_attributes.add(id,
+                         ATTR_DOMAIN_POINT,
+                         meta_data.data_type,
+                         bke::AttributeInitVArray(curve_attributes.lookup(id, ATTR_DOMAIN_POINT)));
+    return true;
+  });
+}
+
 static PointCloud *pointcloud_from_curves(bke::CurvesGeometry curves,
                                           const AttributeIDRef &tangent_id,
                                           const AttributeIDRef &normal_id,
@@ -102,6 +121,8 @@ static PointCloud *pointcloud_from_curves(bke::CurvesGeometry curves,
   pointcloud->pdata = curves.point_data;
   CustomData_reset(&curves.point_data);
 
+  copy_curve_domain_attributes(curves.attributes(), pointcloud->attributes_for_write());
+
   return pointcloud;
 }



More information about the Bf-blender-cvs mailing list