9#include "../../third_party/imgui/imgui.h"
10#include "../../system/system_consts.h"
11#include "../../system/system_utils.h"
51 if (!currentPath.empty())
82 ImGui::SetNextWindowSizeConstraints(
ImVec2(600.0f, 400.0f),
ImVec2(1400.0f, 900.0f));
96 ImGui::TextDisabled(
"Path:");
98 ImGui::SetNextItemWidth(-100.0f);
106 if (ImGui::Button(
"Refresh##refresh",
ImVec2(90, 0)))
117 ImGui::TextDisabled(
"Filter:");
119 ImGui::SetNextItemWidth(150.0f);
122 const char*
filterOptions[] = {
"All (*.*)",
"Type 1",
"Type 2",
"Type 3" };
163 ImGui::TextDisabled(
"Search:");
165 ImGui::SetNextItemWidth(-1.0f);
174 ImGui::BeginChild(
"##file_browser",
ImVec2(0, 300),
true);
179 ImGui::TextDisabled(
"Folders:");
182 if (ImGui::Selectable(
"..",
false))
196 if (ImGui::Selectable(
folder.c_str(),
false))
208 ImGui::BeginChild(
"##files",
ImVec2(0, -1),
true);
209 ImGui::TextDisabled(
"Available Files:");
222 ImGui::TextDisabled(
"Selected:");
230 ImGui::TextColored(
ImVec4(1.0f, 0.5f, 0.5f, 1.0f),
"(none)");
247 ImGui::OpenPopup(title.c_str());
264 return "./Gamedata/Audio";
266 return "./Gamedata/Tilesets";
294 return "Select BehaviorTree File##filepicker_bt";
296 return "Select SubGraph File##filepicker_ats";
298 return "Select Audio File##filepicker_audio";
300 return "Select Tileset File##filepicker_tileset";
302 return "Select File##filepicker";
311 return "Select a BehaviorTree file (.bt.json) to link with this component";
313 return "Select a Blueprint file (.ats) to use as SubGraph";
315 return "Select an Audio file (.ogg)";
317 return "Select a Tileset file (.tsj)";
319 return "Select a file";
426 ImGui::TextDisabled(
"Available Files:");
428 ImGui::BeginChild(
"##file_list",
ImVec2(0, 250),
true);
459 ImGui::TextDisabled(
"(no files found)");
470 ImGui::BeginDisabled(
true);
472 if (ImGui::Button(
"Select##select",
ImVec2(100, 0)))
480 ImGui::CloseCurrentPopup();
485 ImGui::EndDisabled();
489 if (ImGui::Button(
"Cancel##cancel",
ImVec2(100, 0)))
493 ImGui::CloseCurrentPopup();
ComponentTypeID GetComponentTypeID_Static()
Centralized file picker modal for all file selection operations (Phase 40).
std::vector< std::string > GetFilteredFiles() const
Filters and returns files matching the search buffer.
char m_searchBuffer[128]
Search filter text buffer.
void RenderActionButtons()
Renders the action buttons (Select, Cancel).
FilePickerModal(FilePickerType fileType)
Constructs a file picker modal for the given file type.
std::string m_selectedFile
Full path to selected file.
void Close()
Closes the modal without confirming changes.
std::string m_currentFilter
Current file extension filter.
bool m_isOpen
Is modal currently visible.
int m_selectedIndex
Currently highlighted file (-1 = none)
void RenderFileList()
Renders the file list UI component with scrolling and selection.
std::string GetModalTitle() const
Returns the modal title for this file type (e.g., "Select BehaviorTree File").
bool m_confirmed
Did user click Select.
void Open(const std::string ¤tPath="")
Opens the modal with optional initial path.
void Render()
Renders the modal UI.
std::vector< std::string > m_fileList
Files found in current directory.
std::string GetFilePattern() const
Returns the file pattern for this file type (e.g., "*.bt.json").
int m_selectedFilterIndex
Current filter type (0=default, 1=.bt.json, etc.)
std::string GetDefaultDirectory() const
Returns the default directory for this file type.
std::vector< std::string > m_folderList
Folders in current directory.
FilePickerType m_fileType
Type of files to browse.
std::string GetDescriptionText() const
Returns the description text for this file type.
std::string m_currentPath
Current directory being browsed.
char m_pathBuffer[512]
Path input text buffer.
void RefreshFileList()
Refreshes file list from current directory.
< Provides AssetID and INVALID_ASSET_ID
FilePickerType
Supported file types for the centralized file picker modal.
@ Tileset
Future: .tsj tileset files.
@ SubGraph
.ats files in Blueprints
@ Audio
Future: .ogg, .wav files.
@ BehaviorTree
.bt.json files in ./Gamedata