9#include "../../third_party/imgui/imgui.h"
10#include "../../system/system_consts.h"
11#include "../../system/system_utils.h"
96 ImGui::SetNextWindowSizeConstraints(
ImVec2(600.0f, 400.0f),
ImVec2(1400.0f, 900.0f));
110 ImGui::TextDisabled(
"Path:");
112 ImGui::SetNextItemWidth(-100.0f);
120 if (ImGui::Button(
"Refresh##refresh",
ImVec2(90, 0)))
131 ImGui::BeginChild(
"##file_browser",
ImVec2(0, 250),
true);
136 ImGui::TextDisabled(
"Folders:");
139 if (ImGui::Selectable(
"..",
false))
158 ImGui::BeginChild(
"##files",
ImVec2(0, -1),
true);
159 ImGui::TextDisabled(
"Available Files:");
204 return "./Gamedata/Prefabs";
206 return "./Gamedata/Audio";
234 return "Save BehaviorTree As##save_bt";
236 return "Save Blueprint As##save_ats";
238 return "Save Entity Prefab As##save_pref";
240 return "Save Audio As##save_audio";
242 return "Save File As##save_file";
251 return "Save your BehaviorTree with a new name";
253 return "Save your Blueprint with a new name";
255 return "Save your Entity Prefab with a new name";
257 return "Save your audio file with a new name";
259 return "Save your file with a new name";
377 ImGui::TextDisabled(
"(no files found)");
396 ImGui::TextDisabled(
"Filename:");
398 ImGui::SetNextItemWidth(-1.0f);
402 ImGui::TextDisabled(
"Full path: %s/%s%s",
414 if (ImGui::Button(
"Save##save",
ImVec2(120, 0)))
432 ImGui::CloseCurrentPopup();
433 SYSTEM_LOG <<
"[SaveFilePickerModal] File save confirmed: " << fullPath <<
"\n";
439 ImGui::BeginDisabled();
440 ImGui::Button(
"Save##save",
ImVec2(120, 0));
441 ImGui::EndDisabled();
446 if (ImGui::Button(
"Cancel##cancel",
ImVec2(120, 0)))
451 ImGui::CloseCurrentPopup();
457 std::ifstream
file(path);
468 ImGui::Text(
"File already exists. Overwrite?");
472 if (ImGui::Button(
"Yes, Overwrite##yes",
ImVec2(120, 0)))
477 ImGui::CloseCurrentPopup();
483 if (ImGui::Button(
"No, Cancel##no",
ImVec2(120, 0)))
487 ImGui::CloseCurrentPopup();
494 ImGui::OpenPopup(
"Overwrite File?");
ComponentTypeID GetComponentTypeID_Static()
Centralized Save As modal for all file save operations (Phase 40 Enhancement).
SaveFilePickerModal(SaveFileType fileType)
Constructs a save file picker modal for the given file type.
void Close()
Closes the modal without confirming changes.
void RenderActionButtons()
Renders action buttons (Save/Cancel).
void RenderFolderList()
Renders folder navigation.
std::string GetModalTitle() const
Returns a description of this file type for the modal title.
std::string GetDefaultDirectory() const
Returns the default directory for this file type.
std::vector< std::string > m_fileList
Files in current directory.
bool m_showOverwriteConfirm
Show overwrite confirmation dialog.
std::string GetDescriptionText() const
Returns user-friendly description text.
std::string m_currentPath
Current directory.
void RefreshFileList()
Refreshes the file and folder lists for the current directory.
void Open(const std::string &directory, const std::string &suggestedFilename="")
Opens the modal with initial directory and filename.
std::vector< std::string > m_folderList
Folders in current directory.
void RenderOverwriteConfirmation()
Renders the overwrite confirmation dialog.
char m_pathBuffer[512]
Path input text buffer.
SaveFileType m_fileType
Type of file to save.
void RenderFileList()
Renders the file list in the modal.
char m_filenameBuffer[256]
Filename input (without extension)
std::string m_selectedFile
Full path with extension.
bool m_confirmed
Did user click Save.
void Render()
Renders the modal UI.
void RenderFilenameInput()
Renders filename input and extension display.
std::string GetFileExtension() const
Returns the file extension for this file type (e.g., ".bt.json").
bool m_isOpen
Is modal currently visible.
bool FileExists(const std::string &path) const
Checks if a file exists at the given path.
< Provides AssetID and INVALID_ASSET_ID
SaveFileType
Supported file types for the centralized save modal.
@ EntityPrefab
.pref.json files (Entity Prefab)
@ Audio
.ogg files (audio assets)
@ Blueprint
.ats files (SubGraph/VisualScript)
@ BehaviorTree
.bt.json files