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

ImGui modal dialog for selecting BehaviorTree .bt.json files. More...

#include <BehaviorTreeFilePickerModal.h>

Public Member Functions

 BehaviorTreeFilePickerModal ()
 
 ~BehaviorTreeFilePickerModal ()=default
 
void Open (const std::string &currentPath="")
 Opens the modal with optional initial path.
 
void Close ()
 Closes the modal without confirming changes.
 
void Render ()
 Renders the modal UI.
 
bool IsOpen () const
 Returns true if modal is currently visible.
 
bool IsConfirmed () const
 Returns true if user clicked "Select" button.
 
const std::string & GetSelectedFile () const
 Returns the selected file path (only valid if IsConfirmed() is true).
 

Private Member Functions

void RefreshFileList ()
 Scans current directory for .bt.json behavior tree files.
 
void RenderFileList ()
 Renders the file list with scrolling support.
 
void RenderActionButtons ()
 Renders action buttons (Select, Cancel).
 
std::vector< std::string > GetFilteredFiles () const
 Filters file list by search term.
 

Private Attributes

bool m_isOpen = false
 Is modal currently displayed.
 
bool m_confirmed = false
 Did user click Select button.
 
std::string m_selectedFile = ""
 The file path user selected.
 
std::string m_currentPath = ""
 Current browse directory.
 
std::vector< std::string > m_behaviorTreeFiles
 .bt.json files in current directory
 
int m_selectedIndex = -1
 Currently highlighted file (-1 = none)
 
char m_pathBuffer [512] = ""
 Directory path input buffer.
 
char m_searchBuffer [128] = ""
 Search filter text.
 

Detailed Description

ImGui modal dialog for selecting BehaviorTree .bt.json files.

Usage:

  1. Call Open() to initialize and show modal
  2. Call Render() each frame (returns true if still open)
  3. Check IsConfirmed() after close to see if user applied changes
  4. Call GetSelectedFile() to get the chosen file path
  5. Call Close() to dismiss modal

Definition at line 30 of file BehaviorTreeFilePickerModal.h.

Constructor & Destructor Documentation

◆ BehaviorTreeFilePickerModal()

Olympe::BehaviorTreeFilePickerModal::BehaviorTreeFilePickerModal ( )

Definition at line 22 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_currentPath, m_pathBuffer, and RefreshFileList().

+ Here is the call graph for this function:

◆ ~BehaviorTreeFilePickerModal()

Olympe::BehaviorTreeFilePickerModal::~BehaviorTreeFilePickerModal ( )
default

Member Function Documentation

◆ Close()

void Olympe::BehaviorTreeFilePickerModal::Close ( )

Closes the modal without confirming changes.

Definition at line 51 of file BehaviorTreeFilePickerModal.cpp.

References m_confirmed, m_isOpen, and m_selectedFile.

◆ GetFilteredFiles()

std::vector< std::string > Olympe::BehaviorTreeFilePickerModal::GetFilteredFiles ( ) const
private

Filters file list by search term.

Returns
Filtered file list

Definition at line 266 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_behaviorTreeFiles, and m_searchBuffer.

Referenced by RenderFileList().

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

◆ GetSelectedFile()

const std::string & Olympe::BehaviorTreeFilePickerModal::GetSelectedFile ( ) const
inline

Returns the selected file path (only valid if IsConfirmed() is true).

Definition at line 73 of file BehaviorTreeFilePickerModal.h.

References m_selectedFile.

◆ IsConfirmed()

bool Olympe::BehaviorTreeFilePickerModal::IsConfirmed ( ) const
inline

Returns true if user clicked "Select" button.

Call this after modal closes to check if changes should be applied.

Definition at line 68 of file BehaviorTreeFilePickerModal.h.

References m_confirmed.

◆ IsOpen()

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

Returns true if modal is currently visible.

Definition at line 62 of file BehaviorTreeFilePickerModal.h.

References m_isOpen.

◆ Open()

void Olympe::BehaviorTreeFilePickerModal::Open ( const std::string &  currentPath = "")

Opens the modal with optional initial path.

Parameters
currentPathIf non-empty, shows this path as selected initially

Definition at line 34 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_confirmed, m_currentPath, m_isOpen, m_pathBuffer, m_searchBuffer, m_selectedFile, m_selectedIndex, and RefreshFileList().

+ Here is the call graph for this function:

◆ RefreshFileList()

void Olympe::BehaviorTreeFilePickerModal::RefreshFileList ( )
private

Scans current directory for .bt.json behavior tree files.

Populates m_behaviorTreeFiles with file names.

Definition at line 152 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_behaviorTreeFiles, m_currentPath, m_selectedIndex, and SYSTEM_LOG.

Referenced by BehaviorTreeFilePickerModal(), Open(), and Render().

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

◆ Render()

void Olympe::BehaviorTreeFilePickerModal::Render ( )

Renders the modal UI.

Call every frame while modal is open.

Definition at line 58 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_behaviorTreeFiles, m_currentPath, m_isOpen, m_pathBuffer, m_searchBuffer, m_selectedIndex, RefreshFileList(), RenderActionButtons(), and RenderFileList().

+ Here is the call graph for this function:

◆ RenderActionButtons()

void Olympe::BehaviorTreeFilePickerModal::RenderActionButtons ( )
private

Renders action buttons (Select, Cancel).

Definition at line 234 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), m_behaviorTreeFiles, m_confirmed, m_currentPath, m_isOpen, m_selectedFile, and m_selectedIndex.

Referenced by Render().

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

◆ RenderFileList()

void Olympe::BehaviorTreeFilePickerModal::RenderFileList ( )
private

Renders the file list with scrolling support.

Definition at line 191 of file BehaviorTreeFilePickerModal.cpp.

References GetComponentTypeID_Static(), GetFilteredFiles(), m_behaviorTreeFiles, and m_selectedIndex.

Referenced by Render().

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

Member Data Documentation

◆ m_behaviorTreeFiles

std::vector<std::string> Olympe::BehaviorTreeFilePickerModal::m_behaviorTreeFiles
private

.bt.json files in current directory

Definition at line 89 of file BehaviorTreeFilePickerModal.h.

Referenced by GetFilteredFiles(), RefreshFileList(), Render(), RenderActionButtons(), and RenderFileList().

◆ m_confirmed

bool Olympe::BehaviorTreeFilePickerModal::m_confirmed = false
private

Did user click Select button.

Definition at line 81 of file BehaviorTreeFilePickerModal.h.

Referenced by Close(), IsConfirmed(), Open(), and RenderActionButtons().

◆ m_currentPath

std::string Olympe::BehaviorTreeFilePickerModal::m_currentPath = ""
private

Current browse directory.

Definition at line 83 of file BehaviorTreeFilePickerModal.h.

Referenced by BehaviorTreeFilePickerModal(), Open(), RefreshFileList(), Render(), and RenderActionButtons().

◆ m_isOpen

bool Olympe::BehaviorTreeFilePickerModal::m_isOpen = false
private

Is modal currently displayed.

Definition at line 80 of file BehaviorTreeFilePickerModal.h.

Referenced by Close(), IsOpen(), Open(), Render(), and RenderActionButtons().

◆ m_pathBuffer

char Olympe::BehaviorTreeFilePickerModal::m_pathBuffer[512] = ""
private

Directory path input buffer.

Definition at line 96 of file BehaviorTreeFilePickerModal.h.

Referenced by BehaviorTreeFilePickerModal(), Open(), and Render().

◆ m_searchBuffer

char Olympe::BehaviorTreeFilePickerModal::m_searchBuffer[128] = ""
private

Search filter text.

Definition at line 97 of file BehaviorTreeFilePickerModal.h.

Referenced by GetFilteredFiles(), Open(), and Render().

◆ m_selectedFile

std::string Olympe::BehaviorTreeFilePickerModal::m_selectedFile = ""
private

The file path user selected.

Definition at line 82 of file BehaviorTreeFilePickerModal.h.

Referenced by Close(), GetSelectedFile(), Open(), and RenderActionButtons().

◆ m_selectedIndex

int Olympe::BehaviorTreeFilePickerModal::m_selectedIndex = -1
private

Currently highlighted file (-1 = none)

Definition at line 90 of file BehaviorTreeFilePickerModal.h.

Referenced by Open(), RefreshFileList(), Render(), RenderActionButtons(), and RenderFileList().


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