Fix T92848: Crash when joining curves with spline domain attributes

The point domain attributes (stored on splines) are sorted so they
have a consistent order on all splines after the join. However, spline
domain attributes were included in the new order, which didn't work
because the length of the attribute lists didn't match. The simple fix
is to only include point domain attributes in the new order vector.
This commit is contained in:
Hans Goudey 2021-11-05 10:55:51 -05:00
parent 7c75529333
commit 594ee5f160
Notes: blender-bot 2023-02-14 06:42:54 +01:00
Referenced by issue #92848, Geometry Nodes: Attribute Capture crash when joining curves
2 changed files with 10 additions and 4 deletions

View File

@ -540,8 +540,11 @@ static void sort_curve_point_attributes(const Map<AttributeIDRef, AttributeKind>
MutableSpan<SplinePtr> splines)
{
Vector<AttributeIDRef> new_order;
for (const AttributeIDRef attribute_id : info.keys()) {
new_order.append(attribute_id);
for (Map<AttributeIDRef, AttributeKind>::Item item : info.items()) {
if (item.value.domain == ATTR_DOMAIN_POINT) {
/* Only sort attributes stored on splines. */
new_order.append(item.key);
}
}
for (SplinePtr &spline : splines) {
spline->attributes.reorder(new_order);

View File

@ -366,8 +366,11 @@ static void sort_curve_point_attributes(const Map<AttributeIDRef, AttributeMetaD
MutableSpan<SplinePtr> splines)
{
Vector<AttributeIDRef> new_order;
for (const AttributeIDRef attribute_id : info.keys()) {
new_order.append(attribute_id);
for (Map<AttributeIDRef, AttributeMetaData>::Item item : info.items()) {
if (item.value.domain == ATTR_DOMAIN_POINT) {
/* Only sort attributes stored on splines. */
new_order.append(item.key);
}
}
for (SplinePtr &spline : splines) {
spline->attributes.reorder(new_order);