Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
VisualScriptRenderer.h
Go to the documentation of this file.
1/**
2 * @file VisualScriptRenderer.h
3 * @brief IGraphRenderer adapter that wraps VisualScriptEditorPanel.
4 * @author Olympe Engine
5 * @date 2026-03-11
6 *
7 * @details C++14 compliant.
8 */
9
10#pragma once
11
12#include "IGraphRenderer.h"
14
15#include <string>
16
17namespace Olympe {
18
19/**
20 * @class VisualScriptRenderer
21 * @brief Adapts the existing VisualScriptEditorPanel to the IGraphRenderer interface.
22 */
24{
25public:
28
29 void Render() override;
30 bool Load(const std::string& path) override;
31 bool Save(const std::string& path) override;
32 bool IsDirty() const override;
33 std::string GetGraphType() const override;
34 std::string GetCurrentPath() const override;
35
36 /** @brief Direct access to the wrapped panel (for advanced operations). */
38
39 // Phase 35.0: Canvas state management
40 void SaveCanvasState() override;
41 void RestoreCanvasState() override;
42 std::string GetCanvasStateJSON() const override;
43 void SetCanvasStateJSON(const std::string& json) override;
44
45private:
47
48 // Canvas state snapshot (Phase 35.0)
50 {
51 float panX;
52 float panY;
53 float zoom;
55
56 // Phase 38: Path resolution helper
57 std::string ResolvePath(const std::string& path) const;
58};
59
60} // namespace Olympe
Abstract interface shared by all graph-renderer adapters.
ImNodes-based graph editor for ATS Visual Script graphs (Phase 5).
Polymorphic interface for all graph editor renderers.
ImNodes graph editor for ATS Visual Script v4 graphs.
Adapts the existing VisualScriptEditorPanel to the IGraphRenderer interface.
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.
VisualScriptEditorPanel & GetPanel()
Direct access to the wrapped panel (for advanced operations).
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.
struct Olympe::VisualScriptRenderer::CanvasState m_savedCanvasState
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
nlohmann::json json