Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ParameterEditorRegistry.h
Go to the documentation of this file.
1/**
2 * @file ParameterEditorRegistry.h
3 * @brief Centralized registry mapping node types to their parameter descriptors.
4 * @author Olympe Engine
5 * @date 2026-03-14
6 *
7 * @details
8 * ParameterEditorRegistry provides the properties panel with the full
9 * description of each parameter for every node type — its name, binding type,
10 * whether it is required, etc. The panel uses these descriptors to choose
11 * the right widget (text field, dropdown, file picker, etc.) for each field.
12 *
13 * C++14 compliant — no std::optional, structured bindings, std::filesystem.
14 */
15
16#pragma once
17
18#include <string>
19#include <vector>
20#include <unordered_map>
21
22#include "../TaskSystem/TaskGraphTypes.h"
23
24namespace Olympe {
25
26/**
27 * @struct ParameterDescriptor
28 * @brief Full description of one parameter on a node type.
29 */
31 std::string name; ///< Parameter key (e.g. "taskType", "bbKey")
32 ParameterBindingType bindingType; ///< How the parameter value is provided
33 VariableType literalValueType; ///< Type hint when bindingType == Literal
34 std::string description; ///< Tooltip text
35 bool required; ///< Must be filled before the node can execute
36
37 /// Optional filter — restricts variable/ID dropdowns to a specific category.
38 std::string filterCategory;
39
40 /// Optional filter — restricts BB-variable dropdowns to a specific VariableType.
42
43 /// Whether the parameter can accept multiple values (future use).
44 bool allowMultiple = false;
45};
46
47/**
48 * @class ParameterEditorRegistry
49 * @brief Singleton mapping TaskNodeType -> vector of ParameterDescriptor.
50 */
52public:
53
54 /**
55 * @brief Returns the singleton instance.
56 * Calls InitializeBuiltInParameters() on first access.
57 */
59
60 /**
61 * @brief Registers a set of parameter descriptors for a node type.
62 *
63 * Overwrites any previously registered descriptors for @p nodeType.
64 *
65 * @param nodeType The node type.
66 * @param descriptors Ordered list of parameter descriptors.
67 */
68 void RegisterNodeType(TaskNodeType nodeType,
69 const std::vector<ParameterDescriptor>& descriptors);
70
71 /**
72 * @brief Returns the parameter descriptors for the given node type.
73 *
74 * Returns an empty vector if no descriptors have been registered for
75 * @p nodeType.
76 *
77 * @param nodeType The node type.
78 * @return Reference to the descriptors vector.
79 */
80 const std::vector<ParameterDescriptor>& GetNodeParameters(TaskNodeType nodeType) const;
81
82 /**
83 * @brief Returns the descriptor for a specific parameter of a node type.
84 *
85 * @param nodeType The node type.
86 * @param paramName Parameter name.
87 * @return Pointer to the descriptor, or nullptr if not found.
88 */
90 const std::string& paramName) const;
91
92private:
93
95
97
98 std::unordered_map<uint8_t, std::vector<ParameterDescriptor>> m_params;
99
100 /// Returned by GetNodeParameters when a type has no descriptors.
101 static const std::vector<ParameterDescriptor> s_empty;
102};
103
104} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
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
VariableType
Type tags used by TaskValue to identify stored data.
@ None
Uninitialized / empty value.
ParameterBindingType
Describes how a parameter value is provided to a task node.
TaskNodeType
Identifies the role of a node in the task graph.
Full description of one parameter on a node type.
bool required
Must be filled before the node can execute.
VariableType literalValueType
Type hint when bindingType == Literal.
std::string name
Parameter key (e.g. "taskType", "bbKey")
bool allowMultiple
Whether the parameter can accept multiple values (future use).
std::string filterCategory
Optional filter — restricts variable/ID dropdowns to a specific category.
std::string description
Tooltip text.
VariableType filterVarType
Optional filter — restricts BB-variable dropdowns to a specific VariableType.
ParameterBindingType bindingType
How the parameter value is provided.