14#include "../third_party/imgui/imgui.h"
15#include "../TaskSystem/TaskGraphTypes.h"
65 if (ImGui::CollapsingHeader(
"Profiler Summary"))
86 ImGui::BeginDisabled();
87 if (ImGui::Button(
"▶ Continue (F5)") || (isPaused && ImGui::IsKeyPressed(
ImGuiKey_F5)))
98 ImGui::BeginDisabled();
99 if (ImGui::Button(
"⏸ Pause"))
104 ImGui::EndDisabled();
110 ImGui::BeginDisabled();
111 if (ImGui::Button(
"⏭ Step (F10)") || (isPaused && ImGui::IsKeyPressed(
ImGuiKey_F10)))
116 ImGui::EndDisabled();
122 ImGui::BeginDisabled();
123 if (ImGui::Button(
"⤵ Into (F11)") || (isPaused && ImGui::IsKeyPressed(
ImGuiKey_F11)))
128 ImGui::EndDisabled();
134 ImGui::BeginDisabled();
137 ImGui::GetIO().KeyShift;
138 if (ImGui::Button(
"⤴ Out") ||
shiftF11)
143 ImGui::EndDisabled();
149 ImGui::BeginDisabled();
150 if (ImGui::Button(
"⏹ Stop"))
155 ImGui::EndDisabled();
158 ImGui::SameLine(0, 20);
173 int gid =
dc.GetCurrentGraphID();
174 int nid =
dc.GetCurrentNodeID();
175 if (gid >= 0 &&
nid >= 0)
178 ImGui::TextDisabled(
" graph=%d node=%d", gid,
nid);
189 auto bps =
dc.GetAllBreakpoints();
193 ImGui::TextDisabled(
"(no breakpoints)");
197 if (ImGui::SmallButton(
"Clear All##bpClearAll"))
198 dc.ClearAllBreakpoints();
200 ImGui::BeginChild(
"BPList",
ImVec2(0, 140),
true);
202 for (
size_t i = 0;
i <
bps.size(); ++
i)
205 ImGui::PushID(
static_cast<int>(
i));
207 bool enabled =
bp.enabled;
208 if (ImGui::Checkbox(
"##bpEnabled", &enabled))
209 dc.SetBreakpointEnabled(
bp.graphID,
bp.nodeID, enabled);
212 ImGui::Text(
"%s : Node %d \"%s\"",
213 bp.graphName.empty() ?
"(graph)" :
bp.graphName.c_str(),
215 bp.nodeName.empty() ?
"" :
bp.nodeName.c_str());
218 if (ImGui::SmallButton(
"×##bpDel"))
219 dc.ClearBreakpoint(
bp.graphID,
bp.nodeID);
234 auto stack =
dc.GetCallStack();
238 ImGui::TextDisabled(
"(no active call stack)");
242 ImGui::BeginChild(
"CallStack",
ImVec2(0, 100),
true);
244 for (
int idx =
static_cast<int>(
stack.size()) - 1;
idx >= 0; --
idx)
249 ImGui::TextColored(
ImVec4(0.3f, 1.0f, 0.3f, 1.0f),
250 "-> %s : Node %d \"%s\" [CURRENT]",
257 ImGui::Text(
" %s : Node %d \"%s\"",
274 if (!
dc.IsDebugging())
276 ImGui::TextDisabled(
"(not debugging)");
285 ImGui::TextDisabled(
"(empty blackboard)");
289 ImGui::BeginChild(
"WatchVars",
ImVec2(0, 180),
true);
290 ImGui::TextDisabled(
"Local Blackboard:");
293 for (
size_t i = 0;
i <
keys.size(); ++
i)
298 catch (...) {
continue; }
300 switch (
val.GetType())
303 ImGui::Text(
" %-22s : Bool(%s)",
key.c_str(),
val.AsBool() ?
"true" :
"false");
306 ImGui::Text(
" %-22s : Int(%d)",
key.c_str(),
val.AsInt());
309 ImGui::Text(
" %-22s : Float(%.3f)",
key.c_str(),
val.AsFloat());
312 ImGui::Text(
" %-22s : String(\"%s\")",
key.c_str(),
val.AsString().c_str());
315 ImGui::Text(
" %-22s : EntityID(%llu)",
317 static_cast<unsigned long long>(
val.AsEntityID()));
322 ImGui::Text(
" %-22s : Vec(%.2f,%.2f,%.2f)",
323 key.c_str(),
v.x,
v.y,
v.z);
327 ImGui::Text(
" %-22s : (unknown)",
key.c_str());
343 if (!
prof.IsProfiling())
345 if (ImGui::Button(
"Start Profiling"))
346 prof.BeginProfiling();
350 if (ImGui::Button(
"Stop Profiling"))
351 prof.StopProfiling();
356 ImGui::TextDisabled(
"(no data yet)");
360 ImGui::BeginChild(
"ProfSummary",
ImVec2(0, 120),
true);
361 ImGui::Text(
"%-6s %-24s %8s %8s %8s",
362 "NodeID",
"Name",
"AvgMs",
"MaxMs",
"Count");
370 ImGui::TextColored(
ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
371 "%-6d %-24s %8.3f %8.3f %8llu",
372 m.nodeID,
m.nodeName.c_str(),
373 m.avgTimeMs,
m.maxTimeMs,
m.executionCount);
375 ImGui::Text(
"%-6d %-24s %8.3f %8.3f %8llu",
376 m.nodeID,
m.nodeName.c_str(),
377 m.avgTimeMs,
m.maxTimeMs,
m.executionCount);
Runtime debug controller for ATS Visual Scripting (Phase 5).
ImGui debug panel for ATS VS runtime debugging (Phase 5).
ComponentTypeID GetComponentTypeID_Static()
Singleton that manages runtime debugging of VS graphs.
static DebugController & Get()
Returns the singleton instance (Meyers pattern).
void Render()
Renders the debug panel window.
void RenderWatchVariables()
void RenderProfilerSummary()
void RenderBreakpointsList()
Simple map-based blackboard for task graph runtime state.
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)
DebugState
States of the debug controller state machine.
@ NotDebugging
No active debug session.
@ StepNext
Execute next node then pause.
@ StepOut
Run until the current SubGraph returns.
@ Running
Normal execution.
@ StepInto
Step into a SubGraph on next SubGraph node.
@ Paused
Stopped at a breakpoint or manual pause.
Describes a single breakpoint.
Accumulated per-node execution statistics.
float avgTimeMs
Running average execution time (ms)
A single frame in the debugger's SubGraph call stack.
bool isCurrent
true for the top-most (active) frame