![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
Converts legacy blueprint JSON to the Phase 8 subgraph flat-dict format. More...
#include <SubgraphMigrator.h>
Public Member Functions | |
| SubgraphMigrator ()=default | |
| ~SubgraphMigrator ()=default | |
| bool | NeedsMigration (const nlohmann::json &blueprint) const |
| Returns true when the blueprint uses the legacy format (data.nodes exists at the top level of the data object). | |
| bool | IsNewFormat (const nlohmann::json &blueprint) const |
| Returns true when the blueprint is already in the Phase 8 format (data.rootGraph exists). | |
| nlohmann::json | Migrate (const nlohmann::json &blueprint) const |
| Migrates a legacy blueprint to the flat-dictionary format. | |
Static Public Member Functions | |
| static nlohmann::json | MakeEmptySubgraph (const std::string &name, const std::string &uuid, const std::string &blueprintType) |
| Creates an empty subgraph definition JSON object. | |
| static bool | ValidateSubgraphReferences (const nlohmann::json &blueprint, std::string &outError) |
| Validates that every subgraphUUID referenced by SubGraph nodes actually exists in data.subgraphs and that there are no circular dependencies (A -> B -> A). | |
Private Member Functions | |
| void | MigrateDataSection (nlohmann::json &blueprint) const |
Static Private Member Functions | |
| static bool | HasCycle (const std::string &start, const nlohmann::json &subgraphs, std::vector< std::string > &visited, std::vector< std::string > &inStack) |
| static std::vector< std::string > | CollectSubgraphRefs (const nlohmann::json &graphObj) |
Converts legacy blueprint JSON to the Phase 8 subgraph flat-dict format.
Usage:
Definition at line 44 of file SubgraphMigrator.h.
|
default |
|
default |
|
staticprivate |
Definition at line 249 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static().
Referenced by HasCycle(), and ValidateSubgraphReferences().
Here is the call graph for this function:
Here is the caller graph for this function:
|
staticprivate |
Definition at line 219 of file SubgraphMigrator.cpp.
References CollectSubgraphRefs(), GetComponentTypeID_Static(), and HasCycle().
Referenced by HasCycle(), and ValidateSubgraphReferences().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::SubgraphMigrator::IsNewFormat | ( | const nlohmann::json & | blueprint | ) | const |
Returns true when the blueprint is already in the Phase 8 format (data.rootGraph exists).
Definition at line 45 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static().
Referenced by Migrate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Creates an empty subgraph definition JSON object.
| name | Human-readable name shown in the tab. |
| uuid | Pre-generated UUID string for this subgraph. |
| blueprintType | "BehaviorTree" or "HFSM". |
Definition at line 119 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static().
Here is the call graph for this function:| nlohmann::json Olympe::SubgraphMigrator::Migrate | ( | const nlohmann::json & | blueprint | ) | const |
Migrates a legacy blueprint to the flat-dictionary format.
| blueprint | Input JSON (may be legacy or already new format). |
Definition at line 58 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static(), IsNewFormat(), MigrateDataSection(), and NeedsMigration().
Referenced by Olympe::NodeGraphManager::LoadGraph().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Definition at line 84 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static().
Referenced by Migrate().
Here is the call graph for this function:
Here is the caller graph for this function:| bool Olympe::SubgraphMigrator::NeedsMigration | ( | const nlohmann::json & | blueprint | ) | const |
Returns true when the blueprint uses the legacy format (data.nodes exists at the top level of the data object).
Both BehaviorTree and HFSM variants are detected.
Definition at line 24 of file SubgraphMigrator.cpp.
References GetComponentTypeID_Static().
Referenced by Migrate().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Validates that every subgraphUUID referenced by SubGraph nodes actually exists in data.subgraphs and that there are no circular dependencies (A -> B -> A).
| blueprint | Full blueprint JSON in new format. |
| outError | Filled with a human-readable message when false is returned. |
Definition at line 150 of file SubgraphMigrator.cpp.
References CollectSubgraphRefs(), GetComponentTypeID_Static(), and HasCycle().
Referenced by Olympe::BehaviorTreeEditorPlugin::Validate().
Here is the call graph for this function:
Here is the caller graph for this function: