From 600c069e0ef5334575164e5c4d758efe7324b0c7 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 21 Sep 2022 12:19:04 -0500 Subject: Attributes: Correct implementation of typed "write_only" method The typed "lookup_or_add_for_write_only" function is meant to do the same thing as the non-typed version of the function. Instead, it still initialized values of new attribute arrays, which isn't meant to happen. Missed in 4c91c24bc7cbe2c4f97be373. I also had to correct one place that used the "write_only" function but didn't intialize all values. --- source/blender/blenkernel/BKE_attribute.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index b1f4039f788..97a8a91d0e4 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -706,7 +706,9 @@ class MutableAttributeAccessor : public AttributeAccessor { SpanAttributeWriter lookup_or_add_for_write_only_span(const AttributeIDRef &attribute_id, const eAttrDomain domain) { - AttributeWriter attribute = this->lookup_or_add_for_write(attribute_id, domain); + AttributeWriter attribute = this->lookup_or_add_for_write( + attribute_id, domain, AttributeInitConstruct()); + if (attribute) { return SpanAttributeWriter{std::move(attribute), false}; } -- cgit v1.2.3