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:
authorJacques Lucke <jacques@blender.org>2020-07-12 13:38:03 +0300
committerJacques Lucke <jacques@blender.org>2020-07-12 13:38:03 +0300
commit838b1742fb99f7d0eba203313b6faa3cfc89ef8d (patch)
treeae6d98d34bcf27cf8b8d750af2d52d456ce8279f /source/blender
parent404486e66c6a4ebebb085700d58b396597146add (diff)
Functions: minor improvements
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/functions/FN_multi_function.hh5
-rw-r--r--source/blender/functions/FN_multi_function_param_type.hh5
-rw-r--r--source/blender/functions/FN_spans.hh5
-rw-r--r--source/blender/functions/intern/multi_function_network_evaluation.cc12
4 files changed, 21 insertions, 6 deletions
diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh
index c53959203cb..35f144368ac 100644
--- a/source/blender/functions/FN_multi_function.hh
+++ b/source/blender/functions/FN_multi_function.hh
@@ -73,6 +73,11 @@ class MultiFunction {
return false;
}
+ uint param_amount() const
+ {
+ return signature_.param_types.size();
+ }
+
IndexRange param_indices() const
{
return signature_.param_types.index_range();
diff --git a/source/blender/functions/FN_multi_function_param_type.hh b/source/blender/functions/FN_multi_function_param_type.hh
index 0e43e355b53..7c16b8cdf10 100644
--- a/source/blender/functions/FN_multi_function_param_type.hh
+++ b/source/blender/functions/FN_multi_function_param_type.hh
@@ -144,6 +144,11 @@ class MFParamType {
return ELEM(interface_type_, Output, Mutable);
}
+ bool is_output() const
+ {
+ return interface_type_ == Output;
+ }
+
friend bool operator==(const MFParamType &a, const MFParamType &b);
friend bool operator!=(const MFParamType &a, const MFParamType &b);
};
diff --git a/source/blender/functions/FN_spans.hh b/source/blender/functions/FN_spans.hh
index 2e3ba94fce3..c8c98d66628 100644
--- a/source/blender/functions/FN_spans.hh
+++ b/source/blender/functions/FN_spans.hh
@@ -344,6 +344,11 @@ class GVSpan : public VSpanBase<void> {
return GVSpan::FromSingle(type, value, UINT32_MAX);
}
+ static GVSpan FromDefault(const CPPType &type)
+ {
+ return GVSpan::FromSingleWithMaxSize(type, type.default_value());
+ }
+
static GVSpan FromFullPointerArray(const CPPType &type, const void *const *values, uint size)
{
GVSpan ref;
diff --git a/source/blender/functions/intern/multi_function_network_evaluation.cc b/source/blender/functions/intern/multi_function_network_evaluation.cc
index b4dce040da6..b59cbc6a1a2 100644
--- a/source/blender/functions/intern/multi_function_network_evaluation.cc
+++ b/source/blender/functions/intern/multi_function_network_evaluation.cc
@@ -106,30 +106,30 @@ MFNetworkEvaluator::MFNetworkEvaluator(Vector<const MFOutputSocket *> inputs,
BLI_assert(outputs_.size() > 0);
MFSignatureBuilder signature = this->get_builder("Function Tree");
- for (auto socket : inputs_) {
+ for (const MFOutputSocket *socket : inputs_) {
BLI_assert(socket->node().is_dummy());
MFDataType type = socket->data_type();
switch (type.category()) {
case MFDataType::Single:
- signature.single_input("Input", type.single_type());
+ signature.single_input(socket->name(), type.single_type());
break;
case MFDataType::Vector:
- signature.vector_input("Input", type.vector_base_type());
+ signature.vector_input(socket->name(), type.vector_base_type());
break;
}
}
- for (auto socket : outputs_) {
+ for (const MFInputSocket *socket : outputs_) {
BLI_assert(socket->node().is_dummy());
MFDataType type = socket->data_type();
switch (type.category()) {
case MFDataType::Single:
- signature.single_output("Output", type.single_type());
+ signature.single_output(socket->name(), type.single_type());
break;
case MFDataType::Vector:
- signature.vector_output("Output", type.vector_base_type());
+ signature.vector_output(socket->name(), type.vector_base_type());
break;
}
}