Table of Contents

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

int

Remarks

  • void set_access(int value)
  • int get_access

current_dir

The currently occupied directory.

var current_dir : String

Property Value

String

Remarks

current_file

The currently selected file.

var current_file : String

Property Value

String

Remarks

  • void set_current_file(String value)
  • String get_current_file

current_path

The file system path in the address bar.

var current_path : String

Property Value

String

Remarks

  • void set_current_path(String value)
  • String get_current_path

disable_overwrite_warning

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

var disable_overwrite_warning : bool = false

Property Value

bool

Remarks

  • void set_disable_overwrite_warning(bool value)
  • bool is_overwrite_warning_disabled

display_mode

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

var display_mode : int = 0

Property Value

int

Remarks

  • void set_display_mode(int value)
  • int get_display_mode

file_mode

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

var file_mode : int = 4

Property Value

int

Remarks

  • void set_file_mode(int value)
  • int get_file_mode

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

PackedStringArray

Remarks

option_count

The number of additional OptionButtons and CheckBoxes in the dialog.

var option_count : int = 0

Property Value

int

Remarks

  • void set_option_count(int value)
  • int get_option_count

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

bool

Remarks

  • void set_show_hidden_files(bool value)
  • bool is_showing_hidden_files

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

filter String
description String

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 String
values PackedStringArray
default_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

menu Control
title String

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

option int
default_value_index int

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

option int
name String

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 int
values 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