Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
ActionParametersPanel.h
Go to the documentation of this file.
1/**
2 * @file ActionParametersPanel.h
3 * @brief UI Properties panel for atomic task (action) node parameters.
4 * @author Olympe Engine
5 * @date 2026-03-24
6 *
7 * Displays editable parameters for selected action nodes.
8 * Supports various parameter types (String, Float, Int, Bool, etc.).
9 */
10
11#pragma once
12
13#include <string>
14#include <vector>
15#include <memory>
16#include <unordered_map>
17
18namespace Olympe {
19
20/**
21 * @struct ActionParameter
22 * @brief Represents a single parameter of an action task.
23 */
25{
26 std::string name; ///< Parameter name (e.g., "message", "speed")
27 std::string type; ///< Parameter type (String, Float, Int, Bool, etc.)
28 std::string value; ///< Current value
29 std::string defaultValue; ///< Default value
30 bool isDirty = false; ///< True if value has been modified
31};
32
33/**
34 * @class ActionParametersPanel
35 * @brief ImGui sub-panel for editing action node parameters.
36 */
38{
39public:
40 explicit ActionParametersPanel();
42
43 // Non-copyable
46
47 // -----------------------------------------------------------------------
48 // State setters
49 // -----------------------------------------------------------------------
50
51 /**
52 * @brief Set the action task ID (e.g., "log_message", "patrol_path")
53 */
54 void SetActionTaskID(const std::string& taskID);
55
56 /**
57 * @brief Set the node name for display purposes
58 */
59 void SetNodeName(const std::string& name);
60
61 /**
62 * @brief Set the parameters from a map of name->value pairs
63 */
64 void SetParameters(const std::unordered_map<std::string, std::string>& params);
65
66 /**
67 * @brief Get all parameters with their current values
68 */
69 const std::vector<ActionParameter>& GetParameters() const;
70
71 /**
72 * @brief Get a specific parameter value by name
73 */
74 std::string GetParameterValue(const std::string& paramName) const;
75
76 /**
77 * @brief Check if any parameter has been modified
78 */
79 bool IsDirty() const;
80
81 /**
82 * @brief Clear the dirty flag after changes have been applied
83 */
84 void ClearDirty();
85
86 // -----------------------------------------------------------------------
87 // Rendering
88 // -----------------------------------------------------------------------
89
90 void Render();
91
92private:
93 void RenderTitleSection();
96
97 std::string m_taskID;
98 std::string m_nodeName;
99 std::vector<ActionParameter> m_parameters;
100 bool m_dirty = false;
101};
102
103} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
ImGui sub-panel for editing action node parameters.
std::vector< ActionParameter > m_parameters
void SetNodeName(const std::string &name)
Set the node name for display purposes.
ActionParametersPanel & operator=(const ActionParametersPanel &)=delete
ActionParametersPanel(const ActionParametersPanel &)=delete
void RenderParameter(ActionParameter &param)
void SetParameters(const std::unordered_map< std::string, std::string > &params)
Set the parameters from a map of name->value pairs.
std::string GetParameterValue(const std::string &paramName) const
Get a specific parameter value by name.
const std::vector< ActionParameter > & GetParameters() const
Get all parameters with their current values.
void SetActionTaskID(const std::string &taskID)
Set the action task ID (e.g., "log_message", "patrol_path")
bool IsDirty() const
Check if any parameter has been modified.
void ClearDirty()
Clear the dirty flag after changes have been applied.
< Provides AssetID and INVALID_ASSET_ID
Represents a single parameter of an action task.
bool isDirty
True if value has been modified.
std::string name
Parameter name (e.g., "message", "speed")
std::string value
Current value.
std::string defaultValue
Default value.
std::string type
Parameter type (String, Float, Int, Bool, etc.)