Crate bevy_file_dialog

Source
Expand description

Bevy plugin that allows you to save and load files with file dialogs.

In order to use it you need to add FileDialogPlugin to your App with at least one or more calls to:

these functions can be called as many times as you want, the type parameter acts as marker that allows you to call:

with same type marker and then receive the result in

events

FileDialog can be created by calling FileDialogExt::dialog, FileDialogExt as an extension trait implemented for Commands and is included in bevy_file_dialog::prelude:

fn system(mut commands: Commands) {
    commands
        .dialog()
        .set_directory("/")
        .set_title("My Save Dialog")
        .add_filter("Text", &["txt"])
        .save_file::<MySaveDialog>();
}

When you load multiple files at once with FileDialog::load_multiple_files, you receive them each as separate event in EventReader<DialogFileLoaded<T>> but they are sent as a batch, meaning you get them all at once.

The same thing applies to FileDialog::pick_multiple_directory_paths and EventReader<DialogDirectoryPicked<T>> and also FileDialog::pick_multiple_file_paths and EventReader<DialogFilePicked<T>>

If you want to be compatible with wasm, do not use any of the pick_ apis, they are only for native platforms.

Modules§

prelude
Prelude containing all types you need for saving/loading files with dialogs.

Structs§

DialogDirectoryPickCanceled
Event that gets sent when user closes pick directory dialog without picking any directory.
DialogDirectoryPicked
Event that gets sent when directory path gets selected from file system.
DialogFileLoadCanceled
Event that gets sent when user closes file load dialog without picking any file.
DialogFileLoaded
Event that gets sent when file contents get loaded from file system.
DialogFilePickCanceled
Event that gets sent when user closes pick file dialog without picking any file.
DialogFilePicked
Event that gets sent when file path gets selected from file system.
DialogFileSaveCanceled
Event that gets sent when user closes file save dialog without saving any file.
DialogFileSaved
Event that gets sent when file contents get saved to file system.
FileDialog
File dialog for saving/loading files. You can further customize what can be saved/loaded and the initial state of dialog with its functions.
FileDialogPlugin
Add this plugin to Bevy App to use the FileDialog resource in your system to save/load files.

Traits§

FileDialogExt
Extension trait for Commands that allow you to create dialogs.
LoadContents
Marker trait saying that data can be loaded from file.
PickDirectoryPath
Marker trait saying what directory path are we picking.
PickFilePath
Marker trait saying what file path are we picking.
SaveContents
Marker trait saying that data can be saved to file.