diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-25 12:33:05 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-25 12:33:05 +0300 |
commit | 82808e18e6562e9c06626a4e938cb2ad4fa34a0f (patch) | |
tree | 5a0ffc23b4ee4e2f89c0cdad8734f69aaaabb22c /source/blender | |
parent | a0acb9bd0cc049b7b8b941b251c42684b4a0f274 (diff) |
Fix T93362: crash when capturing attribute after fillet curve node
The issue was that the attribute propagation in the Fillet Curve node seems
pretty broken. I couldn't really make sense of the old code. It changed the
size of the point attribute domains on splines to 1 for some reason which
led to a crash in the next node.
Differential Revision: https://developer.blender.org/D13362
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc index 27d7d22b106..cee26232eb2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_fillet.cc @@ -332,14 +332,17 @@ static void copy_common_attributes_by_mapping(const Spline &src, copy_attribute_by_mapping(src.radii(), dst.radii(), mapping); copy_attribute_by_mapping(src.tilts(), dst.tilts(), mapping); - dst.attributes.reallocate(1); src.attributes.foreach_attribute( [&](const AttributeIDRef &attribute_id, const AttributeMetaData &meta_data) { std::optional<GSpan> src_attribute = src.attributes.get_for_read(attribute_id); if (dst.attributes.create(attribute_id, meta_data.data_type)) { std::optional<GMutableSpan> dst_attribute = dst.attributes.get_for_write(attribute_id); if (dst_attribute) { - src_attribute->type().copy_assign(src_attribute->data(), dst_attribute->data()); + attribute_math::convert_to_static_type(dst_attribute->type(), [&](auto dummy) { + using T = decltype(dummy); + copy_attribute_by_mapping( + src_attribute->typed<T>(), dst_attribute->typed<T>(), mapping); + }); return true; } } |