10#include <unordered_map>
11#include <unordered_set>
14#include "../system/system_utils.h"
33 : m_SelectedNodeId(-1)
42 const std::string& message,
48 e.severity = severity;
60 if (
graph.Nodes.empty())
70 SYSTEM_LOG <<
"[GraphValidationPanel] Validation complete: "
71 <<
static_cast<int>(
m_Errors.size()) <<
" finding(s)."
83 for (
size_t i = 0;
i <
graph.ExecConnections.size(); ++
i)
87 for (
size_t i = 0;
i <
graph.Nodes.size(); ++
i)
106 "Node '" +
node.NodeName +
"' has no outgoing exec connection (dead end).",
118 for (
size_t i = 0;
i <
graph.Nodes.size(); ++
i)
126 "SubGraph node '" +
node.NodeName +
"' has no SubGraphPath set.",
145 std::unordered_map<int, std::vector<int>>
adj;
147 for (
size_t i = 0;
i <
graph.Nodes.size(); ++
i)
148 adj[
static_cast<int>(
graph.Nodes[
i].NodeID)] = std::vector<int>();
150 for (
size_t i = 0;
i <
graph.ExecConnections.size(); ++
i)
152 int src =
static_cast<int>(
graph.ExecConnections[
i].SourceNodeID);
153 int dst =
static_cast<int>(
graph.ExecConnections[
i].TargetNodeID);
159 std::unordered_map<int, int>
colour;
160 for (
size_t i = 0;
i <
graph.Nodes.size(); ++
i)
165 for (
size_t i = 0;
i <
graph.Nodes.size(); ++
i)
173 std::vector<std::pair<int,int>>
stack;
177 while (!
stack.empty())
179 std::pair<int,int>&
top =
stack.back();
200 "Cycle detected involving node ID " + std::to_string(
next) +
".",
207 stack.push_back(std::make_pair(
next, 0));
ComponentTypeID GetComponentTypeID_Static()
VS graph validation with clickable error list (Phase 7).
Singleton that validates a TaskGraphTemplate and tracks selected node.
void CheckCycles(const TaskGraphTemplate &graph)
Flags cycles detected by DFS over ExecConnections.
const std::vector< GraphValidationError > & GetErrors() const
Returns the current list of validation findings.
int GetSelectedNodeId() const
Returns the node ID set by the most recent OnErrorClick() call (-1 if none).
void Validate(const TaskGraphTemplate &graph)
Clears previous results and validates graph.
bool HasErrors() const
Returns true if there are any findings of any severity.
void CheckMissingConnections(const TaskGraphTemplate &graph)
Flags SubGraph nodes that have no SubGraphPath set.
void AddError(int nodeId, const std::string &message, ValidationSeverity severity)
void CheckDeadEnds(const TaskGraphTemplate &graph)
Flags nodes whose exec-output pins have no outgoing connection.
bool HasCriticalErrors() const
Returns true if any finding has severity Critical.
std::vector< GraphValidationError > m_Errors
static GraphValidationPanel & Get()
Returns the single shared instance.
void Clear()
Clears all findings and resets the selected node.
void OnErrorClick(int nodeId)
Records nodeId as the currently selected node.
Immutable, shareable task graph asset.
< Provides AssetID and INVALID_ASSET_ID
ValidationSeverity
Indicates how serious a validation finding is.
@ Critical
Graph cannot be executed.
@ Error
Likely to cause incorrect behaviour.
@ SubGraph
Sub-graph call (SubTask)
@ GetBBValue
Data node – reads a Blackboard key.
@ MathOp
Data node – arithmetic operation (+, -, *, /)
@ SetBBValue
Data node – writes a Blackboard key.
@ EntryPoint
Unique entry node for VS graphs (replaces Root)
constexpr int32_t NODE_INDEX_NONE
Sentinel value for "no node" in node index / ID fields.
A single validation finding.
int nodeId
Offending node ID; -1 for graph-level errors.
Full description of a single node in the task graph.