[Bf-blender-cvs] [0521272ab38] master: Fix: Curve Resample Node: Copy attributes to 1 point results
Hans Goudey
noreply at git.blender.org
Wed Jul 7 03:43:25 CEST 2021
Commit: 0521272ab3817b599dec64639d081e04c236bddd
Author: Hans Goudey
Date: Tue Jul 6 20:42:21 2021 -0500
Branches: master
https://developer.blender.org/rB0521272ab3817b599dec64639d081e04c236bddd
Fix: Curve Resample Node: Copy attributes to 1 point results
The curve resample node neglected to copy attributes to single point
result splines. That could have caused errors if some of the splines
in the result had only one point but others had more.
===================================================================
M source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
===================================================================
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
index fc65d1754e9..ad0c453c2af 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc
@@ -87,6 +87,23 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count)
input_spline.tilts().first(),
input_spline.radii().first());
output_spline->attributes.reallocate(1);
+ input_spline.attributes.foreach_attribute(
+ [&](StringRefNull name, const AttributeMetaData &meta_data) {
+ std::optional<GSpan> src = input_spline.attributes.get_for_read(name);
+ BLI_assert(src);
+ if (!output_spline->attributes.create(name, meta_data.data_type)) {
+ BLI_assert_unreachable();
+ return false;
+ }
+ std::optional<GMutableSpan> dst = output_spline->attributes.get_for_write(name);
+ if (!dst) {
+ BLI_assert_unreachable();
+ return false;
+ }
+ src->type().copy_assign(src->data(), dst->data());
+ return true;
+ },
+ ATTR_DOMAIN_POINT);
return output_spline;
}
More information about the Bf-blender-cvs
mailing list