7#include "../../third_party/imgui/imgui.h"
39 param.isDirty =
false;
42 if (
kv.second ==
"true" ||
kv.second ==
"false")
46 else if (std::all_of(
kv.second.begin(),
kv.second.end(),
47 [](
unsigned char c) { return std::isdigit(c) || c ==
'.'; }))
49 param.type = (
kv.second.find(
'.') != std::string::npos) ?
"Float" :
"Int";
53 param.type =
"String";
95 param.isDirty =
false;
101#ifndef OLYMPE_HEADLESS
104 ImGui::TextDisabled(
"(no action selected)");
117 ImGui::TextDisabled(
"(no parameters for this action)");
124#ifndef OLYMPE_HEADLESS
126 ImGui::Text(
"Action: %s",
m_nodeName.c_str());
127 ImGui::PopStyleColor();
128 ImGui::TextDisabled(
"Task ID: %s",
m_taskID.c_str());
134#ifndef OLYMPE_HEADLESS
136 ImGui::Text(
"Parameters:");
141 ImGui::PushID(
static_cast<int>(
i));
150#ifndef OLYMPE_HEADLESS
154 std::string label =
param.name +
" (" +
param.type +
")";
156 if (
param.type ==
"Bool")
158 bool value = (
param.value ==
"true" ||
param.value ==
"1");
159 if (ImGui::Checkbox(label.c_str(), &value))
161 param.value = value ?
"true" :
"false";
162 param.isDirty =
true;
166 else if (
param.type ==
"Int")
170 value = std::stoi(
param.value);
174 ImGui::SetNextItemWidth(200.0f);
175 if (ImGui::DragInt(label.c_str(), &value))
177 param.value = std::to_string(value);
178 param.isDirty =
true;
182 else if (
param.type ==
"Float")
186 value = std::stof(
param.value);
190 ImGui::SetNextItemWidth(200.0f);
191 if (ImGui::DragFloat(label.c_str(), &value, 0.1f))
193 param.value = std::to_string(value);
194 param.isDirty =
true;
198 else if (
param.type ==
"String")
201 static char buffer[512] = {0};
205 ImGui::SetNextItemWidth(250.0f);
206 if (ImGui::InputText(label.c_str(),
buffer,
sizeof(
buffer)))
209 param.isDirty =
true;
216 ImGui::TextDisabled(
"%s: %s", label.c_str(),
param.value.c_str());
UI Properties panel for atomic task (action) node parameters.
ComponentTypeID GetComponentTypeID_Static()
std::vector< ActionParameter > m_parameters
void SetNodeName(const std::string &name)
Set the node name for display purposes.
void RenderTitleSection()
void RenderParameter(ActionParameter ¶m)
void SetParameters(const std::unordered_map< std::string, std::string > ¶ms)
Set the parameters from a map of name->value pairs.
std::string GetParameterValue(const std::string ¶mName) 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.
void RenderParametersSection()
< Provides AssetID and INVALID_ASSET_ID
Represents a single parameter of an action task.
std::string name
Parameter name (e.g., "message", "speed")