Fix T104256: Curve to points node skips curve domain attributes

7536abbe16 forgot to port the curve domain attributes.
This commit is contained in:
Hans Goudey 2023-02-06 16:15:35 -05:00
parent 6dcfb6df9c
commit 3a1583972a
Notes: blender-bot 2023-06-07 10:31:13 +02:00
Referenced by issue #104256, Regression: Geometry Nodes: Curve to Points node not propagating attributes from spline domain
Referenced by issue #106093, Regression: Geometry Nodes: Curve to Points node stopped inherit data captured by spline domain
1 changed files with 21 additions and 0 deletions

View File

@ -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;
}