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>2021-05-14 01:47:46 +0300
committerHans Goudey <h.goudey@me.com>2021-05-14 01:47:46 +0300
commitc5d38a2be8e746379181dd1accb184e762459a29 (patch)
tree1838540ec46565b81435e68b89edef76cdde26df /source/blender/functions/intern
parent88aee2986fe2ae5b9d6d33f38aa638ebcd70928c (diff)
Functions: Expose set_all method for generic virtual arrays
This is very similar to rB5613c61275fe6 and rB0061150e4c90d, basically just exposing a `VMutableArray` method to its generic counterpart. This is quite important for curve point attributes to avoid a lookup for every point when there are multiple splines.
Diffstat (limited to 'source/blender/functions/intern')
-rw-r--r--source/blender/functions/intern/generic_virtual_array.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/functions/intern/generic_virtual_array.cc b/source/blender/functions/intern/generic_virtual_array.cc
index a835e7a54a9..87dae06ccdc 100644
--- a/source/blender/functions/intern/generic_virtual_array.cc
+++ b/source/blender/functions/intern/generic_virtual_array.cc
@@ -160,6 +160,19 @@ void GVMutableArray::set_by_relocate_impl(const int64_t index, void *value)
type_->destruct(value);
}
+void GVMutableArray::set_all_impl(const void *src)
+{
+ if (this->is_span()) {
+ const GMutableSpan span = this->get_internal_span();
+ type_->copy_to_initialized_n(src, span.data(), size_);
+ }
+ else {
+ for (int64_t i : IndexRange(size_)) {
+ this->set_by_copy(i, POINTER_OFFSET(src, type_->size() * i));
+ }
+ }
+}
+
void *GVMutableArray::try_get_internal_mutable_varray_impl()
{
return nullptr;