11#include "../system/system_utils.h"
39 catch (
const std::exception&
e)
41 outErrors.push_back(std::string(
"TaskGraphMigrator: JSON parse error: ") +
e.what());
65 catch (
const std::exception&
e)
67 outErrors.push_back(std::string(
"TaskGraphMigrator: JSON write error: ") +
e.what());
73 <<
"' -> '" <<
outputPath <<
"' (schema v3 -> v4)\n";
85 if (!
v3data.contains(
"schema_version") ||
v3data[
"schema_version"] != 3)
87 outErrors.push_back(
"TaskGraphMigrator: input is not schema_version 3");
95 if (
v3data.contains(
"description"))
v4[
"description"] =
v3data[
"description"];
98 if (
v3data.contains(
"blackboard"))
100 v4[
"blackboard"] =
v3data[
"blackboard"];
102 if (
v3data.contains(
"localBlackboard"))
104 v4[
"localBlackboard"] =
v3data[
"localBlackboard"];
108 v4[
"schema_version"] = 4;
109 v4[
"graphType"] =
"VisualScript";
116 if (
v3data.contains(
"nodes") &&
v3data[
"nodes"].is_array())
120 const int nodeID =
node.value(
"nodeID", -1);
128 conn[
"SourceNodeID"] = nodeID;
129 conn[
"SourcePinName"] =
"Out";
131 conn[
"TargetPinName"] =
"In";
140 conn[
"SourceNodeID"] = nodeID;
141 conn[
"SourcePinName"] =
"OutFailure";
143 conn[
"TargetPinName"] =
"In";
152 const std::string&
key =
it.key();
153 if (
key ==
"NextOnSuccess" ||
key ==
"NextOnFailure")
ComponentTypeID GetComponentTypeID_Static()
Migrates task graph JSON from schema v3 (BT-style) to schema v4 (VS-style).
static json MigrateJson(const json &v3data, std::vector< std::string > &outErrors)
Performs the v3->v4 JSON transformation in memory.
static bool Migrate(const std::string &inputPath, const std::string &outputPath, std::vector< std::string > &outErrors)
Migrates a v3 JSON file to v4 and writes the result to disk.
< Provides AssetID and INVALID_ASSET_ID