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
This commit is contained in:
Jacques Lucke 2021-11-25 10:33:05 +01:00
parent a0acb9bd0c
commit 82808e18e6
Notes: blender-bot 2023-02-14 08:07:50 +01:00
Referenced by issue #93362, Crash When Capturing Attribute after Fillet Curve Node
Referenced by issue #93353, Reload Library Override file loses Constraints
1 changed files with 5 additions and 2 deletions

View File

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