Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ParameterEditorRegistry.cpp
Go to the documentation of this file.
1/**
2 * @file ParameterEditorRegistry.cpp
3 * @brief Implementation of ParameterEditorRegistry with built-in node descriptors.
4 * @author Olympe Engine
5 * @date 2026-03-14
6 *
7 * C++14 compliant — no std::optional, structured bindings, std::filesystem.
8 */
9
11
12namespace Olympe {
13
14// ---------------------------------------------------------------------------
15// Static data
16// ---------------------------------------------------------------------------
17
18const std::vector<ParameterDescriptor> ParameterEditorRegistry::s_empty;
19
20// ---------------------------------------------------------------------------
21// Singleton
22// ---------------------------------------------------------------------------
23
29
34
35// ---------------------------------------------------------------------------
36// Registration
37// ---------------------------------------------------------------------------
38
40 TaskNodeType nodeType,
41 const std::vector<ParameterDescriptor>& descriptors)
42{
43 m_params[static_cast<uint8_t>(nodeType)] = descriptors;
44}
45
46// ---------------------------------------------------------------------------
47// Queries
48// ---------------------------------------------------------------------------
49
50const std::vector<ParameterDescriptor>& ParameterEditorRegistry::GetNodeParameters(
51 TaskNodeType nodeType) const
52{
53 auto it = m_params.find(static_cast<uint8_t>(nodeType));
54 return (it != m_params.end()) ? it->second : s_empty;
55}
56
58 TaskNodeType nodeType,
59 const std::string& paramName) const
60{
61 const auto& params = GetNodeParameters(nodeType);
62 for (size_t i = 0; i < params.size(); ++i)
63 {
64 if (params[i].name == paramName)
65 return &params[i];
66 }
67 return nullptr;
68}
69
70// ---------------------------------------------------------------------------
71// Built-in parameter specs
72// ---------------------------------------------------------------------------
73
75{
76 // ---- AtomicTask ----
77 {
79 d.name = "taskType";
81 d.description = "Select the atomic task to execute.";
82 d.required = true;
84 }
85
86 // ---- Branch / While ----
87 {
88 std::vector<ParameterDescriptor> params;
89
91 cond.name = "conditionType";
93 cond.description = "Select the condition type to evaluate.";
94 cond.required = true;
95 params.push_back(cond);
96
98 key.name = "Key";
100 key.description = "Blackboard key to use in the condition.";
101 key.required = false;
102 params.push_back(key);
103
105 op.name = "Operator";
107 op.description = "Comparison operator (for CompareValue condition).";
108 op.required = false;
109 params.push_back(op);
110
112 val.name = "Value";
114 val.literalValueType = VariableType::Float;
115 val.description = "Literal value to compare against.";
116 val.required = false;
117 params.push_back(val);
118
121 }
122
123 // ---- Switch ----
124 {
126 d.name = "switchVariable";
128 d.description = "Blackboard key whose value determines which case branch runs.";
129 d.required = true;
131 }
132
133 // ---- GetBBValue ----
134 {
136 d.name = "bbKey";
138 d.description = "Blackboard key to read.";
139 d.required = true;
141 }
142
143 // ---- SetBBValue ----
144 {
146 d.name = "bbKey";
148 d.description = "Blackboard key to write.";
149 d.required = true;
151 }
152
153 // ---- MathOp ----
154 {
156 d.name = "operation";
158 d.description = "Arithmetic operator to apply (+, -, *, /, %).";
159 d.required = true;
161 }
162
163 // ---- ForEach ----
164 {
166 d.name = "bbKey";
168 d.description = "Blackboard key of the list to iterate.";
169 d.required = true;
170 d.filterVarType = VariableType::List;
172 }
173
174 // ---- SubGraph ----
175 {
177 d.name = "subGraphPath";
179 d.description = "Path to the sub-graph .ats file.";
180 d.required = true;
182 }
183
184 // ---- Delay ----
185 {
187 d.name = "duration";
188 d.bindingType = ParameterBindingType::Literal;
189 d.literalValueType = VariableType::Float;
190 d.description = "Delay duration in seconds (must be > 0).";
191 d.required = true;
193 }
194}
195
196} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
Centralized registry mapping node types to their parameter descriptors.
Singleton mapping TaskNodeType -> vector of ParameterDescriptor.
void RegisterNodeType(TaskNodeType nodeType, const std::vector< ParameterDescriptor > &descriptors)
Registers a set of parameter descriptors for a node type.
std::unordered_map< uint8_t, std::vector< ParameterDescriptor > > m_params
static const std::vector< ParameterDescriptor > s_empty
Returned by GetNodeParameters when a type has no descriptors.
static ParameterEditorRegistry & Get()
Returns the singleton instance.
const std::vector< ParameterDescriptor > & GetNodeParameters(TaskNodeType nodeType) const
Returns the parameter descriptors for the given node type.
const ParameterDescriptor * GetParameterDescriptor(TaskNodeType nodeType, const std::string &paramName) const
Returns the descriptor for a specific parameter of a node type.
< Provides AssetID and INVALID_ASSET_ID
@ Float
Single-precision float.
@ List
std::vector<TaskValue> (used by ForEach node)
@ MathOperator
Math operator symbol (+, -, *, /, %) (from OperatorRegistry)
@ ConditionID
ID of a condition type (from ConditionRegistry)
@ AtomicTaskID
ID of an atomic task (from AtomicTaskUIRegistry)
@ SubGraphPath
File path to a sub-graph .ats file.
@ LocalVariable
Value is read from the local blackboard at runtime.
@ Literal
Value is embedded directly in the template.
@ ComparisonOp
Comparison operator (==, !=, <, <=, >, >=) (from OperatorRegistry)
TaskNodeType
Identifies the role of a node in the task graph.
@ AtomicTask
Leaf node that executes a single atomic task.
@ While
Conditional loop (Loop / Completed exec outputs)
@ SubGraph
Sub-graph call (SubTask)
@ Delay
Timer (Completed exec output after N seconds)
@ GetBBValue
Data node – reads a Blackboard key.
@ MathOp
Data node – arithmetic operation (+, -, *, /)
@ SetBBValue
Data node – writes a Blackboard key.
@ ForEach
Iterate over BB list (Loop Body / Completed exec outputs)
@ Switch
Multi-branch on value (N exec outputs)
@ Branch
If/Else conditional (Then / Else exec outputs)
Full description of one parameter on a node type.
bool required
Must be filled before the node can execute.
std::string name
Parameter key (e.g. "taskType", "bbKey")
std::string description
Tooltip text.
ParameterBindingType bindingType
How the parameter value is provided.