Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
Olympe::NodeGraph::GraphMigrator Class Reference

Handles migration from old JSON formats to v2. More...

#include <GraphMigrator.h>

Static Public Member Functions

static GraphDocument LoadWithMigration (const json &j)
 Load graph with automatic migration.
 

Static Private Member Functions

static int DetectSchemaVersion (const json &j)
 Detect schema version.
 
static json MigrateLegacyBTToV2 (const json &v1)
 Migrate legacy BT format to v2.
 
static json MigrateV1BlueprintToV2 (const json &v1)
 Migrate v1 Blueprint format to v2.
 

Detailed Description

Handles migration from old JSON formats to v2.

Definition at line 23 of file GraphMigrator.h.

Member Function Documentation

◆ DetectSchemaVersion()

int Olympe::NodeGraph::GraphMigrator::DetectSchemaVersion ( const json j)
staticprivate

Detect schema version.

Parameters
jJSON object
Returns
Version number (0 = legacy BT, 1 = v1 blueprint, 2 = v2)

Definition at line 50 of file GraphMigrator.cpp.

References GetComponentTypeID_Static(), and JsonHelper::GetInt().

Referenced by LoadWithMigration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ LoadWithMigration()

GraphDocument Olympe::NodeGraph::GraphMigrator::LoadWithMigration ( const json j)
static

Load graph with automatic migration.

Parameters
jJSON object
Returns
GraphDocument with migrated data

Definition at line 20 of file GraphMigrator.cpp.

References DetectSchemaVersion(), Olympe::NodeGraph::GraphDocument::FromJson(), GetComponentTypeID_Static(), MigrateLegacyBTToV2(), MigrateV1BlueprintToV2(), and SYSTEM_LOG.

Referenced by Olympe::NodeGraph::NodeGraphManager::LoadGraph().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MigrateLegacyBTToV2()

json Olympe::NodeGraph::GraphMigrator::MigrateLegacyBTToV2 ( const json v1)
staticprivate

Migrate legacy BT format to v2.

Parameters
v1Legacy JSON
Returns
v2 JSON

Definition at line 87 of file GraphMigrator.cpp.

References GetComponentTypeID_Static(), JsonHelper::GetFloat(), JsonHelper::GetInt(), and JsonHelper::GetString().

Referenced by LoadWithMigration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MigrateV1BlueprintToV2()

json Olympe::NodeGraph::GraphMigrator::MigrateV1BlueprintToV2 ( const json v1)
staticprivate

Migrate v1 Blueprint format to v2.

Parameters
v1v1 JSON
Returns
v2 JSON

Definition at line 252 of file GraphMigrator.cpp.

References GetComponentTypeID_Static(), and JsonHelper::GetString().

Referenced by LoadWithMigration().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: