diff options
Diffstat (limited to 'source/blender/functions/intern')
-rw-r--r-- | source/blender/functions/intern/cpp_types.cc | 1 | ||||
-rw-r--r-- | source/blender/functions/intern/field.cc | 1 | ||||
-rw-r--r-- | source/blender/functions/intern/multi_function_procedure_executor.cc | 27 |
3 files changed, 12 insertions, 17 deletions
diff --git a/source/blender/functions/intern/cpp_types.cc b/source/blender/functions/intern/cpp_types.cc index a2adc2ea8b6..5c43fffdd61 100644 --- a/source/blender/functions/intern/cpp_types.cc +++ b/source/blender/functions/intern/cpp_types.cc @@ -11,6 +11,7 @@ MAKE_FIELD_CPP_TYPE(FloatField, float); MAKE_FIELD_CPP_TYPE(Float2Field, blender::float2); MAKE_FIELD_CPP_TYPE(Float3Field, blender::float3); MAKE_FIELD_CPP_TYPE(ColorGeometry4fField, blender::ColorGeometry4f); +MAKE_FIELD_CPP_TYPE(ColorGeometry4bField, blender::ColorGeometry4b); MAKE_FIELD_CPP_TYPE(BoolField, bool); MAKE_FIELD_CPP_TYPE(Int8Field, int8_t); MAKE_FIELD_CPP_TYPE(Int32Field, int32_t); diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index 944674c23a9..a53da717606 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -8,6 +8,7 @@ #include "BLI_vector_set.hh" #include "FN_field.hh" +#include "FN_multi_function_builder.hh" #include "FN_multi_function_procedure.hh" #include "FN_multi_function_procedure_builder.hh" #include "FN_multi_function_procedure_executor.hh" diff --git a/source/blender/functions/intern/multi_function_procedure_executor.cc b/source/blender/functions/intern/multi_function_procedure_executor.cc index 7a0b74d8039..c58ca0bb8fd 100644 --- a/source/blender/functions/intern/multi_function_procedure_executor.cc +++ b/source/blender/functions/intern/multi_function_procedure_executor.cc @@ -681,14 +681,9 @@ class VariableState : NonCopyable, NonMovable { /* Sanity check to make sure that enough indices can be destructed. */ BLI_assert(new_tot_initialized >= 0); - bool do_destruct_self = false; - switch (value_->type) { case ValueType::GVArray: { - if (mask.size() == full_mask.size()) { - do_destruct_self = true; - } - else { + if (mask.size() < full_mask.size()) { /* Not all elements are destructed. Since we can't work on the original array, we have to * create a copy first. */ this->ensure_is_mutable(full_mask, data_type, value_allocator); @@ -701,16 +696,10 @@ class VariableState : NonCopyable, NonMovable { case ValueType::Span: { const CPPType &type = data_type.single_type(); type.destruct_indices(this->value_as<VariableValue_Span>()->data, mask); - if (new_tot_initialized == 0) { - do_destruct_self = true; - } break; } case ValueType::GVVectorArray: { - if (mask.size() == full_mask.size()) { - do_destruct_self = true; - } - else { + if (mask.size() < full_mask.size()) { /* Not all elements are cleared. Since we can't work on the original vector array, we * have to create a copy first. A possible future optimization is to create the partial * copy directly. */ @@ -729,22 +718,26 @@ class VariableState : NonCopyable, NonMovable { BLI_assert(value_typed->is_initialized); UNUSED_VARS_NDEBUG(value_typed); if (mask.size() == tot_initialized_) { - do_destruct_self = true; + const CPPType &type = data_type.single_type(); + type.destruct(value_typed->data); + value_typed->is_initialized = false; } break; } case ValueType::OneVector: { auto *value_typed = this->value_as<VariableValue_OneVector>(); - UNUSED_VARS(value_typed); if (mask.size() == tot_initialized_) { - do_destruct_self = true; + value_typed->data.clear(IndexRange(1)); } break; } } tot_initialized_ = new_tot_initialized; - return do_destruct_self; + + const bool should_self_destruct = new_tot_initialized == 0 && + caller_provided_storage_ == nullptr; + return should_self_destruct; } void indices_split(IndexMask mask, IndicesSplitVectors &r_indices) |