Geometry Nodes: Copy spline attributes in the curve resample node

Previously only point domain attributes were copied to the result curve.
This commit is contained in:
2021-06-09 15:54:26 -05:00
parent 5f19646d7e
commit 93fd07e19c
3 changed files with 12 additions and 1 deletions

View File

@@ -329,6 +329,7 @@ class CustomDataAttributes {
~CustomDataAttributes();
CustomDataAttributes(const CustomDataAttributes &other);
CustomDataAttributes(CustomDataAttributes &&other);
CustomDataAttributes &operator=(const CustomDataAttributes &other);
void reallocate(const int size);

View File

@@ -617,6 +617,16 @@ CustomDataAttributes::CustomDataAttributes(CustomDataAttributes &&other)
CustomData_reset(&other.data);
}
CustomDataAttributes &CustomDataAttributes::operator=(const CustomDataAttributes &other)
{
if (this != &other) {
CustomData_copy(&other.data, &data, CD_MASK_ALL, CD_DUPLICATE, other.size_);
size_ = other.size_;
}
return *this;
}
std::optional<GSpan> CustomDataAttributes::get_for_read(const StringRef name) const
{
BLI_assert(size_ != 0);

View File

@@ -153,7 +153,7 @@ static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve,
}
}
output_curve->attributes.reallocate(output_curve->splines().size());
output_curve->attributes = input_curve.attributes;
return output_curve;
}