diff options
author | Hans Goudey <h.goudey@me.com> | 2022-07-08 23:35:18 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-07-08 23:35:18 +0300 |
commit | 111bf7d76b080555fd524b2b4a138bcad2e5b206 (patch) | |
tree | e9e14ca4102ec0c73261745a9ff7b7aa2de1cc57 /source/blender/geometry/intern/resample_curves.cc | |
parent | b4db5a93bcf92b731d0e358602816cce2dbbd7cb (diff) | |
parent | 2ee68917287627a3803a8eae91d4d788ac316185 (diff) |
Merge branch 'master' into temp-legacy-mesh-format-option
Diffstat (limited to 'source/blender/geometry/intern/resample_curves.cc')
-rw-r--r-- | source/blender/geometry/intern/resample_curves.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/geometry/intern/resample_curves.cc b/source/blender/geometry/intern/resample_curves.cc index dd1da62408c..c9b8a032ce6 100644 --- a/source/blender/geometry/intern/resample_curves.cc +++ b/source/blender/geometry/intern/resample_curves.cc @@ -92,17 +92,18 @@ static void retrieve_attribute_spans(const Span<bke::AttributeIDRef> ids, CurveComponent &dst_component, Vector<GSpan> &src, Vector<GMutableSpan> &dst, - Vector<bke::OutputAttribute> &dst_attributes) + Vector<bke::GSpanAttributeWriter> &dst_attributes) { for (const int i : ids.index_range()) { - GVArray src_attribute = src_component.attribute_try_get_for_read(ids[i], ATTR_DOMAIN_POINT); + GVArray src_attribute = src_component.attributes()->lookup(ids[i], ATTR_DOMAIN_POINT); BLI_assert(src_attribute); src.append(src_attribute.get_internal_span()); const eCustomDataType data_type = bke::cpp_type_to_custom_data_type(src_attribute.type()); - bke::OutputAttribute dst_attribute = dst_component.attribute_try_get_for_output_only( - ids[i], ATTR_DOMAIN_POINT, data_type); - dst.append(dst_attribute.as_span()); + bke::GSpanAttributeWriter dst_attribute = + dst_component.attributes_for_write()->lookup_or_add_for_write_only_span( + ids[i], ATTR_DOMAIN_POINT, data_type); + dst.append(dst_attribute.span); dst_attributes.append(std::move(dst_attribute)); } } @@ -111,7 +112,7 @@ struct AttributesForInterpolation : NonCopyable, NonMovable { Vector<GSpan> src; Vector<GMutableSpan> dst; - Vector<bke::OutputAttribute> dst_attributes; + Vector<bke::GSpanAttributeWriter> dst_attributes; Vector<GSpan> src_no_interpolation; Vector<GMutableSpan> dst_no_interpolation; @@ -129,8 +130,8 @@ static void gather_point_attributes_to_interpolate(const CurveComponent &src_com VectorSet<bke::AttributeIDRef> ids; VectorSet<bke::AttributeIDRef> ids_no_interpolation; - src_component.attribute_foreach( - [&](const bke::AttributeIDRef &id, const AttributeMetaData meta_data) { + src_component.attributes()->for_all( + [&](const bke::AttributeIDRef &id, const bke::AttributeMetaData meta_data) { if (meta_data.domain != ATTR_DOMAIN_POINT) { return true; } @@ -311,8 +312,8 @@ static Curves *resample_to_uniform(const CurveComponent &src_component, bke::curves::copy_point_data( src_curves, dst_curves, unselected_ranges, src_positions, dst_positions); - for (bke::OutputAttribute &attribute : attributes.dst_attributes) { - attribute.save(); + for (bke::GSpanAttributeWriter &attribute : attributes.dst_attributes) { + attribute.finish(); } return dst_curves_id; @@ -433,8 +434,8 @@ Curves *resample_to_evaluated(const CurveComponent &src_component, bke::curves::copy_point_data( src_curves, dst_curves, unselected_ranges, src_positions, dst_positions); - for (bke::OutputAttribute &attribute : attributes.dst_attributes) { - attribute.save(); + for (bke::GSpanAttributeWriter &attribute : attributes.dst_attributes) { + attribute.finish(); } return dst_curves_id; |