Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-09-21 21:17:05 +0300
committerHans Goudey <h.goudey@me.com>2022-09-21 21:17:05 +0300
commit91dd29fd45d190728f29cc2f6cf9cd5549392f61 (patch)
tree72a579bcacdcc96e0bd8806364d80199d156bdfd /source/blender/blenkernel
parent600c069e0ef5334575164e5c4d758efe7324b0c7 (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.hh8
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();
}