9#include "../third_party/imgui/imgui.h"
10#include "../system/system_utils.h"
17 : m_visible(
true), m_lastTestRun(
false), m_selectedEventIndex(-1),
18 m_showTraceLog(
true), m_showErrors(
true), m_autoScroll(
true)
34 SYSTEM_LOG <<
"[ExecutionTestPanel] Initialized\n";
39 SYSTEM_LOG <<
"[ExecutionTestPanel] Shutdown\n";
63 if (ImGui::BeginTabItem(
"Trace Log"))
69 if (ImGui::BeginTabItem(
"Errors"))
75 if (ImGui::BeginTabItem(
"Summary"))
126 ImGui::Text(
"Execution Test Controls");
128 if (ImGui::Button(
"Test Execution",
ImVec2(120, 0)))
131 SYSTEM_LOG <<
"[ExecutionTestPanel] Test execution button clicked\n";
135 ImGui::Text(
m_lastTestRun ?
"✓ Last test run" :
"● No test run yet");
138 ImGui::Text(
"Test Options");
166 ImGui::TableHeadersRow();
189 ImGui::TableNextRow();
192 ImGui::TableSetColumnIndex(0);
193 ImGui::Text(
"%d",
event.stepNumber);
196 ImGui::TableSetColumnIndex(1);
197 const char*
typeStr =
"Unknown";
241 ImGui::TableSetColumnIndex(2);
242 if (
event.nodeId >= 0)
243 ImGui::Text(
"%d",
event.nodeId);
248 ImGui::TableSetColumnIndex(3);
249 ImGui::Text(
"%s",
event.nodeName.c_str());
252 ImGui::TableSetColumnIndex(4);
253 ImGui::Text(
"%s",
event.message.c_str());
256 ImGui::TableSetColumnIndex(5);
259 if (
event.conditionResult)
261 ImGui::TextColored(
ImVec4(0.4f, 1.0f, 0.4f, 1.0f),
"TRUE");
265 ImGui::TextColored(
ImVec4(1.0f, 0.4f, 0.4f, 1.0f),
"FALSE");
278 ImGui::TextColored(
ImVec4(0.4f, 1.0f, 0.4f, 1.0f),
"✓ No errors found!");
290 ImGui::TableHeadersRow();
296 ImGui::TableNextRow();
299 ImGui::TableSetColumnIndex(0);
305 ImGui::TableSetColumnIndex(1);
306 if (
error.nodeId >= 0)
307 ImGui::Text(
"%d",
error.nodeId);
309 ImGui::Text(
"Graph");
312 ImGui::TableSetColumnIndex(2);
313 ImGui::Text(
"%s",
error.nodeName.c_str());
316 ImGui::TableSetColumnIndex(3);
317 ImGui::Text(
"%s",
error.category.c_str());
320 ImGui::TableSetColumnIndex(4);
321 ImGui::Text(
"%s",
error.message.c_str());
ComponentTypeID GetComponentTypeID_Static()
Panel for executing and testing blueprint graphs with simulation.
static ImVec4 SeverityToColor(ErrorSeverity severity)
static const char * SeverityToString(ErrorSeverity severity)
void DisplayTrace(const GraphExecutionTracer &tracer)
Display a pre-computed trace (for BehaviorTree or native executors).
GraphExecutionSimulator m_simulator
void RenderExecutionEventRow(const ExecutionEvent &event, size_t rowIndex)
std::string GetExecutionLog() const
Returns the execution log as a formatted string.
SimulationOptions m_testOptions
std::string GetTestSummary() const
Returns a summary of the last test run.
GraphExecutionTracer m_lastTracer
void RenderTestControls()
void Render()
Renders the test execution panel window.
std::vector< ValidationError > RunExecutionTest(const TaskGraphTemplate &tmpl)
Runs execution test on the specified template.
std::vector< ValidationError > m_lastTestErrors
std::vector< ValidationError > SimulateExecution(const TaskGraphTemplate &tmpl, const SimulationOptions &options, GraphExecutionTracer &outTracer)
Simulates execution of a graph template.
Records execution trace during graph simulation.
const std::vector< ExecutionEvent > & GetEvents() const
Returns all recorded events.
std::string GetTraceLog() const
Returns a formatted trace log as a multi-line string.
void Reset()
Clears all recorded events and resets state.
std::string GetExecutionSummary() const
Returns a summary of the execution (steps, errors, etc.).
Immutable, shareable task graph asset.
< Provides AssetID and INVALID_ASSET_ID
@ ExecutionBlocked
Execution was blocked (dead-end path, etc.)
@ BranchTaken
A branch condition was true.
@ NodeEntered
Execution entered a node.
@ DataPinResolved
A data pin was resolved.
@ ConditionEvaluated
A condition was evaluated.
@ ErrorOccurred
An error happened during execution.
@ ExecutionCompleted
Graph execution completed.
@ NodeExited
Execution exited a node.
A single event recorded during graph execution trace.
bool validateConditions
Check condition syntax.
int32_t maxStepsPerFrame
Maximum steps to prevent infinite loops.
bool validateDataFlow
Check data connections.
bool validateBranchPaths
Verify all branches lead somewhere.
int32_t maxSubGraphDepth
Maximum nesting depth for subgraphs.