diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-08 03:58:04 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-08 03:58:04 +0300 |
commit | c238728105272b0f11ff5b03a701cc180bf68bb8 (patch) | |
tree | 032fedf4a81ab2160679f2def4e051abb75a6e97 /source/blender/blenkernel | |
parent | b8f1ae5c388608e0e47dbc84f75a01453f2013ef (diff) |
Fix: Curves cyclic access function duplicates attribute
This was an oversight in 6594e802ab94ff11. First it must check if the
attribute exists before adding it.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/curves_geometry.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/curves_geometry.cc b/source/blender/blenkernel/intern/curves_geometry.cc index 3eea579230a..2a22b2eb0f3 100644 --- a/source/blender/blenkernel/intern/curves_geometry.cc +++ b/source/blender/blenkernel/intern/curves_geometry.cc @@ -181,7 +181,12 @@ VArray<bool> CurvesGeometry::cyclic() const MutableSpan<bool> CurvesGeometry::cyclic() { - bool *data = (bool *)CustomData_add_layer_named( + bool *data = (bool *)CustomData_duplicate_referenced_layer_named( + &this->curve_data, CD_PROP_BOOL, ATTR_CYCLIC.c_str(), this->curve_size); + if (data != nullptr) { + return {data, this->curve_size}; + } + data = (bool *)CustomData_add_layer_named( &this->curve_data, CD_PROP_BOOL, CD_CALLOC, nullptr, this->curve_size, ATTR_CYCLIC.c_str()); return {data, this->curve_size}; } |