From 149fd7b65f311bce7922cdb390710b40bdab1db8 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Tue, 31 Aug 2021 11:41:53 +0200 Subject: initial support for function nodes in evaluator --- source/blender/functions/FN_field.hh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'source/blender/functions') 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 inputs = {}) + : function_(&function), inputs_(std::move(inputs)) + { + } + Span 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(); } }; -- cgit v1.2.3