diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-21 21:17:05 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-21 21:17:05 +0300 |
commit | 91dd29fd45d190728f29cc2f6cf9cd5549392f61 (patch) | |
tree | 72a579bcacdcc96e0bd8806364d80199d156bdfd /source/blender/blenkernel | |
parent | 600c069e0ef5334575164e5c4d758efe7324b0c7 (diff) |
Attributes: Allow calling "finish" on empty accessors
This removes some boilerplate when creating many optional attributes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_attribute.hh | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/blenkernel/BKE_attribute.hh b/source/blender/blenkernel/BKE_attribute.hh index 97a8a91d0e4..7b13b8a2b09 100644 --- a/source/blender/blenkernel/BKE_attribute.hh +++ b/source/blender/blenkernel/BKE_attribute.hh @@ -264,7 +264,9 @@ template<typename T> struct SpanAttributeWriter { */ void finish() { - this->span.save(); + if (this->span.varray()) { + this->span.save(); + } if (this->tag_modified_fn) { this->tag_modified_fn(); } @@ -339,7 +341,9 @@ struct GSpanAttributeWriter { void finish() { - this->span.save(); + if (this->span.varray()) { + this->span.save(); + } if (this->tag_modified_fn) { this->tag_modified_fn(); } |