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

Main animation editor window. More...

#include <AnimationEditorWindow.h>

+ Collaboration diagram for Olympe::AnimationEditorWindow:

Public Member Functions

 AnimationEditorWindow ()
 
 ~AnimationEditorWindow ()
 
void Toggle ()
 Toggle window visibility.
 
bool IsOpen () const
 Check if window is open.
 
void Update (float deltaTime)
 Update and render the editor window (separate window)
 
void ProcessEvent (SDL_Event *event)
 Process SDL events for the separate window.
 
void UpdatePreview (float deltaTime)
 Update preview animation (call every frame with deltaTime)
 
void Render ()
 Render the editor window.
 

Private Member Functions

void RenderMainMenu ()
 
void RenderBankListPanel ()
 
void RenderSpritesheetPanel ()
 
void RenderSequencePanel ()
 
void RenderPreviewPanel ()
 
void RenderPropertiesPanel ()
 
void NewBank ()
 
void OpenBank (const std::string &filepath)
 
void SaveBank ()
 
void SaveBankAs ()
 
void ImportBankJSON (const std::string &filepath)
 
void ExportBankJSON (const std::string &filepath)
 
std::vector< std::string > ScanBankDirectory (const std::string &dirPath)
 
void AddSpritesheet ()
 
void RemoveSpritesheet (int index)
 
void AutoDetectGrid (SpritesheetInfo &sheet)
 
SDL_TextureLoadSpritesheetTexture (const std::string &path)
 
void AddSequence ()
 
void RemoveSequence (int index)
 
void StartPreview ()
 
void StopPreview ()
 
void PausePreview ()
 
void ResetPreview ()
 
void RenderPreviewFrame ()
 
void MarkDirty ()
 
void ClearDirty ()
 
bool PromptUnsavedChanges ()
 
void UpdateWindowTitle ()
 
void CreateSeparateWindow ()
 
void DestroySeparateWindow ()
 
void RenderSeparateWindow ()
 

Private Attributes

bool m_isOpen = false
 
bool m_isDirty = false
 
AnimationBank m_currentBank
 
std::string m_currentBankPath
 
bool m_hasBankLoaded = false
 
int m_selectedSpritesheetIndex = -1
 
int m_selectedSequenceIndex = -1
 
int m_activeTab = 0
 
bool m_isPreviewPlaying = false
 
bool m_isPreviewPaused = false
 
float m_previewSpeed = 1.0f
 
int m_previewCurrentFrame = 0
 
float m_previewFrameTimer = 0.0f
 
float m_spritesheetZoom = 1.0f
 
float m_spritesheetPanX = 0.0f
 
float m_spritesheetPanY = 0.0f
 
bool m_showGrid = true
 
bool m_showNewBankDialog = false
 
bool m_showOpenBankDialog = false
 
bool m_showAddSpritesheetDialog = false
 
bool m_showAddSequenceDialog = false
 
char m_inputBankId [256] = ""
 
char m_inputDescription [1024] = ""
 
char m_inputAuthor [256] = ""
 
char m_inputSpritesheetId [256] = ""
 
char m_inputSpritesheetPath [512] = ""
 
char m_inputSequenceName [256] = ""
 
SDL_Windowm_separateWindow = nullptr
 
SDL_Rendererm_separateRenderer = nullptr
 
ImGuiContextm_separateImGuiContext = nullptr
 

Detailed Description

Main animation editor window.

Provides UI for creating and editing animation banks with multi-spritesheet support. Opens with F9 hotkey. Renders in standalone SDL3 window (like BT Debugger).

Definition at line 40 of file AnimationEditorWindow.h.

Constructor & Destructor Documentation

◆ AnimationEditorWindow()

Olympe::AnimationEditorWindow::AnimationEditorWindow ( )

Definition at line 36 of file AnimationEditorWindow.cpp.

References SYSTEM_LOG.

◆ ~AnimationEditorWindow()

Olympe::AnimationEditorWindow::~AnimationEditorWindow ( )

Definition at line 41 of file AnimationEditorWindow.cpp.

References DestroySeparateWindow(), and SYSTEM_LOG.

+ Here is the call graph for this function:

Member Function Documentation

◆ AddSequence()

void Olympe::AnimationEditorWindow::AddSequence ( )
private

Definition at line 1232 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::animations, GetComponentTypeID_Static(), m_currentBank, m_selectedSequenceIndex, MarkDirty(), Olympe::AnimationSequence::name, Olympe::AnimationBank::spritesheets, and SYSTEM_LOG.

Referenced by RenderMainMenu(), and RenderSequencePanel().

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

◆ AddSpritesheet()

void Olympe::AnimationEditorWindow::AddSpritesheet ( )
private

Definition at line 1153 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), Olympe::SpritesheetInfo::id, m_currentBank, m_selectedSpritesheetIndex, MarkDirty(), Olympe::AnimationBank::spritesheets, and SYSTEM_LOG.

Referenced by RenderMainMenu(), and RenderSpritesheetPanel().

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

◆ AutoDetectGrid()

void Olympe::AnimationEditorWindow::AutoDetectGrid ( SpritesheetInfo sheet)
private

Definition at line 1189 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), LoadSpritesheetTexture(), MarkDirty(), and SYSTEM_LOG.

Referenced by RenderSpritesheetPanel().

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

◆ ClearDirty()

void Olympe::AnimationEditorWindow::ClearDirty ( )
private

Definition at line 1327 of file AnimationEditorWindow.cpp.

References m_isDirty.

Referenced by ImportBankJSON(), SaveBank(), and SaveBankAs().

+ Here is the caller graph for this function:

◆ CreateSeparateWindow()

void Olympe::AnimationEditorWindow::CreateSeparateWindow ( )
private

Definition at line 1349 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_separateImGuiContext, m_separateRenderer, m_separateWindow, and SYSTEM_LOG.

Referenced by Toggle().

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

◆ DestroySeparateWindow()

void Olympe::AnimationEditorWindow::DestroySeparateWindow ( )
private

Definition at line 1390 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_separateImGuiContext, m_separateRenderer, m_separateWindow, and SYSTEM_LOG.

Referenced by ~AnimationEditorWindow().

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

◆ ExportBankJSON()

void Olympe::AnimationEditorWindow::ExportBankJSON ( const std::string &  filepath)
private

◆ ImportBankJSON()

void Olympe::AnimationEditorWindow::ImportBankJSON ( const std::string &  filepath)
private

◆ IsOpen()

bool Olympe::AnimationEditorWindow::IsOpen ( ) const
inline

Check if window is open.

Definition at line 54 of file AnimationEditorWindow.h.

References m_isOpen.

Referenced by SDL_AppEvent().

+ Here is the caller graph for this function:

◆ LoadSpritesheetTexture()

SDL_Texture * Olympe::AnimationEditorWindow::LoadSpritesheetTexture ( const std::string &  path)
private

Definition at line 1218 of file AnimationEditorWindow.cpp.

References DataManager::Get(), and DataManager::GetSprite().

Referenced by AutoDetectGrid(), RenderPreviewFrame(), and RenderSpritesheetPanel().

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

◆ MarkDirty()

void Olympe::AnimationEditorWindow::MarkDirty ( )
private

◆ NewBank()

void Olympe::AnimationEditorWindow::NewBank ( )
private

◆ OpenBank()

void Olympe::AnimationEditorWindow::OpenBank ( const std::string &  filepath)
private

Definition at line 885 of file AnimationEditorWindow.cpp.

References ImportBankJSON().

Referenced by RenderBankListPanel().

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

◆ PausePreview()

void Olympe::AnimationEditorWindow::PausePreview ( )
private

Definition at line 1297 of file AnimationEditorWindow.cpp.

References m_isPreviewPaused.

Referenced by RenderPreviewPanel().

+ Here is the caller graph for this function:

◆ ProcessEvent()

void Olympe::AnimationEditorWindow::ProcessEvent ( SDL_Event event)

Process SDL events for the separate window.

Parameters
eventSDL event to process

Definition at line 1455 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_isOpen, m_separateImGuiContext, m_separateWindow, and Toggle().

Referenced by SDL_AppEvent().

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

◆ PromptUnsavedChanges()

bool Olympe::AnimationEditorWindow::PromptUnsavedChanges ( )
private

Definition at line 1332 of file AnimationEditorWindow.cpp.

References SYSTEM_LOG.

Referenced by NewBank(), RenderBankListPanel(), and Toggle().

+ Here is the caller graph for this function:

◆ RemoveSequence()

void Olympe::AnimationEditorWindow::RemoveSequence ( int  index)
private

Definition at line 1252 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::animations, GetComponentTypeID_Static(), m_currentBank, m_selectedSequenceIndex, MarkDirty(), and SYSTEM_LOG.

Referenced by RenderMainMenu().

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

◆ RemoveSpritesheet()

void Olympe::AnimationEditorWindow::RemoveSpritesheet ( int  index)
private

Definition at line 1176 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_currentBank, m_selectedSpritesheetIndex, MarkDirty(), Olympe::AnimationBank::spritesheets, and SYSTEM_LOG.

Referenced by RenderMainMenu().

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

◆ Render()

void Olympe::AnimationEditorWindow::Render ( )

Render the editor window.

Definition at line 138 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_activeTab, m_isDirty, m_isOpen, RenderBankListPanel(), RenderMainMenu(), RenderPreviewPanel(), RenderPropertiesPanel(), RenderSequencePanel(), and RenderSpritesheetPanel().

Referenced by RenderSeparateWindow().

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

◆ RenderBankListPanel()

void Olympe::AnimationEditorWindow::RenderBankListPanel ( )
private

Definition at line 296 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_currentBankPath, m_isDirty, NewBank(), OpenBank(), PromptUnsavedChanges(), and ScanBankDirectory().

Referenced by Render().

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

◆ RenderMainMenu()

void Olympe::AnimationEditorWindow::RenderMainMenu ( )
private

Definition at line 218 of file AnimationEditorWindow.cpp.

References AddSequence(), AddSpritesheet(), m_activeTab, m_hasBankLoaded, m_isOpen, m_selectedSequenceIndex, m_selectedSpritesheetIndex, m_showGrid, m_showOpenBankDialog, NewBank(), RemoveSequence(), RemoveSpritesheet(), SaveBank(), and SaveBankAs().

Referenced by Render().

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

◆ RenderPreviewFrame()

void Olympe::AnimationEditorWindow::RenderPreviewFrame ( )
private

Definition at line 742 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::animations, GetComponentTypeID_Static(), Olympe::AnimationBank::GetSpritesheet(), LoadSpritesheetTexture(), m_currentBank, m_previewCurrentFrame, and m_selectedSequenceIndex.

Referenced by RenderPreviewPanel().

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

◆ RenderPreviewPanel()

void Olympe::AnimationEditorWindow::RenderPreviewPanel ( )
private

◆ RenderPropertiesPanel()

void Olympe::AnimationEditorWindow::RenderPropertiesPanel ( )
private

◆ RenderSeparateWindow()

void Olympe::AnimationEditorWindow::RenderSeparateWindow ( )
private

Definition at line 1425 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static(), m_separateImGuiContext, m_separateRenderer, m_separateWindow, and Render().

Referenced by Update().

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

◆ RenderSequencePanel()

void Olympe::AnimationEditorWindow::RenderSequencePanel ( )
private

Definition at line 528 of file AnimationEditorWindow.cpp.

References AddSequence(), Olympe::AnimationBank::animations, GetComponentTypeID_Static(), m_currentBank, m_hasBankLoaded, m_selectedSequenceIndex, MarkDirty(), ResetPreview(), and Olympe::AnimationBank::spritesheets.

Referenced by Render().

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

◆ RenderSpritesheetPanel()

void Olympe::AnimationEditorWindow::RenderSpritesheetPanel ( )
private

Definition at line 338 of file AnimationEditorWindow.cpp.

References AddSpritesheet(), AutoDetectGrid(), GetComponentTypeID_Static(), LoadSpritesheetTexture(), m_currentBank, m_hasBankLoaded, m_selectedSpritesheetIndex, m_showGrid, m_spritesheetZoom, MarkDirty(), and Olympe::AnimationBank::spritesheets.

Referenced by Render().

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

◆ ResetPreview()

void Olympe::AnimationEditorWindow::ResetPreview ( )
private

Definition at line 1302 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::animations, GetComponentTypeID_Static(), m_currentBank, m_previewCurrentFrame, m_previewFrameTimer, m_selectedSequenceIndex, and Olympe::AnimationSequence::startFrame.

Referenced by RenderSequencePanel(), and StopPreview().

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

◆ SaveBank()

void Olympe::AnimationEditorWindow::SaveBank ( )
private

Definition at line 890 of file AnimationEditorWindow.cpp.

References ClearDirty(), ExportBankJSON(), m_currentBankPath, and SaveBankAs().

Referenced by RenderMainMenu().

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

◆ SaveBankAs()

void Olympe::AnimationEditorWindow::SaveBankAs ( )
private

Definition at line 902 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::bankId, ClearDirty(), ExportBankJSON(), m_currentBank, and m_currentBankPath.

Referenced by RenderMainMenu(), and SaveBank().

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

◆ ScanBankDirectory()

std::vector< std::string > Olympe::AnimationEditorWindow::ScanBankDirectory ( const std::string &  dirPath)
private

Definition at line 1108 of file AnimationEditorWindow.cpp.

References GetComponentTypeID_Static().

Referenced by RenderBankListPanel(), and Toggle().

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

◆ StartPreview()

void Olympe::AnimationEditorWindow::StartPreview ( )
private

◆ StopPreview()

void Olympe::AnimationEditorWindow::StopPreview ( )
private

Definition at line 1290 of file AnimationEditorWindow.cpp.

References m_isPreviewPaused, m_isPreviewPlaying, and ResetPreview().

Referenced by RenderPreviewPanel().

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

◆ Toggle()

void Olympe::AnimationEditorWindow::Toggle ( )

Toggle window visibility.

Definition at line 51 of file AnimationEditorWindow.cpp.

References CreateSeparateWindow(), GetComponentTypeID_Static(), m_hasBankLoaded, m_isDirty, m_isOpen, m_separateWindow, PromptUnsavedChanges(), ScanBankDirectory(), and SYSTEM_LOG.

Referenced by ProcessEvent(), and SDL_AppEvent().

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

◆ Update()

void Olympe::AnimationEditorWindow::Update ( float  deltaTime)

Update and render the editor window (separate window)

Parameters
deltaTimeTime elapsed since last frame in seconds

Definition at line 1478 of file AnimationEditorWindow.cpp.

References m_isOpen, RenderSeparateWindow(), and UpdatePreview().

Referenced by SDL_AppIterate().

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

◆ UpdatePreview()

void Olympe::AnimationEditorWindow::UpdatePreview ( float  deltaTime)

Update preview animation (call every frame with deltaTime)

Parameters
deltaTimeTime elapsed since last frame in seconds

Definition at line 100 of file AnimationEditorWindow.cpp.

References Olympe::AnimationBank::animations, GetComponentTypeID_Static(), m_currentBank, m_isPreviewPaused, m_isPreviewPlaying, m_previewCurrentFrame, m_previewFrameTimer, m_previewSpeed, m_selectedSequenceIndex, and Olympe::AnimationSequence::startFrame.

Referenced by Update().

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

◆ UpdateWindowTitle()

void Olympe::AnimationEditorWindow::UpdateWindowTitle ( )
private

Definition at line 1340 of file AnimationEditorWindow.cpp.

Member Data Documentation

◆ m_activeTab

int Olympe::AnimationEditorWindow::m_activeTab = 0
private

Definition at line 134 of file AnimationEditorWindow.h.

Referenced by Render(), and RenderMainMenu().

◆ m_currentBank

AnimationBank Olympe::AnimationEditorWindow::m_currentBank
private

◆ m_currentBankPath

std::string Olympe::AnimationEditorWindow::m_currentBankPath
private

◆ m_hasBankLoaded

bool Olympe::AnimationEditorWindow::m_hasBankLoaded = false
private

◆ m_inputAuthor

char Olympe::AnimationEditorWindow::m_inputAuthor[256] = ""
private

Definition at line 161 of file AnimationEditorWindow.h.

◆ m_inputBankId

char Olympe::AnimationEditorWindow::m_inputBankId[256] = ""
private

Definition at line 159 of file AnimationEditorWindow.h.

◆ m_inputDescription

char Olympe::AnimationEditorWindow::m_inputDescription[1024] = ""
private

Definition at line 160 of file AnimationEditorWindow.h.

◆ m_inputSequenceName

char Olympe::AnimationEditorWindow::m_inputSequenceName[256] = ""
private

Definition at line 164 of file AnimationEditorWindow.h.

◆ m_inputSpritesheetId

char Olympe::AnimationEditorWindow::m_inputSpritesheetId[256] = ""
private

Definition at line 162 of file AnimationEditorWindow.h.

◆ m_inputSpritesheetPath

char Olympe::AnimationEditorWindow::m_inputSpritesheetPath[512] = ""
private

Definition at line 163 of file AnimationEditorWindow.h.

◆ m_isDirty

bool Olympe::AnimationEditorWindow::m_isDirty = false
private

◆ m_isOpen

bool Olympe::AnimationEditorWindow::m_isOpen = false
private

Definition at line 121 of file AnimationEditorWindow.h.

Referenced by IsOpen(), ProcessEvent(), Render(), RenderMainMenu(), Toggle(), and Update().

◆ m_isPreviewPaused

bool Olympe::AnimationEditorWindow::m_isPreviewPaused = false
private

◆ m_isPreviewPlaying

bool Olympe::AnimationEditorWindow::m_isPreviewPlaying = false
private

◆ m_previewCurrentFrame

int Olympe::AnimationEditorWindow::m_previewCurrentFrame = 0
private

◆ m_previewFrameTimer

float Olympe::AnimationEditorWindow::m_previewFrameTimer = 0.0f
private

◆ m_previewSpeed

float Olympe::AnimationEditorWindow::m_previewSpeed = 1.0f
private

Definition at line 139 of file AnimationEditorWindow.h.

Referenced by RenderPreviewPanel(), and UpdatePreview().

◆ m_selectedSequenceIndex

int Olympe::AnimationEditorWindow::m_selectedSequenceIndex = -1
private

◆ m_selectedSpritesheetIndex

int Olympe::AnimationEditorWindow::m_selectedSpritesheetIndex = -1
private

◆ m_separateImGuiContext

ImGuiContext* Olympe::AnimationEditorWindow::m_separateImGuiContext = nullptr
private

◆ m_separateRenderer

SDL_Renderer* Olympe::AnimationEditorWindow::m_separateRenderer = nullptr
private

◆ m_separateWindow

SDL_Window* Olympe::AnimationEditorWindow::m_separateWindow = nullptr
private

◆ m_showAddSequenceDialog

bool Olympe::AnimationEditorWindow::m_showAddSequenceDialog = false
private

Definition at line 156 of file AnimationEditorWindow.h.

◆ m_showAddSpritesheetDialog

bool Olympe::AnimationEditorWindow::m_showAddSpritesheetDialog = false
private

Definition at line 155 of file AnimationEditorWindow.h.

◆ m_showGrid

bool Olympe::AnimationEditorWindow::m_showGrid = true
private

Definition at line 147 of file AnimationEditorWindow.h.

Referenced by RenderMainMenu(), and RenderSpritesheetPanel().

◆ m_showNewBankDialog

bool Olympe::AnimationEditorWindow::m_showNewBankDialog = false
private

Definition at line 153 of file AnimationEditorWindow.h.

◆ m_showOpenBankDialog

bool Olympe::AnimationEditorWindow::m_showOpenBankDialog = false
private

Definition at line 154 of file AnimationEditorWindow.h.

Referenced by RenderMainMenu().

◆ m_spritesheetPanX

float Olympe::AnimationEditorWindow::m_spritesheetPanX = 0.0f
private

Definition at line 145 of file AnimationEditorWindow.h.

◆ m_spritesheetPanY

float Olympe::AnimationEditorWindow::m_spritesheetPanY = 0.0f
private

Definition at line 146 of file AnimationEditorWindow.h.

◆ m_spritesheetZoom

float Olympe::AnimationEditorWindow::m_spritesheetZoom = 1.0f
private

Definition at line 144 of file AnimationEditorWindow.h.

Referenced by RenderSpritesheetPanel().


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