[Bf-blender-cvs] [93fd07e19cf] master: Geometry Nodes: Copy spline attributes in the curve resample node

Hans Goudey noreply at git.blender.org
Wed Jun 9 22:54:33 CEST 2021


Commit: 93fd07e19cf82efd8a0e5882e78f8a49d8053d7d
Author: Hans Goudey
Date:   Wed Jun 9 15:54:26 2021 -0500
Branches: master
https://developer.blender.org/rB93fd07e19cf82efd8a0e5882e78f8a49d8053d7d

Geometry Nodes: Copy spline attributes in the curve resample node

Previously only point domain attributes were copied to the result curve.

===================================================================

M	source/blender/blenkernel/BKE_attribute_access.hh
M	source/blender/blenkernel/intern/attribute_access.cc
M	source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc

===================================================================

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



More information about the Bf-blender-cvs mailing list