diff options
author | Falk David <falkdavid@gmx.de> | 2021-01-21 23:59:56 +0300 |
---|---|---|
committer | Falk David <falkdavid@gmx.de> | 2021-01-21 23:59:56 +0300 |
commit | 41982af6a0fc8e11cf004a356f97222d7eb72c02 (patch) | |
tree | b2516ecfb2b8be83abd4e4271dd6c8d4f8c15916 /source/blender/blenkernel/intern | |
parent | b4b02eb4ff772f1df6f37c5910695e2e8168d078 (diff) | |
parent | f24992d2ec76bae600879ee6222ffbcc98de3fe8 (diff) |
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/attribute_access.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index 21ab7f61447..85dabe4490c 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -873,10 +873,19 @@ OutputAttributePtr::OutputAttributePtr(GeometryComponent &component, const int domain_size = component.attribute_domain_size(domain); void *buffer = MEM_malloc_arrayN(domain_size, cpp_type->size(), __func__); - cpp_type->construct_default_n(buffer, domain_size); + GMutableSpan new_span{*cpp_type, buffer, domain_size}; + + /* Copy converted values from conflicting attribute, in case the value is read. + * TODO: An optimization could be to not do this, when the caller says that the attribute will + * only be written. */ + ReadAttributePtr src_attribute = component.attribute_get_for_read( + final_name, domain, data_type, nullptr); + for (const int i : blender::IndexRange(domain_size)) { + src_attribute->get(i, new_span[i]); + } attribute_ = std::make_unique<blender::bke::TemporaryWriteAttribute>( - domain, GMutableSpan{*cpp_type, buffer, domain_size}, component, std::move(final_name)); + domain, new_span, component, std::move(final_name)); } /* Store the computed attribute. If it was stored from the beginning already, nothing is done. This |