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

Adapts the existing VisualScriptEditorPanel to the IGraphRenderer interface. More...

#include <VisualScriptRenderer.h>

+ Inheritance diagram for Olympe::VisualScriptRenderer:
+ Collaboration diagram for Olympe::VisualScriptRenderer:

Classes

struct  CanvasState
 

Public Member Functions

 VisualScriptRenderer ()
 
 ~VisualScriptRenderer ()
 
void Render () override
 Renders the graph canvas into the current ImGui child window.
 
bool Load (const std::string &path) override
 Loads a graph from a file on disk.
 
bool Save (const std::string &path) override
 Saves the current graph state to disk.
 
bool IsDirty () const override
 Returns true when the graph has unsaved changes.
 
std::string GetGraphType () const override
 Returns the graph type string, e.g.
 
std::string GetCurrentPath () const override
 Returns the last path successfully loaded/saved, or empty string.
 
VisualScriptEditorPanelGetPanel ()
 Direct access to the wrapped panel (for advanced operations).
 
void SaveCanvasState () override
 Save the current canvas viewport state (pan, zoom, etc.) Called when tab is deactivated.
 
void RestoreCanvasState () override
 Restore previously saved canvas viewport state Called when tab is reactivated.
 
std::string GetCanvasStateJSON () const override
 Get canvas state as JSON string for persistence.
 
void SetCanvasStateJSON (const std::string &json) override
 Restore canvas state from JSON string.
 
- Public Member Functions inherited from Olympe::IGraphRenderer
virtual ~IGraphRenderer ()
 

Private Member Functions

std::string ResolvePath (const std::string &path) const
 

Private Attributes

VisualScriptEditorPanel m_panel
 
struct Olympe::VisualScriptRenderer::CanvasState m_savedCanvasState
 

Detailed Description

Adapts the existing VisualScriptEditorPanel to the IGraphRenderer interface.

Definition at line 23 of file VisualScriptRenderer.h.

Constructor & Destructor Documentation

◆ VisualScriptRenderer()

Olympe::VisualScriptRenderer::VisualScriptRenderer ( )

Definition at line 25 of file VisualScriptRenderer.cpp.

References Olympe::VisualScriptEditorPanel::Initialize(), and m_panel.

+ Here is the call graph for this function:

◆ ~VisualScriptRenderer()

Olympe::VisualScriptRenderer::~VisualScriptRenderer ( )

Definition at line 30 of file VisualScriptRenderer.cpp.

References m_panel, and Olympe::VisualScriptEditorPanel::Shutdown().

+ Here is the call graph for this function:

Member Function Documentation

◆ GetCanvasStateJSON()

std::string Olympe::VisualScriptRenderer::GetCanvasStateJSON ( ) const
overridevirtual

Get canvas state as JSON string for persistence.

Returns
JSON representation of current canvas state

Reimplemented from Olympe::IGraphRenderer.

Definition at line 162 of file VisualScriptRenderer.cpp.

◆ GetCurrentPath()

std::string Olympe::VisualScriptRenderer::GetCurrentPath ( ) const
overridevirtual

Returns the last path successfully loaded/saved, or empty string.

Implements Olympe::IGraphRenderer.

Definition at line 128 of file VisualScriptRenderer.cpp.

References Olympe::VisualScriptEditorPanel::GetCurrentPath(), and m_panel.

+ Here is the call graph for this function:

◆ GetGraphType()

std::string Olympe::VisualScriptRenderer::GetGraphType ( ) const
overridevirtual

Returns the graph type string, e.g.

"VisualScript", "BehaviorTree".

Implements Olympe::IGraphRenderer.

Definition at line 123 of file VisualScriptRenderer.cpp.

◆ GetPanel()

VisualScriptEditorPanel & Olympe::VisualScriptRenderer::GetPanel ( )
inline

Direct access to the wrapped panel (for advanced operations).

Definition at line 37 of file VisualScriptRenderer.h.

References m_panel.

Referenced by Olympe::BlueprintEditorGUI::RenderFixedLayout().

+ Here is the caller graph for this function:

◆ IsDirty()

bool Olympe::VisualScriptRenderer::IsDirty ( ) const
overridevirtual

Returns true when the graph has unsaved changes.

Implements Olympe::IGraphRenderer.

Definition at line 118 of file VisualScriptRenderer.cpp.

References Olympe::VisualScriptEditorPanel::IsDirty(), and m_panel.

+ Here is the call graph for this function:

◆ Load()

bool Olympe::VisualScriptRenderer::Load ( const std::string &  path)
overridevirtual

Loads a graph from a file on disk.

Parameters
pathAbsolute or relative path to the .ats / .json file.
Returns
true on success.

Implements Olympe::IGraphRenderer.

Definition at line 40 of file VisualScriptRenderer.cpp.

References Olympe::BTtoVSMigrator::Convert(), GetComponentTypeID_Static(), Olympe::TaskGraphLoader::LoadFromJson(), Olympe::VisualScriptEditorPanel::LoadTemplate(), m_panel, ResolvePath(), and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ Render()

void Olympe::VisualScriptRenderer::Render ( )
overridevirtual

Renders the graph canvas into the current ImGui child window.

Implements Olympe::IGraphRenderer.

Definition at line 35 of file VisualScriptRenderer.cpp.

References m_panel, and Olympe::VisualScriptEditorPanel::RenderContent().

+ Here is the call graph for this function:

◆ ResolvePath()

std::string Olympe::VisualScriptRenderer::ResolvePath ( const std::string &  path) const
private

Definition at line 134 of file VisualScriptRenderer.cpp.

References DataManager::Get(), GetComponentTypeID_Static(), DataManager::ResolveFilePath(), and SYSTEM_LOG.

Referenced by Load().

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

◆ RestoreCanvasState()

void Olympe::VisualScriptRenderer::RestoreCanvasState ( )
overridevirtual

Restore previously saved canvas viewport state Called when tab is reactivated.

Ensures smooth tab switching without losing layout.

Reimplemented from Olympe::IGraphRenderer.

Definition at line 156 of file VisualScriptRenderer.cpp.

◆ Save()

bool Olympe::VisualScriptRenderer::Save ( const std::string &  path)
overridevirtual

Saves the current graph state to disk.

Parameters
pathDestination path. If empty, save to the path passed to Load().
Returns
true on success.

Implements Olympe::IGraphRenderer.

Definition at line 111 of file VisualScriptRenderer.cpp.

References m_panel, Olympe::VisualScriptEditorPanel::Save(), and Olympe::VisualScriptEditorPanel::SaveAs().

+ Here is the call graph for this function:

◆ SaveCanvasState()

void Olympe::VisualScriptRenderer::SaveCanvasState ( )
overridevirtual

Save the current canvas viewport state (pan, zoom, etc.) Called when tab is deactivated.

Used to preserve viewport when switching between multiple tabs.

Reimplemented from Olympe::IGraphRenderer.

Definition at line 149 of file VisualScriptRenderer.cpp.

◆ SetCanvasStateJSON()

void Olympe::VisualScriptRenderer::SetCanvasStateJSON ( const std::string &  json)
overridevirtual

Restore canvas state from JSON string.

Parameters
jsonJSON representation of saved canvas state

Reimplemented from Olympe::IGraphRenderer.

Definition at line 168 of file VisualScriptRenderer.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_panel

VisualScriptEditorPanel Olympe::VisualScriptRenderer::m_panel
private

◆ m_savedCanvasState

struct Olympe::VisualScriptRenderer::CanvasState Olympe::VisualScriptRenderer::m_savedCanvasState
private

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