diff options
author | Jacques Lucke <jacques@blender.org> | 2021-11-21 14:57:34 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-11-21 14:57:34 +0300 |
commit | 15011e0b7065243d1122e4eef9e5ba823264725e (patch) | |
tree | 65cdbd6faecbaf635fb3996dfa4b22b9cd2ca147 /source/blender/functions | |
parent | 6ee2abde82ef121cd6e927995053ac33afdbb438 (diff) |
Functions: use static string for parameter names
The idea behind this change is the same as in
rB6ee2abde82ef121cd6e927995053ac33afdbb438.
A `MultiFunction::debug_parameter_name` method could be
added separately when necessary.
Diffstat (limited to 'source/blender/functions')
-rw-r--r-- | source/blender/functions/FN_multi_function_signature.hh | 34 | ||||
-rw-r--r-- | source/blender/functions/intern/multi_function_procedure_executor.cc | 2 |
2 files changed, 18 insertions, 18 deletions
diff --git a/source/blender/functions/FN_multi_function_signature.hh b/source/blender/functions/FN_multi_function_signature.hh index 2ccaa60fed6..3c991bc9c56 100644 --- a/source/blender/functions/FN_multi_function_signature.hh +++ b/source/blender/functions/FN_multi_function_signature.hh @@ -38,7 +38,7 @@ struct MFSignature { * actually needed. */ const char *function_name; - Vector<std::string> param_names; + Vector<const char *> param_names; Vector<MFParamType> param_types; Vector<int> param_data_indices; bool depends_on_context = false; @@ -70,23 +70,23 @@ class MFSignatureBuilder { /* Input Parameter Types */ - template<typename T> void single_input(StringRef name) + template<typename T> void single_input(const char *name) { this->single_input(name, CPPType::get<T>()); } - void single_input(StringRef name, const CPPType &type) + void single_input(const char *name, const CPPType &type) { this->input(name, MFDataType::ForSingle(type)); } - template<typename T> void vector_input(StringRef name) + template<typename T> void vector_input(const char *name) { this->vector_input(name, CPPType::get<T>()); } - void vector_input(StringRef name, const CPPType &base_type) + void vector_input(const char *name, const CPPType &base_type) { this->input(name, MFDataType::ForVector(base_type)); } - void input(StringRef name, MFDataType data_type) + void input(const char *name, MFDataType data_type) { signature_.param_names.append(name); signature_.param_types.append(MFParamType(MFParamType::Input, data_type)); @@ -103,23 +103,23 @@ class MFSignatureBuilder { /* Output Parameter Types */ - template<typename T> void single_output(StringRef name) + template<typename T> void single_output(const char *name) { this->single_output(name, CPPType::get<T>()); } - void single_output(StringRef name, const CPPType &type) + void single_output(const char *name, const CPPType &type) { this->output(name, MFDataType::ForSingle(type)); } - template<typename T> void vector_output(StringRef name) + template<typename T> void vector_output(const char *name) { this->vector_output(name, CPPType::get<T>()); } - void vector_output(StringRef name, const CPPType &base_type) + void vector_output(const char *name, const CPPType &base_type) { this->output(name, MFDataType::ForVector(base_type)); } - void output(StringRef name, MFDataType data_type) + void output(const char *name, MFDataType data_type) { signature_.param_names.append(name); signature_.param_types.append(MFParamType(MFParamType::Output, data_type)); @@ -136,23 +136,23 @@ class MFSignatureBuilder { /* Mutable Parameter Types */ - template<typename T> void single_mutable(StringRef name) + template<typename T> void single_mutable(const char *name) { this->single_mutable(name, CPPType::get<T>()); } - void single_mutable(StringRef name, const CPPType &type) + void single_mutable(const char *name, const CPPType &type) { this->mutable_(name, MFDataType::ForSingle(type)); } - template<typename T> void vector_mutable(StringRef name) + template<typename T> void vector_mutable(const char *name) { this->vector_mutable(name, CPPType::get<T>()); } - void vector_mutable(StringRef name, const CPPType &base_type) + void vector_mutable(const char *name, const CPPType &base_type) { this->mutable_(name, MFDataType::ForVector(base_type)); } - void mutable_(StringRef name, MFDataType data_type) + void mutable_(const char *name, MFDataType data_type) { signature_.param_names.append(name); signature_.param_types.append(MFParamType(MFParamType::Mutable, data_type)); @@ -167,7 +167,7 @@ class MFSignatureBuilder { } } - void add(StringRef name, const MFParamType ¶m_type) + void add(const char *name, const MFParamType ¶m_type) { switch (param_type.interface_type()) { case MFParamType::Input: diff --git a/source/blender/functions/intern/multi_function_procedure_executor.cc b/source/blender/functions/intern/multi_function_procedure_executor.cc index 1136b03ed58..06c97fd1173 100644 --- a/source/blender/functions/intern/multi_function_procedure_executor.cc +++ b/source/blender/functions/intern/multi_function_procedure_executor.cc @@ -25,7 +25,7 @@ MFProcedureExecutor::MFProcedureExecutor(const MFProcedure &procedure) : procedu MFSignatureBuilder signature("Procedure Executor"); for (const ConstMFParameter ¶m : procedure.params()) { - signature.add(param.variable->name(), MFParamType(param.type, param.variable->data_type())); + signature.add("Parameter", MFParamType(param.type, param.variable->data_type())); } signature_ = signature.build(); |