EditorFileDialog

Inherits: ConfirmationDialog < AcceptDialog < Window < Viewport < Node < Object

A modified version of FileDialog used by the editor.

Description

EditorFileDialog is an enhanced version of FileDialog available only to editor plugins. Additional features include list of favorited/recent files and the ability to see files as thumbnails grid instead of list.

Properties

Access

access

0

String

current_dir

String

current_file

String

current_path

bool

dialog_hide_on_ok

false (overrides AcceptDialog)

bool

disable_overwrite_warning

false

DisplayMode

display_mode

0

FileMode

file_mode

4

PackedStringArray

filters

PackedStringArray()

bool

show_hidden_files

false

String

title

"Save a File" (overrides Window)

Methods

void

add_filter ( String filter, String description="" )

void

clear_filters ( )

LineEdit

get_line_edit ( )

VBoxContainer

get_vbox ( )

void

invalidate ( )


Signals

dir_selected ( String dir )

Emitted when a directory is selected.


file_selected ( String path )

Emitted when a file is selected.


files_selected ( PackedStringArray paths )

Emitted when multiple files are selected.


Enumerations

enum FileMode:

FileMode FILE_MODE_OPEN_FILE = 0

The EditorFileDialog can select only one file. Accepting the window will open the file.

FileMode FILE_MODE_OPEN_FILES = 1

The EditorFileDialog can select multiple files. Accepting the window will open all files.

FileMode FILE_MODE_OPEN_DIR = 2

The EditorFileDialog can select only one directory. Accepting the window will open the directory.

FileMode FILE_MODE_OPEN_ANY = 3

The EditorFileDialog can select a file or directory. Accepting the window will open it.

FileMode FILE_MODE_SAVE_FILE = 4

The EditorFileDialog can select only one file. Accepting the window will save the file.


enum Access:

Access ACCESS_RESOURCES = 0

The EditorFileDialog can only view res:// directory contents.

Access ACCESS_USERDATA = 1

The EditorFileDialog can only view user:// directory contents.

Access ACCESS_FILESYSTEM = 2

The EditorFileDialog can view the entire local file system.


enum DisplayMode:

DisplayMode DISPLAY_THUMBNAILS = 0

The EditorFileDialog displays resources as thumbnails.

DisplayMode DISPLAY_LIST = 1

The EditorFileDialog displays resources as a list of filenames.


Property Descriptions

Access access = 0

The location from which the user may select a file, including res://, user://, and the local file system.


String current_dir

  • void set_current_dir ( String value )

  • String get_current_dir ( )

The currently occupied directory.


String current_file

  • void set_current_file ( String value )

  • String get_current_file ( )

The currently selected file.


String current_path

  • void set_current_path ( String value )

  • String get_current_path ( )

The file system path in the address bar.


bool disable_overwrite_warning = false

  • void set_disable_overwrite_warning ( bool value )

  • bool is_overwrite_warning_disabled ( )

If true, the EditorFileDialog will not warn the user before overwriting files.


DisplayMode display_mode = 0

The view format in which the EditorFileDialog displays resources to the user.


FileMode file_mode = 4

The dialog's open or save mode, which affects the selection behavior. See FileMode.


PackedStringArray filters = PackedStringArray()

The available file type filters. For example, this shows only .png and .gd files: set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"])). Multiple file types can also be specified in a single filter. "*.png, *.jpg, *.jpeg ; Supported Images" will show both PNG and JPEG files when selected.


bool show_hidden_files = false

  • void set_show_hidden_files ( bool value )

  • bool is_showing_hidden_files ( )

If true, hidden files and directories will be visible in the EditorFileDialog. This property is synchronized with EditorSettings.filesystem/file_dialog/show_hidden_files.


Method Descriptions

void add_filter ( String filter, String description="" )

Adds a comma-delimited file name filter option to the EditorFileDialog with an optional description, which restricts what files can be picked.

A filter should be of the form "filename.extension", where filename and extension can be * to match any string. Filters starting with . (i.e. empty filenames) are not allowed.

For example, a filter of "*.tscn, *.scn" and a description of "Scenes" results in filter text "Scenes (*.tscn, *.scn)".


void clear_filters ( )

Removes all filters except for "All Files (*)".


LineEdit get_line_edit ( )

Returns the LineEdit for the selected file.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.


VBoxContainer get_vbox ( )

Returns the VBoxContainer used to display the file system.

Warning: This is a required internal node, removing and freeing it may cause a crash. If you wish to hide it or any of its children, use their CanvasItem.visible property.


void invalidate ( )

Notify the EditorFileDialog that its view of the data is no longer accurate. Updates the view contents on next view update.