File dialog

class editor_fileDialog

File dialog module

bool openFile(function callbackFn, string filenameSuffix, bool selectFolder, string defaultPath = "/")

Open a windows to open a file or folder

Parameters:
  • callbackFn – Callback funtion, see editor_fileDialog::callbackFn()
  • filenameSuffix – Filename suffix (eg: {{"Any files", "*"},{"Images",{".png", ".dds", ".jpg"}},{"DDS Files",".dds"}})
  • selectFolder – Select a folder or a file
  • defaultPath – Default path the dialog will open with
  • withPreview – Display a preview of the selected file within the file dialog window
bool saveFile(function callbackFn, string filenameSuffix, bool selectFolder, string defaultPath = "/")

Open a windows to save a file or folder

Parameters:
  • callbackFn – Callback funtion, see editor_fileDialog::callbackFn()
  • filenameSuffix – Filename suffix (eg: {{"Any files", "*"},{"Material file",".materials.json"}})
  • selectFolder – Select a folder or a file
  • defaultPath – Default path the dialog will open with
void callbackFn(table data)
Warning:This function doesn’t exist in the module, it is an example of which type of function you need to use as a callback for editor_fileDialog::openFile() or editor_fileDialog::saveFile()

Function called when the user intereacted with the file dialog

Parameters:data

A table with data about the file or folder selected

Index name Avaibility Type Example
action Any Action string save or open
path Any Action string \art\
filename if selectFolder is false string test42.dae
filepath if selectFolder is false string \art\test42.dae
stat if action is open table same as BNGBase::FS::IFileSystem::stat()
filestat if action is save string overwrite or new
filetype if action is open table {"DDS Files",".dds"}