diff options
author | Jacques Lucke <jacques@blender.org> | 2021-08-31 12:41:53 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-08-31 12:41:53 +0300 |
commit | 149fd7b65f311bce7922cdb390710b40bdab1db8 (patch) | |
tree | 97aecfa012454b90fb59079eaf1ce1aec562b923 /source/blender/functions | |
parent | a55c230b8aeb341deb7d76619d21eb614e7d775f (diff) |
initial support for function nodes in evaluator
Diffstat (limited to 'source/blender/functions')
-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>(); } }; |