![]() |
Olympe Engine 2.0
2D Game Engine with ECS Architecture
|
ImGui modal dialog for selecting BehaviorTree .bt.json files. More...
#include <BehaviorTreeFilePickerModal.h>
Public Member Functions | |
| BehaviorTreeFilePickerModal () | |
| ~BehaviorTreeFilePickerModal ()=default | |
| void | Open (const std::string ¤tPath="") |
| 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. | |
ImGui modal dialog for selecting BehaviorTree .bt.json files.
Usage:
Definition at line 30 of file BehaviorTreeFilePickerModal.h.
| 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:
|
default |
| 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.
|
private |
Filters file list by search term.
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:
|
inline |
Returns the selected file path (only valid if IsConfirmed() is true).
Definition at line 73 of file BehaviorTreeFilePickerModal.h.
References m_selectedFile.
|
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.
|
inline |
Returns true if modal is currently visible.
Definition at line 62 of file BehaviorTreeFilePickerModal.h.
References m_isOpen.
Opens the modal with optional initial path.
| currentPath | If 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:
|
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:| 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:
|
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:
|
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:
|
private |
.bt.json files in current directory
Definition at line 89 of file BehaviorTreeFilePickerModal.h.
Referenced by GetFilteredFiles(), RefreshFileList(), Render(), RenderActionButtons(), and RenderFileList().
Did user click Select button.
Definition at line 81 of file BehaviorTreeFilePickerModal.h.
Referenced by Close(), IsConfirmed(), Open(), and RenderActionButtons().
|
private |
Current browse directory.
Definition at line 83 of file BehaviorTreeFilePickerModal.h.
Referenced by BehaviorTreeFilePickerModal(), Open(), RefreshFileList(), Render(), and RenderActionButtons().
Is modal currently displayed.
Definition at line 80 of file BehaviorTreeFilePickerModal.h.
Referenced by Close(), IsOpen(), Open(), Render(), and RenderActionButtons().
|
private |
Directory path input buffer.
Definition at line 96 of file BehaviorTreeFilePickerModal.h.
Referenced by BehaviorTreeFilePickerModal(), Open(), and Render().
|
private |
Search filter text.
Definition at line 97 of file BehaviorTreeFilePickerModal.h.
Referenced by GetFilteredFiles(), Open(), and Render().
|
private |
The file path user selected.
Definition at line 82 of file BehaviorTreeFilePickerModal.h.
Referenced by Close(), GetSelectedFile(), Open(), and RenderActionButtons().
|
private |
Currently highlighted file (-1 = none)
Definition at line 90 of file BehaviorTreeFilePickerModal.h.
Referenced by Open(), RefreshFileList(), Render(), RenderActionButtons(), and RenderFileList().