Flow
ControlFlow is a universal node-based editor derived from ControlBase, designed for a variety of applications, including material and logic editing. This plugin serves as a framework for visual programming, where nodes are interconnected to define workflows or logic.
-
ControlFlowCPP extends ControlFlow for C++ code generation by providing support for C++ syntax and statements, along with full integration of Tellusim Base Types and Math libraries. The ControlFlowCPP plugin is used in the System Flow editor.
-
ControlFlowGLSL extends ControlFlow for GLSL code generation by supporting GLSL syntax and statements, including the complete standard GLSL library. The ControlFlowGLSL plugin is used in the Material Flow editor.
#include <interface/flow/include/TellusimControlFlow.h>
#include <interface/flow/include/TellusimControlFlowCPP.h>
#include <interface/flow/include/TellusimControlFlowGLSL.h>
Example
This example demonstrates how to create a simple circuit logic editor:
// create Flow
ControlFlow flow(&panel, "logic", 1);
flow.create();
// create types
uint32_t gnd_type = flow.addType("gnd", Color::black, ControlFlow::ShapeSquare);
flow.setTypeConnectionWidth(gnd_type, 4.0f);
flow.setTypeText(gnd_type, "GND");
flow.setTypeInfo(gnd_type, "Ground");
uint32_t vcc_type = flow.addType("vcc", Color::red, ControlFlow::ShapePlus);
flow.setTypeConnectionWidth(vcc_type, 3.0f);
flow.setTypeText(vcc_type, "VCC");
flow.setTypeInfo(vcc_type, "Voltage Input/Output");
// create protos
uint32_t battery_proto = flow.addProto("bat", {}, { vcc_type, gnd_type });
flow.setProtoText(battery_proto, "Battery");
flow.setProtoInfo(battery_proto, "Power Supply");
flow.setProtoMultiOutput(battery_proto, 0, true);
flow.setProtoMultiOutput(battery_proto, 1, true);
flow.setProtoOutputValue(battery_proto, "vcc", "+");
flow.setProtoOutputValue(battery_proto, "gnd", "-");