![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Static utility that loads TaskGraphTemplate from schema v4 JSON. More...
#include <TaskGraphLoader.h>
Static Public Member Functions | |
| static TaskGraphTemplate * | LoadFromFile (const std::string &path, std::vector< std::string > &outErrors) |
| Loads a TaskGraphTemplate from a JSON file on disk. | |
| static TaskGraphTemplate * | LoadFromJson (const json &data, std::vector< std::string > &outErrors) |
| Loads a TaskGraphTemplate from an already-parsed JSON object. | |
| static bool | ValidateJson (const json &data, std::vector< std::string > &outErrors) |
| Validates a JSON object against the expected task graph schema. | |
| static bool | FileExists (const std::string &path) |
| Returns true if the given file path exists and can be opened. | |
| static std::vector< std::string > | ScanTaskGraphDirectory (const std::string &dir) |
| Recursively scans a directory for .ats task graph files. | |
Private Member Functions | |
| TaskGraphLoader () | |
Static utility that loads TaskGraphTemplate from schema v4 JSON.
All methods are static; do not instantiate this class. The caller owns the returned TaskGraphTemplate* and is responsible for deletion.
Definition at line 65 of file TaskGraphLoader.h.
|
inlineprivate |
Definition at line 209 of file TaskGraphLoader.h.
Returns true if the given file path exists and can be opened.
C++14 compatible implementation using std::ifstream.
| path | File path to check. |
Definition at line 1324 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:
|
staticprivate |
Definition at line 1222 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static().
Referenced by ParseBlackboardV4(), and ParseParameters().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Loads a TaskGraphTemplate from a JSON file on disk.
| path | Path to the JSON file (absolute or relative to working dir). |
| outErrors | Receives human-readable error messages if loading fails. |
Definition at line 44 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), LoadFromJson(), JsonHelper::LoadJsonFromFile(), and SYSTEM_LOG.
Referenced by Olympe::AssetManager::LoadTaskGraph(), Olympe::VisualScriptEditorPanel::RunGraphSimulation(), and Olympe::VisualScriptEditorPanel::RunGraphSimulationRecursive().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Loads a TaskGraphTemplate from an already-parsed JSON object.
Dispatch logic:
| data | Root JSON object. |
| outErrors | Receives human-readable error messages if loading fails. |
Definition at line 83 of file TaskGraphLoader.cpp.
References Olympe::BTtoVSMigrator::Convert(), GetComponentTypeID_Static(), JsonHelper::GetInt(), Olympe::BTtoVSMigrator::IsBTv2(), Olympe::TaskGraphMigrator_v3_to_v4::MigrateJson(), ParseSchemaV4(), and SYSTEM_LOG.
Referenced by Olympe::VisualScriptRenderer::Load(), and LoadFromFile().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses the blackboard array (v4) and fills tmpl->Blackboard.
Supports both "value" (new) and "default" (legacy) for the initial value. Supports both "key" (new) and "Key" (legacy PascalCase) field names.
Definition at line 933 of file TaskGraphLoader.cpp.
References Olympe::Float, JsonHelper::GetBool(), GetChildValue(), GetComponentTypeID_Static(), Olympe::GetDefaultValueForType(), JsonHelper::GetString(), Olympe::Int, JsonHelper::IsArray(), JsonHelper::IsObject(), Olympe::BlackboardEntry::Key, Olympe::None, ParsePrimitiveValue(), and StringToVariableType().
Referenced by ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses dataConnections (v4) and fills tmpl->DataConnections.
Accepts "dataConnections" (new camelCase), "DataConnections" (PascalCase), and "data.data_connections" (legacy nested).
Definition at line 1083 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), JsonHelper::GetInt(), JsonHelper::GetString(), JsonHelper::IsArray(), JsonHelper::IsObject(), Olympe::NODE_INDEX_NONE, and Olympe::DataPinConnection::SourceNodeID.
Referenced by ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses execConnections (v4) and fills tmpl->ExecConnections.
Accepts "execConnections" (new camelCase), "ExecConnections" (PascalCase), and "data.exec_connections" (legacy nested).
Definition at line 1028 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), JsonHelper::GetInt(), JsonHelper::GetString(), JsonHelper::IsArray(), JsonHelper::IsObject(), Olympe::NODE_INDEX_NONE, and Olympe::ExecPinConnection::SourceNodeID.
Referenced by ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses a single node JSON (v4 flat format) into a TaskNodeDefinition.
Accepts both the new field names ("id", "type", "params", "label") and the legacy field names ("nodeID", "nodeType", "parameters", "nodeName").
Definition at line 367 of file TaskGraphLoader.cpp.
References Olympe::AtomicTask, Olympe::AtomicTaskID, Olympe::ComparisonOp, Olympe::ConditionID, Olympe::ConditionRef::conditionIndex, Olympe::OperandRef::Const, Olympe::Decorator, JsonHelper::ForEachInArray(), Olympe::MathOpRef::FromJson(), Olympe::NodeConditionRef::FromJson(), GetComponentTypeID_Static(), JsonHelper::GetFloat(), JsonHelper::GetInt(), JsonHelper::GetString(), JsonHelper::IsArray(), Olympe::BTtoVSMigrator::IsDecoratorName(), JsonHelper::IsObject(), Olympe::Condition::leftMode, Olympe::Literal, Olympe::LocalVariable, Olympe::MathOp, Olympe::MathOperator, Olympe::NODE_INDEX_NONE, Olympe::TaskNodeDefinition::NodeID, ParseParameters(), ParsePrimitiveValue(), Olympe::OperandRef::Pin, StringToNodeType(), StringToVariableType(), Olympe::SubGraph, Olympe::SubGraphPath, Olympe::Switch, SYSTEM_LOG, Olympe::ParameterBinding::Type, Olympe::SwitchCaseDefinition::value, Olympe::OperandRef::Variable, and Olympe::VSSequence.
Referenced by ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1134 of file TaskGraphLoader.cpp.
References Olympe::AtomicTaskID, Olympe::ComparisonOp, Olympe::ConditionID, GetChildValue(), GetComponentTypeID_Static(), JsonHelper::GetString(), Olympe::Literal, Olympe::LocalVariable, Olympe::MathOperator, ParsePrimitiveValue(), and Olympe::SubGraphPath.
Referenced by ParseNodeV4().
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 1211 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static().
Referenced by ParseBlackboardV4(), ParseNodeV4(), and ParseParameters().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Parses a schema v4 flat JSON into a TaskGraphTemplate.
Supports both the canonical flat format ("nodes", "execConnections", "dataConnections" at root) and the legacy nested format ("data.nodes", "data.exec_connections") for backward compatibility with existing JSON assets.
Definition at line 217 of file TaskGraphLoader.cpp.
References Olympe::EntryPoint, JsonHelper::ForEachInArray(), Olympe::ConditionPreset::FromJson(), JsonHelper::GetBool(), GetComponentTypeID_Static(), JsonHelper::GetInt(), JsonHelper::GetString(), JsonHelper::IsArray(), JsonHelper::IsObject(), Olympe::SubGraphParameterDef::Name, Olympe::NODE_INDEX_NONE, ParseBlackboardV4(), ParseDataConnectionsV4(), ParseExecConnectionsV4(), ParseNodeV4(), ResolveRootNodeId(), StringToVariableType(), and SYSTEM_LOG.
Referenced by LoadFromJson().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1236 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), and JsonHelper::GetInt().
Referenced by ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Recursively scans a directory for .ats task graph files.
C++14 compatible — uses POSIX dirent.h on non-Windows, and Win32 API on Windows. Logs a warning if the directory does not exist.
| dir | Directory to scan (absolute or relative to working dir). |
Definition at line 1334 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), ScanTaskGraphDirectory(), and SYSTEM_LOG.
Referenced by ScanTaskGraphDirectory().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1302 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), Olympe::Input, and Olympe::Output.
Here is the call graph for this function:
|
staticprivate |
Definition at line 1310 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), Olympe::In, Olympe::Out, Olympe::OutCase, Olympe::OutCompleted, Olympe::OutElse, and Olympe::OutLoop.
Here is the call graph for this function:
|
staticprivate |
Definition at line 1247 of file TaskGraphLoader.cpp.
References Olympe::AtomicTask, Olympe::Branch, Olympe::Decorator, Olympe::Delay, Olympe::DoOnce, Olympe::EntryPoint, Olympe::ForEach, Olympe::GetBBValue, GetComponentTypeID_Static(), Olympe::MathOp, Olympe::Parallel, Olympe::Root, Olympe::Selector, Olympe::Sequence, Olympe::SetBBValue, Olympe::SubGraph, Olympe::Switch, Olympe::VSSequence, and Olympe::While.
Referenced by ParseNodeV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 1287 of file TaskGraphLoader.cpp.
References Olympe::Bool, Olympe::EntityID, Olympe::Float, GetComponentTypeID_Static(), Olympe::GlobalRef, Olympe::Int, Olympe::List, Olympe::None, Olympe::String, and Olympe::Vector.
Referenced by ParseBlackboardV4(), ParseNodeV4(), and ParseSchemaV4().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Validates a JSON object against the expected task graph schema.
For v4 flat format: checks for top-level "nodes" array. For v2/v3 nested format: checks for "data.nodes" array.
| data | Root JSON object to validate. |
| outErrors | Receives human-readable messages for each validation issue. |
Definition at line 180 of file TaskGraphLoader.cpp.
References GetComponentTypeID_Static(), JsonHelper::GetInt(), JsonHelper::IsArray(), and JsonHelper::IsObject().
Here is the call graph for this function: