Class EditorFileDialog
A modified version of FileDialog used by the editor.
- Inheritance
-
EditorFileDialog
Remarks
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.
Unlike FileDialog, EditorFileDialog does not have a property for using native dialogs. Instead, native dialogs can be enabled globally via the interface/editor/use_native_file_dialogs editor setting. They are also enabled automatically when running in sandbox (e.g. on macOS).
Properties
access
The location from which the user may select a file, including res://
, user://
, and the local file system.
var access : int = 0
Property Value
Remarks
current_dir
The currently occupied directory.
var current_dir : String
Property Value
Remarks
current_file
The currently selected file.
var current_file : String
Property Value
Remarks
current_path
The file system path in the address bar.
var current_path : String
Property Value
Remarks
disable_overwrite_warning
If true
, the EditorFileDialog will not warn the user before overwriting files.
var disable_overwrite_warning : bool = false
Property Value
Remarks
display_mode
The view format in which the EditorFileDialog displays resources to the user.
var display_mode : int = 0
Property Value
Remarks
file_mode
The dialog's open or save mode, which affects the selection behavior. See FileMode.
var file_mode : int = 4
Property Value
Remarks
filters
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.
var filters : PackedStringArray = PackedStringArray()
Property Value
Remarks
- void set_filters(PackedStringArray value)
- PackedStringArray get_filters
option_count
The number of additional OptionButtons and CheckBoxes in the dialog.
var option_count : int = 0
Property Value
Remarks
show_hidden_files
If true
, hidden files and directories will be visible in the EditorFileDialog. This property is synchronized with filesystem/file_dialog/show_hidden_files.
var show_hidden_files : bool = false
Property Value
Remarks
Methods
add_filter(String, String)
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 add_filter(String filter, String description)
Parameters
add_option(String, PackedStringArray, int)
Adds an additional OptionButton to the file dialog. If values
is empty, a CheckBox is added instead.
default_value_index
should be an index of the value in the values
. If values
is empty it should be either 1
(checked), or 0
(unchecked).
void add_option(String name, PackedStringArray values, int default_value_index)
Parameters
name
Stringvalues
PackedStringArraydefault_value_index
int
add_side_menu(Control, String)
Adds the given menu
to the side of the file dialog with the given title
text on top. Only one side menu is allowed.
void add_side_menu(Control menu, String title)
Parameters
clear_filename_filter
Clear the filter for file names.
void clear_filename_filter
clear_filters
Removes all filters except for "All Files (*.*)".
void clear_filters
get_filename_filter
Qualifiers: const
Returns the value of the filter for file names.
String get_filename_filter
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 visible property.
LineEdit get_line_edit
get_option_default(int)
Qualifiers: const
Returns the default value index of the OptionButton or CheckBox with index option
.
int get_option_default(int option)
Parameters
option
int
get_option_name(int)
Qualifiers: const
Returns the name of the OptionButton or CheckBox with index option
.
String get_option_name(int option)
Parameters
option
int
get_option_values(int)
Qualifiers: const
Returns an array of values of the OptionButton with index option
.
PackedStringArray get_option_values(int option)
Parameters
option
int
get_selected_options
Qualifiers: const
Returns a Dictionary with the selected values of the additional OptionButtons and/or CheckBoxes. Dictionary keys are names and values are selected value indices.
Dictionary get_selected_options
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 visible property.
VBoxContainer get_vbox
invalidate
Notify the EditorFileDialog that its view of the data is no longer accurate. Updates the view contents on next view update.
void invalidate
popup_file_dialog
Shows the EditorFileDialog at the default size and position for file dialogs in the editor, and selects the file name if there is a current file.
void popup_file_dialog
set_filename_filter(String)
Sets the value of the filter for file names.
void set_filename_filter(String filter)
Parameters
filter
String
set_option_default(int, int)
Sets the default value index of the OptionButton or CheckBox with index option
.
void set_option_default(int option, int default_value_index)
Parameters
set_option_name(int, String)
Sets the name of the OptionButton or CheckBox with index option
.
void set_option_name(int option, String name)
Parameters
set_option_values(int, PackedStringArray)
Sets the option values of the OptionButton with index option
.
void set_option_values(int option, PackedStringArray values)
Parameters
option
intvalues
PackedStringArray
Events
dir_selected(String)
Emitted when a directory is selected.
signal dir_selected(String dir)
Parameters
dir
String
file_selected(String)
Emitted when a file is selected.
signal file_selected(String path)
Parameters
path
String
filename_filter_changed(String)
Emitted when the filter for file names changes.
signal filename_filter_changed(String filter)
Parameters
filter
String
files_selected(PackedStringArray)
Emitted when multiple files are selected.
signal files_selected(PackedStringArray paths)
Parameters
paths
PackedStringArray