diff options
Diffstat (limited to 'source/blender/functions/FN_field.hh')
-rw-r--r-- | source/blender/functions/FN_field.hh | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index 7889126fe76..77c1dedb721 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -153,6 +153,11 @@ class FieldFunction { function_ = owned_function_.get(); } + FieldFunction(const MultiFunction &function, Vector<GField> inputs = {}) + : function_(&function), inputs_(std::move(inputs)) + { + } + Span<GField> inputs() const { return inputs_; @@ -163,13 +168,20 @@ class FieldFunction { return *function_; } - const CPPType &cpp_type_of_output_index(int index) const - { - MFParamType param_type = function_->param_type(index); - MFDataType data_type = param_type.data_type(); - BLI_assert(param_type.interface_type() == MFParamType::Output); - BLI_assert(data_type.is_single()); - return data_type.single_type(); + const CPPType &cpp_type_of_output_index(int output_index) const + { + int output_counter = 0; + for (const int param_index : function_->param_indices()) { + MFParamType param_type = function_->param_type(param_index); + if (param_type.is_output()) { + if (output_counter == output_index) { + return param_type.data_type().single_type(); + } + output_counter++; + } + } + BLI_assert_unreachable(); + return CPPType::get<float>(); } }; |