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::EntityPrefabRenderer Class Reference

Renderer adapter for Entity Prefab graphs. More...

#include <EntityPrefabRenderer.h>

+ Inheritance diagram for Olympe::EntityPrefabRenderer:
+ Collaboration diagram for Olympe::EntityPrefabRenderer:

Classes

struct  CanvasState
 

Public Member Functions

 EntityPrefabRenderer (PrefabCanvas &canvas)
 
 ~EntityPrefabRenderer ()
 
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.
 
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

void RenderToolbar ()
 
void RenderLayoutWithTabs ()
 
void RenderRightPanelTabs ()
 

Private Attributes

PrefabCanvasm_canvas
 
ComponentPalettePanel m_componentPalette
 
PropertyEditorPanel m_propertyEditor
 
std::unique_ptr< ICanvasEditorm_canvasEditor
 
std::string m_filePath
 
bool m_isDirty = false
 
float m_canvasPanelWidth = 0.75f
 
int m_rightPanelTabSelection = 0
 
struct Olympe::EntityPrefabRenderer::CanvasState m_savedCanvasState
 
bool m_minimapVisible = true
 
float m_minimapSize = 0.15f
 
int m_minimapPosition = 1
 

Detailed Description

Renderer adapter for Entity Prefab graphs.

Implements IGraphRenderer interface for the TabManager, delegating rendering to PrefabCanvas with integrated component palette and property panel.

Definition at line 20 of file EntityPrefabRenderer.h.

Constructor & Destructor Documentation

◆ EntityPrefabRenderer()

Olympe::EntityPrefabRenderer::EntityPrefabRenderer ( PrefabCanvas canvas)
explicit

Definition at line 11 of file EntityPrefabRenderer.cpp.

References Olympe::ComponentPalettePanel::Initialize(), m_canvasEditor, and m_componentPalette.

+ Here is the call graph for this function:

◆ ~EntityPrefabRenderer()

Olympe::EntityPrefabRenderer::~EntityPrefabRenderer ( )

Definition at line 22 of file EntityPrefabRenderer.cpp.

Member Function Documentation

◆ GetCanvasStateJSON()

std::string Olympe::EntityPrefabRenderer::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 336 of file EntityPrefabRenderer.cpp.

◆ GetCurrentPath()

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

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

Implements Olympe::IGraphRenderer.

Definition at line 307 of file EntityPrefabRenderer.cpp.

References m_filePath.

◆ GetGraphType()

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

Returns the graph type string, e.g.

"VisualScript", "BehaviorTree".

Implements Olympe::IGraphRenderer.

Definition at line 302 of file EntityPrefabRenderer.cpp.

◆ IsDirty()

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

Returns true when the graph has unsaved changes.

Implements Olympe::IGraphRenderer.

Definition at line 291 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), Olympe::PrefabCanvas::GetDocument(), Olympe::EntityPrefabGraphDocument::IsDirty(), m_canvas, and m_isDirty.

+ Here is the call graph for this function:

◆ Load()

bool Olympe::EntityPrefabRenderer::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 208 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), Olympe::PrefabCanvas::GetDocument(), Olympe::PrefabLoader::LoadJsonFromFile(), m_canvas, m_filePath, m_isDirty, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ Render()

void Olympe::EntityPrefabRenderer::Render ( )
overridevirtual

Renders the graph canvas into the current ImGui child window.

Implements Olympe::IGraphRenderer.

Definition at line 26 of file EntityPrefabRenderer.cpp.

References RenderLayoutWithTabs().

+ Here is the call graph for this function:

◆ RenderLayoutWithTabs()

void Olympe::EntityPrefabRenderer::RenderLayoutWithTabs ( )
private

◆ RenderRightPanelTabs()

void Olympe::EntityPrefabRenderer::RenderRightPanelTabs ( )
private

◆ RenderToolbar()

void Olympe::EntityPrefabRenderer::RenderToolbar ( )
private

Definition at line 348 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), m_canvasEditor, m_minimapPosition, m_minimapSize, and m_minimapVisible.

Referenced by RenderLayoutWithTabs().

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

◆ RestoreCanvasState()

void Olympe::EntityPrefabRenderer::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 325 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), m_canvasEditor, m_savedCanvasState, Olympe::EntityPrefabRenderer::CanvasState::panX, Olympe::EntityPrefabRenderer::CanvasState::panY, and Olympe::EntityPrefabRenderer::CanvasState::zoom.

+ Here is the call graph for this function:

◆ Save()

bool Olympe::EntityPrefabRenderer::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 258 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), Olympe::PrefabCanvas::GetDocument(), m_canvas, m_filePath, and m_isDirty.

+ Here is the call graph for this function:

◆ SaveCanvasState()

void Olympe::EntityPrefabRenderer::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 313 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static(), m_canvasEditor, m_savedCanvasState, Olympe::EntityPrefabRenderer::CanvasState::panX, Olympe::EntityPrefabRenderer::CanvasState::panY, and Olympe::EntityPrefabRenderer::CanvasState::zoom.

+ Here is the call graph for this function:

◆ SetCanvasStateJSON()

void Olympe::EntityPrefabRenderer::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 342 of file EntityPrefabRenderer.cpp.

References GetComponentTypeID_Static().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_canvas

PrefabCanvas& Olympe::EntityPrefabRenderer::m_canvas
private

◆ m_canvasEditor

std::unique_ptr<ICanvasEditor> Olympe::EntityPrefabRenderer::m_canvasEditor
private

◆ m_canvasPanelWidth

float Olympe::EntityPrefabRenderer::m_canvasPanelWidth = 0.75f
private

Definition at line 46 of file EntityPrefabRenderer.h.

Referenced by RenderLayoutWithTabs().

◆ m_componentPalette

ComponentPalettePanel Olympe::EntityPrefabRenderer::m_componentPalette
private

Definition at line 41 of file EntityPrefabRenderer.h.

Referenced by EntityPrefabRenderer(), and RenderRightPanelTabs().

◆ m_filePath

std::string Olympe::EntityPrefabRenderer::m_filePath
private

Definition at line 44 of file EntityPrefabRenderer.h.

Referenced by GetCurrentPath(), Load(), and Save().

◆ m_isDirty

bool Olympe::EntityPrefabRenderer::m_isDirty = false
private

Definition at line 45 of file EntityPrefabRenderer.h.

Referenced by IsDirty(), Load(), and Save().

◆ m_minimapPosition

int Olympe::EntityPrefabRenderer::m_minimapPosition = 1
private

Definition at line 60 of file EntityPrefabRenderer.h.

Referenced by RenderLayoutWithTabs(), and RenderToolbar().

◆ m_minimapSize

float Olympe::EntityPrefabRenderer::m_minimapSize = 0.15f
private

Definition at line 59 of file EntityPrefabRenderer.h.

Referenced by RenderLayoutWithTabs(), and RenderToolbar().

◆ m_minimapVisible

bool Olympe::EntityPrefabRenderer::m_minimapVisible = true
private

Definition at line 58 of file EntityPrefabRenderer.h.

Referenced by RenderLayoutWithTabs(), and RenderToolbar().

◆ m_propertyEditor

PropertyEditorPanel Olympe::EntityPrefabRenderer::m_propertyEditor
private

Definition at line 42 of file EntityPrefabRenderer.h.

Referenced by RenderRightPanelTabs().

◆ m_rightPanelTabSelection

int Olympe::EntityPrefabRenderer::m_rightPanelTabSelection = 0
private

Definition at line 47 of file EntityPrefabRenderer.h.

◆ m_savedCanvasState

struct Olympe::EntityPrefabRenderer::CanvasState Olympe::EntityPrefabRenderer::m_savedCanvasState
private

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