diff options
author | Hans Goudey <h.goudey@me.com> | 2021-06-09 23:54:26 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-06-09 23:54:26 +0300 |
commit | 93fd07e19cf82efd8a0e5882e78f8a49d8053d7d (patch) | |
tree | 04554df657a357ee639a9ac222914e6f2a8db532 | |
parent | 5f19646d7edef02479bccd7e898f072c9e54ac6e (diff) |
Geometry Nodes: Copy spline attributes in the curve resample node
Previously only point domain attributes were copied to the result curve.
-rw-r--r-- | source/blender/blenkernel/BKE_attribute_access.hh | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 10 | ||||
-rw-r--r-- | source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index 381a03d29d7..c3f7dbd4bd9 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -329,6 +329,7 @@ class CustomDataAttributes { ~CustomDataAttributes(); CustomDataAttributes(const CustomDataAttributes &other); CustomDataAttributes(CustomDataAttributes &&other); + CustomDataAttributes &operator=(const CustomDataAttributes &other); void reallocate(const int size); diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index f2ad873b10e..8bbb3014dac 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -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); 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 9d0820eb0b0..e879ec624c0 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc @@ -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; } |