Class EditorFileDialog
- Namespace
- Godot
- Assembly
- GodotSharpEditor.dll
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.
public class EditorFileDialog : ConfirmationDialog, IDisposable
- Inheritance
-
EditorFileDialog
- Implements
- Inherited Members
Constructors
EditorFileDialog()
public EditorFileDialog()
Properties
Access
The location from which the user may select a file, including res://
, user://
, and the local file system.
public EditorFileDialog.AccessEnum Access { get; set; }
Property Value
CurrentDir
The currently occupied directory.
public string CurrentDir { get; set; }
Property Value
CurrentFile
The currently selected file.
public string CurrentFile { get; set; }
Property Value
CurrentPath
The file system path in the address bar.
public string CurrentPath { get; set; }
Property Value
DisableOverwriteWarning
If true, the EditorFileDialog will not warn the user before overwriting files.
public bool DisableOverwriteWarning { get; set; }
Property Value
DisplayMode
The view format in which the EditorFileDialog displays resources to the user.
public EditorFileDialog.DisplayModeEnum DisplayMode { get; set; }
Property Value
FileMode
The dialog's open or save mode, which affects the selection behavior. See EditorFileDialog.FileModeEnum.
public EditorFileDialog.FileModeEnum FileMode { get; set; }
Property Value
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.
public string[] Filters { get; set; }
Property Value
- string[]
OptionCount
The number of additional OptionButtons and CheckBoxes in the dialog.
public int OptionCount { get; set; }
Property Value
ShowHiddenFiles
If true, hidden files and directories will be visible in the EditorFileDialog. This property is synchronized with EditorSettings.filesystem/file_dialog/show_hidden_files
.
public bool ShowHiddenFiles { get; set; }
Property Value
Methods
AddFilter(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)".
public void AddFilter(string filter, string description = "")
Parameters
AddOption(string, string[], int)
Adds an additional OptionButton to the file dialog. If values
is empty, a CheckBox is added instead.
defaultValueIndex
should be an index of the value in the values
. If values
is empty it should be either 1
(checked), or 0
(unchecked).
public void AddOption(string name, string[] values, int defaultValueIndex)
Parameters
AddSideMenu(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.
public void AddSideMenu(Control menu, string title = "")
Parameters
ClearFilters()
Removes all filters except for "All Files (*)".
public void ClearFilters()
GetLineEdit()
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.
public LineEdit GetLineEdit()
Returns
GetOptionDefault(int)
Returns the default value index of the OptionButton or CheckBox with index option
.
public int GetOptionDefault(int option)
Parameters
option
int
Returns
GetOptionName(int)
Returns the name of the OptionButton or CheckBox with index option
.
public string GetOptionName(int option)
Parameters
option
int
Returns
GetOptionValues(int)
Returns an array of values of the OptionButton with index option
.
public string[] GetOptionValues(int option)
Parameters
option
int
Returns
- string[]
GetSelectedOptions()
Returns a Dictionary with the selected values of the additional OptionButtons and/or CheckBoxes. Dictionary keys are names and values are selected value indices.
public Dictionary GetSelectedOptions()
Returns
GetVBox()
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.
public VBoxContainer GetVBox()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
Invalidate()
Notify the EditorFileDialog that its view of the data is no longer accurate. Updates the view contents on next view update.
public void Invalidate()
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
PopupFileDialog()
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.
public void PopupFileDialog()
SetOptionDefault(int, int)
Sets the default value index of the OptionButton or CheckBox with index option
.
public void SetOptionDefault(int option, int defaultValueIndex)
Parameters
SetOptionName(int, string)
Sets the name of the OptionButton or CheckBox with index option
.
public void SetOptionName(int option, string name)
Parameters
SetOptionValues(int, string[])
Sets the option values of the OptionButton with index option
.
public void SetOptionValues(int option, string[] values)
Parameters
Events
DirSelected
Emitted when a directory is selected.
public event EditorFileDialog.DirSelectedEventHandler DirSelected
Event Type
FileSelected
Emitted when a file is selected.
public event EditorFileDialog.FileSelectedEventHandler FileSelected
Event Type
FilesSelected
Emitted when multiple files are selected.
public event EditorFileDialog.FilesSelectedEventHandler FilesSelected