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>2021-08-29 13:46:39 +0300
committerJacques Lucke <jacques@blender.org>2021-08-29 13:46:39 +0300
commitc398cad0596b1d8bee62a1ade2cb7c1499833023 (patch)
tree976b9115211325dbb2c461a5a17251bcdb5a11fe
parent35bf6b9790fd3ca1a62216860765d9faa2f71fa1 (diff)
show procedure parameters in dot graph
-rw-r--r--source/blender/functions/intern/multi_function_procedure.cc40
1 files changed, 38 insertions, 2 deletions
diff --git a/source/blender/functions/intern/multi_function_procedure.cc b/source/blender/functions/intern/multi_function_procedure.cc
index 1782d50371f..7d96491f5e0 100644
--- a/source/blender/functions/intern/multi_function_procedure.cc
+++ b/source/blender/functions/intern/multi_function_procedure.cc
@@ -615,8 +615,7 @@ class MFProcedureDotExport {
}
}
- dot::Node &entry_node = digraph_.new_node("Entry");
- entry_node.set_shape(dot::Attr_shape::Circle);
+ dot::Node &entry_node = this->create_entry_node();
create_edge(entry_node, procedure_.entry());
}
@@ -754,6 +753,20 @@ class MFProcedureDotExport {
void instruction_to_string(const MFReturnInstruction &UNUSED(instruction), std::stringstream &ss)
{
instruction_name_format("Return ", ss);
+
+ Vector<ConstMFParameter> outgoing_parameters;
+ for (const ConstMFParameter &param : procedure_.params()) {
+ if (ELEM(param.type, MFParamType::Mutable, MFParamType::Output)) {
+ outgoing_parameters.append(param);
+ }
+ }
+ for (const int param_index : outgoing_parameters.index_range()) {
+ const ConstMFParameter &param = outgoing_parameters[param_index];
+ variable_to_string(param.variable, ss);
+ if (param_index < outgoing_parameters.size() - 1) {
+ ss << ", ";
+ }
+ }
}
void instruction_to_string(const MFBranchInstruction &instruction, std::stringstream &ss)
@@ -761,6 +774,29 @@ class MFProcedureDotExport {
instruction_name_format("Branch ", ss);
variable_to_string(instruction.condition(), ss);
}
+
+ dot::Node &create_entry_node()
+ {
+ std::stringstream ss;
+ ss << "Entry: ";
+ Vector<ConstMFParameter> incoming_parameters;
+ for (const ConstMFParameter &param : procedure_.params()) {
+ if (ELEM(param.type, MFParamType::Input, MFParamType::Mutable)) {
+ incoming_parameters.append(param);
+ }
+ }
+ for (const int param_index : incoming_parameters.index_range()) {
+ const ConstMFParameter &param = incoming_parameters[param_index];
+ variable_to_string(param.variable, ss);
+ if (param_index < incoming_parameters.size() - 1) {
+ ss << ", ";
+ }
+ }
+
+ dot::Node &node = digraph_.new_node(ss.str());
+ node.set_shape(dot::Attr_shape::Ellipse);
+ return node;
+ }
};
std::string MFProcedure::to_dot() const