10#include "../third_party/imgui/imgui.h"
11#include "../DataManager.h"
12#include "../AI/BehaviorTree.h"
13#include "../system/system_utils.h"
14#include "../Editor/Modals/FilePickerModal.h"
21 , m_selectedNodeId(-1)
37 if (graphId >= 0 && nodeId >= 0)
63 ImGui::TextDisabled(
"No node selected");
70 ImGui::TextColored(
ImVec4(1, 0, 0, 1),
"Error: Graph not found");
78 ImGui::TextColored(
ImVec4(1, 0, 0, 1),
"Error: Node not found");
83 ImGui::Text(
"Node ID: %d",
node->id);
109 if (ImGui::IsItemDeactivatedAfterEdit())
124 ImGui::Text(
"Position: (%.1f, %.1f)",
node->posX,
node->posY);
129 ImGui::PushID(
node->id);
132 if (
node->parameters.empty())
134 ImGui::TextDisabled(
"No parameters");
139 ImGui::TextUnformatted(
"Parameters:");
140 for (
const auto&
param :
node->parameters)
142 ImGui::BulletText(
"%s: %s",
param.first.c_str(),
param.second.c_str());
154 SYSTEM_LOG <<
"[BTNodePropertyPanel] Applied changes to node: " <<
node->id <<
"\n";
162 ImGui::TextUnformatted(
"SubGraph Configuration:");
166 auto pathIt =
node->parameters.find(
"subgraphPath");
167 std::string currentPath = (
pathIt !=
node->parameters.end()) ?
pathIt->second :
"";
169 if (!currentPath.empty())
171 ImGui::TextWrapped(
"Path: %s", currentPath.c_str());
173 ImGui::TextColored(
ImVec4(0, 1, 0, 1),
"✓");
177 ImGui::TextDisabled(
"(No SubGraph path specified)");
181 if (ImGui::Button(
"Browse...##subgraphPath",
ImVec2(-1, 0)))
212 ImGui::TextWrapped(
"❌ Validation Errors:");
213 ImGui::PopStyleColor();
219 ImGui::BulletText(
"%s",
error.c_str());
221 ImGui::PopStyleColor();
228 else if (!currentPath.empty())
232 ImGui::TextWrapped(
"✓ No validation errors");
233 ImGui::PopStyleColor();
248 catch (
const std::exception&)
256 ImGui::TextUnformatted(
"Input Parameters:");
263 if (
it !=
node->parameters.end())
265 ImGui::BulletText(
"%s",
it->second.c_str());
272 ImGui::TextDisabled(
"(No input parameters)");
286 catch (
const std::exception&)
294 ImGui::TextUnformatted(
"Output Parameters:");
301 if (
it !=
node->parameters.end())
303 ImGui::BulletText(
"%s",
it->second.c_str());
310 ImGui::TextDisabled(
"(No output parameters)");
325 ImGui::TextUnformatted(
"Parameter Bindings:");
329 ImGui::TextUnformatted(
"Input Bindings (Parent → Child):");
341 catch (
const std::exception&)
355 ImGui::TableHeadersRow();
359 ImGui::TableNextRow();
367 ImGui::TableSetColumnIndex(0);
368 ImGui::TextDisabled(
"%s",
childParam.c_str());
376 ImGui::TableSetColumnIndex(1);
379 ImGui::SetNextItemWidth(-1.0f);
386 ImGui::TableSetColumnIndex(2);
387 if (ImGui::Button((
"Del##input_" + std::to_string(
i)).
c_str(),
ImVec2(-1, 0)))
422 ImGui::TextDisabled(
"(No input bindings)");
426 if (ImGui::Button(
"+ Add Input Binding##input",
ImVec2(-1, 0)))
441 ImGui::TextUnformatted(
"Output Bindings (Child → Parent):");
453 catch (
const std::exception&)
467 ImGui::TableHeadersRow();
471 ImGui::TableNextRow();
479 ImGui::TableSetColumnIndex(0);
482 ImGui::SetNextItemWidth(-1.0f);
494 ImGui::TableSetColumnIndex(1);
495 ImGui::TextDisabled(
"%s",
childParam.c_str());
498 ImGui::TableSetColumnIndex(2);
499 if (ImGui::Button((
"Del##output_" + std::to_string(
i)).
c_str(),
ImVec2(-1, 0)))
534 ImGui::TextDisabled(
"(No output bindings)");
538 if (ImGui::Button(
"+ Add Output Binding##output",
ImVec2(-1, 0)))
Property editor panel for BehaviorTree nodes.
ComponentTypeID GetComponentTypeID_Static()
static BehaviorTreeManager & Get()
std::vector< std::string > GetValidationErrors(uint32_t graphId)
static DataManager & Get()
std::string GetSelectedFileFromModal() const
Retrieves the selected file from the file picker modal.
bool IsFilePickerModalOpen() const
Checks if the file picker modal is currently visible.
std::string OpenFilePickerModal(Olympe::FilePickerType fileType, const std::string ¤tPath="")
Opens a centralized file picker modal for the specified file type.
void Render()
Render the property panel.
void RenderNodeBasicInfo(const GraphNode *node)
void ClearSelection()
Clear the current selection.
void ApplyNodeChanges(GraphNode *node)
void SetSelectedNode(int graphId, int nodeId)
Set the currently selected node ID.
void RenderSubGraphBindingEditor(GraphNode *node)
Phase 39c Step 4: Parameter binding editor.
char m_nodeNameBuffer[256]
Buffer for node name editing.
void RenderNodeParameters(const GraphNode *node)
void Initialize()
Initialize the panel.
char m_paramBuffer[512]
Buffer for parameter editing.
void RenderSubGraphControls(GraphNode *node)
Phase 39c: SubGraph node editor.
int m_activeGraphId
Current graph ID in BTNodeGraphManager.
NodeGraph * GetGraph(int graphId)
static NodeGraphManager & Get()
< Provides AssetID and INVALID_ASSET_ID
@ BT_SubGraph
Phase 8: references a subgraph by UUID (BehaviorTree)
@ BehaviorTree
.bt.json files in ./Gamedata
const char * NodeTypeToString(NodeType type)