Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
BlueprintMigrator.h
Go to the documentation of this file.
1/*
2 * Olympe Blueprint Editor - Blueprint Migrator
3 *
4 * Migrates v1 blueprints to v2 format with:
5 * - schema_version and blueprintType fields
6 * - Calculated node positions
7 * - Unified parameters structure
8 * - Metadata and editor state
9 */
10
11#pragma once
12
13#include <string>
14#include <vector>
15#include <map>
16#include <queue>
17#include "../../Source/third_party/nlohmann/json.hpp"
18
19// Forward declare ImVec2
20struct ImVec2;
21
22namespace Olympe
23{
24 /**
25 * BlueprintMigrator - Converts v1 blueprints to v2 format
26 * Handles automatic position calculation and structure migration
27 */
29 {
30 public:
32 {
33 int nodeId;
34 int depth;
36 float posX;
37 float posY;
38 };
39
42
43 // Main migration function
45
46 // Check if blueprint is already v2
47 bool IsV2(const nlohmann::json& blueprint) const;
48
49 private:
50 // Type detection
52
53 // Type-specific migration
57
58 // Position calculation
59 std::map<int, NodeLayout> CalculateHierarchicalLayout(
60 const nlohmann::json& nodes,
61 const std::map<int, std::vector<int>>& childrenMap,
62 int rootId);
63
64 // Utilities
65 std::string GetCurrentTimestamp();
67
68 // Layout constants
69 static constexpr float HORIZONTAL_SPACING = 350.0f;
70 static constexpr float VERTICAL_SPACING = 250.0f;
71 static constexpr float START_X = 200.0f;
72 static constexpr float START_Y = 300.0f;
73 };
74}
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
BlueprintMigrator - Converts v1 blueprints to v2 format Handles automatic position calculation and st...
static constexpr float HORIZONTAL_SPACING
nlohmann::json MigrateToV2(const nlohmann::json &v1Blueprint)
static constexpr float VERTICAL_SPACING
static constexpr float START_Y
std::string DetectBlueprintType(const nlohmann::json &blueprint)
void MigrateEntityPrefab(const nlohmann::json &v1, nlohmann::json &v2Data)
std::map< int, NodeLayout > CalculateHierarchicalLayout(const nlohmann::json &nodes, const std::map< int, std::vector< int > > &childrenMap, int rootId)
void MigrateHFSM(const nlohmann::json &v1, nlohmann::json &v2Data)
void MigrateBehaviorTree(const nlohmann::json &v1, nlohmann::json &v2Data)
static constexpr float START_X
void MigrateParameters(const nlohmann::json &v1Node, nlohmann::json &v2Node)
bool IsV2(const nlohmann::json &blueprint) const
nlohmann::json json