![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Converts a BT v2 JSON object to a TaskGraphTemplate (VS v4). More...
#include <BTtoVSMigrator.h>
Static Public Member Functions | |
| static TaskGraphTemplate | Convert (const nlohmann::json &btV2Json, std::vector< std::string > &outErrors) |
| Converts a BT v2 JSON document to a TaskGraphTemplate. | |
| static bool | IsBTv2 (const nlohmann::json &j) |
Returns true if j looks like a BT v2 document. | |
| static bool | IsDecoratorName (const std::string &nodeName) |
Returns true if nodeName indicates a BT Decorator node. | |
Static Private Member Functions | |
| static TaskNodeDefinition | ConvertNode (const nlohmann::json &btNode, std::vector< std::string > &outErrors) |
| Converts one BT node JSON object to a TaskNodeDefinition. | |
| static std::vector< ExecPinConnection > | ConvertConnections (const nlohmann::json &nodesArray, std::vector< std::string > &outErrors) |
| Builds exec connections from the BT "children" tree structure. | |
| static void | ConvertBlackboard (const nlohmann::json &btV2Json, TaskGraphTemplate &vsGraph, std::vector< std::string > &outErrors) |
| Copies blackboard entries from the BT JSON to the VS template. | |
| static TaskNodeType | MapNodeType (const std::string &btType) |
| Maps a BT node type string to the closest TaskNodeType equivalent. | |
Converts a BT v2 JSON object to a TaskGraphTemplate (VS v4).
All methods are static; the class is a pure utility with no instance state.
Definition at line 51 of file BTtoVSMigrator.h.
|
static |
Converts a BT v2 JSON document to a TaskGraphTemplate.
| btV2Json | Parsed JSON from a BT v2 asset file. |
| outErrors | Receives human-readable error messages on failure. |
Definition at line 283 of file BTtoVSMigrator.cpp.
References Olympe::TaskGraphTemplate::BuildLookupCache(), ConvertBlackboard(), ConvertConnections(), ConvertNode(), Olympe::EntryPoint, Olympe::TaskGraphTemplate::EntryPointID, Olympe::TaskGraphTemplate::ExecConnections, GetComponentTypeID_Static(), Olympe::TaskGraphTemplate::GraphType, Olympe::TaskGraphTemplate::Name, Olympe::NODE_INDEX_NONE, Olympe::TaskNodeDefinition::NodeID, Olympe::TaskGraphTemplate::Nodes, Olympe::TaskGraphTemplate::RootNodeID, and Olympe::TaskNodeDefinition::Type.
Referenced by Olympe::VisualScriptRenderer::Load(), and Olympe::TaskGraphLoader::LoadFromJson().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Copies blackboard entries from the BT JSON to the VS template.
Definition at line 231 of file BTtoVSMigrator.cpp.
References Olympe::Bool, Olympe::Float, GetComponentTypeID_Static(), Olympe::Int, Olympe::BlackboardEntry::Key, Olympe::None, and Olympe::String.
Referenced by Convert().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Builds exec connections from the BT "children" tree structure.
Walks the node array and for each node that has a "children" array, emits an ExecPinConnection { nodeID, "Out", childID, "In" }.
Definition at line 187 of file BTtoVSMigrator.cpp.
References GetComponentTypeID_Static(), Olympe::NODE_INDEX_NONE, and Olympe::ExecPinConnection::SourceNodeID.
Referenced by Convert().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Converts one BT node JSON object to a TaskNodeDefinition.
Definition at line 74 of file BTtoVSMigrator.cpp.
References Olympe::AtomicTask, Olympe::TaskNodeDefinition::AtomicTaskID, Olympe::TaskNodeDefinition::ChildrenIDs, Olympe::Decorator, GetComponentTypeID_Static(), IsDecoratorName(), Olympe::Literal, MapNodeType(), Olympe::NODE_INDEX_NONE, Olympe::TaskNodeDefinition::NodeID, Olympe::TaskNodeDefinition::NodeName, Olympe::TaskNodeDefinition::Parameters, Olympe::ParameterBinding::Type, and Olympe::TaskNodeDefinition::Type.
Referenced by Convert().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Returns true if j looks like a BT v2 document.
Heuristic: document must contain "blueprintType" == "BehaviorTree" and either no schema_version or schema_version <= 2.
Definition at line 21 of file BTtoVSMigrator.cpp.
References GetComponentTypeID_Static().
Referenced by Olympe::TaskGraphLoader::LoadFromJson().
Here is the call graph for this function:
Here is the caller graph for this function:Returns true if nodeName indicates a BT Decorator node.
Some BT v2 files encode Decorator nodes as type "Action" with a descriptive name (e.g. "Repeater", "Inverter", "Cooldown", "Timeout"). This helper centralises that heuristic so both the migrator and the loader can use it consistently.
Definition at line 43 of file BTtoVSMigrator.cpp.
Referenced by ConvertNode(), and Olympe::TaskGraphLoader::ParseNodeV4().
Here is the caller graph for this function:
|
staticprivate |
Maps a BT node type string to the closest TaskNodeType equivalent.
Definition at line 57 of file BTtoVSMigrator.cpp.
References Olympe::AtomicTask, Olympe::Branch, Olympe::Decorator, Olympe::EntryPoint, GetComponentTypeID_Static(), and Olympe::Sequence.
Referenced by ConvertNode().
Here is the call graph for this function:
Here is the caller graph for this function: