12#include "../TaskSystem/TaskGraphLoader.h"
14#include "../third_party/nlohmann/json.hpp"
15#include "../system/system_utils.h"
16#include "../DataManager.h"
70 int schemaVersion = 0;
71 std::string graphType;
72 std::string blueprintType;
74 if (
fileJson.contains(
"schema_version") &&
fileJson[
"schema_version"].is_number())
75 schemaVersion =
fileJson[
"schema_version"].get<
int>();
78 if (
fileJson.contains(
"blueprintType") &&
fileJson[
"blueprintType"].is_string())
82 if (schemaVersion == 4 && graphType ==
"VisualScript")
84 std::vector<std::string> errors;
98 if (blueprintType ==
"BehaviorTree")
100 std::vector<std::string> errors;
125 return "VisualScript";
141 SYSTEM_LOG <<
"[VisualScriptRenderer] Warning: Could not resolve path: " << path <<
"\n";
Converts legacy BT v2 JSON graphs to ATS VS v4 JSON format (Phase 6).
ComponentTypeID GetComponentTypeID_Static()
IGraphRenderer adapter that wraps VisualScriptEditorPanel.
static DataManager & Get()
std::string ResolveFilePath(const std::string &relativePath) const
static TaskGraphTemplate Convert(const nlohmann::json &btV2Json, std::vector< std::string > &outErrors)
Converts a BT v2 JSON document to a TaskGraphTemplate.
static TaskGraphTemplate * LoadFromJson(const json &data, std::vector< std::string > &outErrors)
Loads a TaskGraphTemplate from an already-parsed JSON object.
Immutable, shareable task graph asset.
bool Save()
Saves the current canvas state to JSON v4 at the loaded path.
void Shutdown()
Shutdown the editor panel and release all resources.
void Initialize()
Initialize the editor panel with ImNodes context and UI helpers.
void RenderContent()
Renders panel content without window wrapper - for fixed layout.
const std::string & GetCurrentPath() const
Returns the currently loaded file path (empty if unsaved).
bool IsDirty() const
Returns true when there are unsaved modifications.
bool SaveAs(const std::string &path)
Saves the current canvas state to a new JSON v4 file.
void LoadTemplate(const TaskGraphTemplate *tmpl, const std::string &path)
Loads a VS graph template into the editor canvas.
void Render() override
Renders the graph canvas into the current ImGui child window.
std::string GetCanvasStateJSON() const override
Get canvas state as JSON string for persistence.
bool Load(const std::string &path) override
Loads a graph from a file on disk.
std::string GetCurrentPath() const override
Returns the last path successfully loaded/saved, or empty string.
void RestoreCanvasState() override
Restore previously saved canvas viewport state Called when tab is reactivated.
bool Save(const std::string &path) override
Saves the current graph state to disk.
void SaveCanvasState() override
Save the current canvas viewport state (pan, zoom, etc.) Called when tab is deactivated.
std::string ResolvePath(const std::string &path) const
bool IsDirty() const override
Returns true when the graph has unsaved changes.
std::string GetGraphType() const override
Returns the graph type string, e.g.
void SetCanvasStateJSON(const std::string &json) override
Restore canvas state from JSON string.
VisualScriptEditorPanel m_panel
< Provides AssetID and INVALID_ASSET_ID