6#include "BlueprintEditor.h"
10#include "../Editor/Panels/ActionParametersPanel.h"
11#include "../TaskSystem/LocalBlackboard.h"
12#include "../TaskSystem/TaskGraphTypes.h"
13#include "../third_party/imgui/imgui.h"
31 , m_hasSelectedAction(
false)
43 std::cout <<
"[InspectorPanel] Initialized\n";
50 std::cout <<
"[InspectorPanel] Shutdown\n";
55 ImGui::Begin(
"Inspector");
61 const std::string& nodeName,
62 const std::unordered_map<std::string, std::string>& parameters)
110 ImGui::Text(
"No selection");
111 ImGui::TextWrapped(
"Select an entity or asset file to inspect its properties.");
141 ImGui::Text(
"Node Properties");
147 ImGui::Text(
"Node inspector coming soon...");
157 ImGui::Text(
"No entity selected");
158 ImGui::TextWrapped(
"Select an entity from the Asset Browser or Entities panel to inspect its properties.");
164 ImGui::Text(
"Entity: %s",
info.name.c_str());
169 ImGui::Text(
"Components:");
173 if (components.empty())
175 ImGui::Text(
" (no components)");
179 for (
const auto& componentType : components)
181 if (ImGui::CollapsingHeader(componentType.c_str()))
193 if (properties.empty())
195 ImGui::Text(
" (no editable properties)");
199 for (
auto&
prop : properties)
201 ImGui::PushID(
prop.name.c_str());
203 if (
prop.type ==
"float")
205 float value = std::stof(
prop.value);
206 if (ImGui::DragFloat(
prop.name.c_str(), &value, 1.0f))
210 entityId, componentType,
prop.name, std::to_string(value)
214 else if (
prop.type ==
"int")
216 int value = std::stoi(
prop.value);
217 if (ImGui::DragInt(
prop.name.c_str(), &value))
220 entityId, componentType,
prop.name, std::to_string(value)
224 else if (
prop.type ==
"bool")
226 bool value = (
prop.value ==
"true" ||
prop.value ==
"1");
227 if (ImGui::Checkbox(
prop.name.c_str(), &value))
230 entityId, componentType,
prop.name, value ?
"true" :
"false"
234 else if (
prop.type ==
"string")
250 ImGui::Text(
"%s: %s",
prop.name.c_str(),
prop.value.c_str());
264 ImGui::Text(
"No asset selected");
277 ImGui::TextColored(
ImVec4(0.5f, 0.8f, 1.0f, 1.0f),
"Asset: %s",
filename.c_str());
282 ImGui::TextColored(
ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
"Invalid or malformed asset");
285 ImGui::TextWrapped(
"Error: %s", metadata.
errorMessage.c_str());
291 ImGui::Text(
"Type: %s", metadata.
type.c_str());
294 if (!metadata.
name.empty())
296 ImGui::Text(
"Name: %s", metadata.
name.c_str());
302 ImGui::TextWrapped(
"Description: %s", metadata.
description.c_str());
308 if (metadata.
type ==
"BehaviorTree" || metadata.
type ==
"HFSM")
310 ImGui::Text(
"Nodes: %d", metadata.
nodeCount);
312 if (!metadata.
nodes.empty() && ImGui::CollapsingHeader(
"Node List"))
317 ImGui::BulletText(
"%s",
node.c_str());
323 if (ImGui::Button(
"Open in Node Graph Editor"))
328 else if (metadata.
type ==
"EntityBlueprint")
332 if (!metadata.
components.empty() && ImGui::CollapsingHeader(
"Component List"))
337 ImGui::BulletText(
"%s",
comp.c_str());
358 ImGui::TextColored(
ImVec4(0.4f, 0.9f, 0.4f, 1.0f),
"Runtime Blackboard");
364 ImGui::TextDisabled(
"(no variables)");
371 switch (
val.GetType())
374 ImGui::Text(
" %s: %s",
varName.c_str(),
val.AsBool() ?
"true" :
"false");
377 ImGui::Text(
" %s: %d",
varName.c_str(),
val.AsInt());
380 ImGui::Text(
" %s: %.4f",
varName.c_str(),
val.AsFloat());
383 ImGui::Text(
" %s: \"%s\"",
varName.c_str(),
val.AsString().c_str());
386 ImGui::Text(
" %s: entity(%llu)",
varName.c_str(),
387 static_cast<unsigned long long>(
val.AsEntityID()));
392 ImGui::Text(
" %s: (%.2f, %.2f, %.2f)",
varName.c_str(),
v.x,
v.y,
v.z);
396 ImGui::Text(
" %s: (none)",
varName.c_str());
407 ImGui::TextColored(
ImVec4(0.5f, 0.8f, 1.0f, 1.0f),
"Action Node Properties");
413 if (ImGui::Button(
"Clear Selection"))
ComponentTypeID GetComponentTypeID_Static()
std::string GetSelectedAssetPath() const
AssetMetadata GetAssetMetadata(const std::string &filepath)
uint64_t GetSelectedEntity() const
void OpenGraphInEditor(const std::string &assetPath)
static BlueprintEditor & Get()
std::vector< std::string > GetEntityComponents(EntityID entity) const
static EntityInspectorManager & Get()
EntityInfo GetEntityInfo(EntityID entity) const
std::vector< ComponentPropertyInfo > GetComponentProperties(EntityID entity, const std::string &componentType)
bool SetComponentProperty(EntityID entity, const std::string &componentType, const std::string &propertyName, const std::string &value)
void RenderEntityInspector()
static void SetInstance(InspectorPanel *instance)
Set the active InspectorPanel instance.
void RenderComponentProperties(uint64_t entityId, const std::string &componentType)
void RenderDebugBlackboard()
void ClearSelectedActionNode()
Clear the current action node selection.
static const LocalBlackboard * s_DebugBlackboard
void SetSelectedActionNode(const std::string &taskID, const std::string &nodeName, const std::unordered_map< std::string, std::string > ¶meters)
Set the currently selected action node for parameter editing.
static void SetDebugBlackboard(const LocalBlackboard *bb)
Register a live LocalBlackboard to display in the inspector.
static InspectorPanel * s_Instance
std::unique_ptr< ActionParametersPanel > m_actionPanel
InspectorContext DetermineContext()
void RenderActionNodeInspector()
void RenderNodeInspector()
void RenderAssetFileInspector()
Simple map-based blackboard for task graph runtime state.
TaskValue GetValue(const std::string &varName) const
Returns the current value of a variable.
std::vector< std::string > GetVariableNames() const
Returns all registered variable names (useful for debugging / editor).
C++14-compliant type-safe value container for task parameters.
< Provides AssetID and INVALID_ASSET_ID
@ Int
32-bit signed integer
@ Float
Single-precision float.
@ Vector
3-component vector (Vector from vector.h)
@ EntityID
Entity identifier (uint64_t)