From 81a2bce4d40cc20050e37a34268f512b2bcce37d Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 16 Oct 2022 19:40:14 -0500 Subject: [PATCH] GUI: prepare for multiple asset load --- extern/igfd/ImGuiFileDialog.cpp | 8 +++++++- src/gui/gui.cpp | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/extern/igfd/ImGuiFileDialog.cpp b/extern/igfd/ImGuiFileDialog.cpp index 63ae3b87..328bccb3 100644 --- a/extern/igfd/ImGuiFileDialog.cpp +++ b/extern/igfd/ImGuiFileDialog.cpp @@ -3993,7 +3993,13 @@ namespace IGFD } else { fdi.SelectFileName(prFileDialogInternal, vInfos); if (prFileDialogInternal.puDLGselFun!=NULL) { - prFileDialogInternal.puDLGselFun(GetFilePathName().c_str()); + std::string argPath; + for (auto& i: GetSelection()) { + argPath=i.second; + } + if (!argPath.empty()) { + prFileDialogInternal.puDLGselFun(argPath.c_str()); + } } } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index fc2de66c..3a1931b6 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1759,7 +1759,14 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) { "all files", ".*"}, "compatible files{.fur,.dmf,.mod},another option{.wav,.ttf},.*", workingDirTest, - dpiScale + dpiScale, + [](const char* path) { + if (path!=NULL) { + logI("Callback Result: %s",path); + } else { + logI("Callback Result: NULL"); + } + } ); break; case GUI_FILE_TEST_OPEN_MULTI: @@ -1772,7 +1779,13 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) { "compatible files{.fur,.dmf,.mod},another option{.wav,.ttf},.*", workingDirTest, dpiScale, - NULL, + [](const char* path) { + if (path!=NULL) { + logI("Callback Result: %s",path); + } else { + logI("Callback Result: NULL"); + } + }, true ); break;