EditorFileDialog

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

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 EditorSettings "interface/editor/use_native_file_dialogs" editor setting. They are also enabled automatically when running in sandbox (e.g. on macOS).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access int //gd:EditorFileDialog.Access
const (
	// The [EditorFileDialog] can only view res:// directory contents.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	AccessResources Access = 0
	// The [EditorFileDialog] can only view user:// directory contents.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	AccessUserdata Access = 1
	// The [EditorFileDialog] can view the entire local file system.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	AccessFilesystem Access = 2
)

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsEditorFileDialog() Instance
}

type DisplayMode

type DisplayMode int //gd:EditorFileDialog.DisplayMode
const (
	// The [EditorFileDialog] displays resources as thumbnails.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	DisplayThumbnails DisplayMode = 0
	// The [EditorFileDialog] displays resources as a list of filenames.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	DisplayList DisplayMode = 1
)

type Expanded

type Expanded = MoreArgs

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsAcceptDialog

func (self *Extension[T]) AsAcceptDialog() AcceptDialog.Instance

func (*Extension[T]) AsConfirmationDialog

func (self *Extension[T]) AsConfirmationDialog() ConfirmationDialog.Instance

func (*Extension[T]) AsEditorFileDialog

func (self *Extension[T]) AsEditorFileDialog() Instance

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsViewport

func (self *Extension[T]) AsViewport() Viewport.Instance

func (*Extension[T]) AsWindow

func (self *Extension[T]) AsWindow() Window.Instance

type FileMode

type FileMode int //gd:EditorFileDialog.FileMode
const (
	// The [EditorFileDialog] can select only one file. Accepting the window will open the file.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	FileModeOpenFile FileMode = 0
	// The [EditorFileDialog] can select multiple files. Accepting the window will open all files.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	FileModeOpenFiles FileMode = 1
	// The [EditorFileDialog] can select only one directory. Accepting the window will open the directory.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	FileModeOpenDir FileMode = 2
	// The [EditorFileDialog] can select a file or directory. Accepting the window will open it.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	FileModeOpenAny FileMode = 3
	// The [EditorFileDialog] can select only one file. Accepting the window will save the file.
	//
	// [EditorFileDialog]: https://pkg.go.dev/graphics.gd/classdb/EditorFileDialog
	FileModeSaveFile FileMode = 4
)

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.EditorFileDialog

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) Access

func (self Instance) Access() Access

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

func (Instance) AddFilter

func (self Instance) AddFilter(filter string)

Adds a comma-separated 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)".

func (Instance) AddOption

func (self Instance) AddOption(name string, values []string, default_value_index 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).

func (Instance) AddSideMenu

func (self Instance) AddSideMenu(menu Control.Instance)

Adds the given 'menu' to the side of the file dialog with the given 'title' text on top. Only one side menu is allowed.

func (Instance) AsAcceptDialog

func (self Instance) AsAcceptDialog() AcceptDialog.Instance

func (Instance) AsConfirmationDialog

func (self Instance) AsConfirmationDialog() ConfirmationDialog.Instance

func (Instance) AsEditorFileDialog

func (self Instance) AsEditorFileDialog() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsViewport

func (self Instance) AsViewport() Viewport.Instance

func (Instance) AsWindow

func (self Instance) AsWindow() Window.Instance

func (Instance) ClearFilenameFilter

func (self Instance) ClearFilenameFilter()

Clear the filter for file names.

func (Instance) ClearFilters

func (self Instance) ClearFilters()

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

func (Instance) CurrentDir

func (self Instance) CurrentDir() string

The currently occupied directory.

func (Instance) CurrentFile

func (self Instance) CurrentFile() string

The currently selected file.

func (Instance) CurrentPath

func (self Instance) CurrentPath() string

The file system path in the address bar.

func (Instance) DisableOverwriteWarning

func (self Instance) DisableOverwriteWarning() bool

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

func (Instance) DisplayMode

func (self Instance) DisplayMode() DisplayMode

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

func (Instance) FileMode

func (self Instance) FileMode() FileMode

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

func (Instance) Filters

func (self Instance) Filters() []string

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.

func (Instance) GetFilenameFilter

func (self Instance) GetFilenameFilter() string

Returns the value of the filter for file names.

func (Instance) GetLineEdit

func (self Instance) GetLineEdit() LineEdit.Instance

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.

func (Instance) GetOptionDefault

func (self Instance) GetOptionDefault(option int) int

Returns the default value index of the OptionButton or CheckBox with index 'option'.

func (Instance) GetOptionName

func (self Instance) GetOptionName(option int) string

Returns the name of the OptionButton or CheckBox with index 'option'.

func (Instance) GetOptionValues

func (self Instance) GetOptionValues(option int) []string

Returns an array of values of the OptionButton with index 'option'.

func (Instance) GetSelectedOptions

func (self Instance) GetSelectedOptions() map[string]int

Returns a data structure with the selected values of the additional OptionButtons and/or CheckBoxes. data structure keys are names and values are selected value indices.

func (Instance) GetVbox

func (self Instance) GetVbox() VBoxContainer.Instance

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.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) Invalidate

func (self Instance) Invalidate()

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

func (Instance) MoreArgs

func (self Instance) MoreArgs() MoreArgs

MoreArgs enables certain functions to be called with additional 'optional' arguments.

func (Instance) OnDirSelected

func (self Instance) OnDirSelected(cb func(dir string), flags ...Signal.Flags)

Emitted when a directory is selected.

func (Instance) OnFileSelected

func (self Instance) OnFileSelected(cb func(path string), flags ...Signal.Flags)

Emitted when a file is selected.

func (Instance) OnFilenameFilterChanged

func (self Instance) OnFilenameFilterChanged(cb func(filter string), flags ...Signal.Flags)

Emitted when the filter for file names changes.

func (Instance) OnFilesSelected

func (self Instance) OnFilesSelected(cb func(paths []string), flags ...Signal.Flags)

Emitted when multiple files are selected.

func (Instance) OptionCount

func (self Instance) OptionCount() int

The number of additional OptionButtons and CheckBoxes in the dialog.

func (Instance) PopupFileDialog

func (self Instance) 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.

func (Instance) SetAccess

func (self Instance) SetAccess(value Access)

SetAccess sets the property returned by [GetAccess].

func (Instance) SetCurrentDir

func (self Instance) SetCurrentDir(value string)

SetCurrentDir sets the property returned by [GetCurrentDir].

func (Instance) SetCurrentFile

func (self Instance) SetCurrentFile(value string)

SetCurrentFile sets the property returned by [GetCurrentFile].

func (Instance) SetCurrentPath

func (self Instance) SetCurrentPath(value string)

SetCurrentPath sets the property returned by [GetCurrentPath].

func (Instance) SetDisableOverwriteWarning

func (self Instance) SetDisableOverwriteWarning(value bool)

SetDisableOverwriteWarning sets the property returned by [IsOverwriteWarningDisabled].

func (Instance) SetDisplayMode

func (self Instance) SetDisplayMode(value DisplayMode)

SetDisplayMode sets the property returned by [GetDisplayMode].

func (Instance) SetFileMode

func (self Instance) SetFileMode(value FileMode)

SetFileMode sets the property returned by [GetFileMode].

func (Instance) SetFilenameFilter

func (self Instance) SetFilenameFilter(filter string)

Sets the value of the filter for file names.

func (Instance) SetFilters

func (self Instance) SetFilters(value []string)

SetFilters sets the property returned by [GetFilters].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetOptionCount

func (self Instance) SetOptionCount(value int)

SetOptionCount sets the property returned by [GetOptionCount].

func (Instance) SetOptionDefault

func (self Instance) SetOptionDefault(option int, default_value_index int)

Sets the default value index of the OptionButton or CheckBox with index 'option'.

func (Instance) SetOptionName

func (self Instance) SetOptionName(option int, name string)

Sets the name of the OptionButton or CheckBox with index 'option'.

func (Instance) SetOptionValues

func (self Instance) SetOptionValues(option int, values []string)

Sets the option values of the OptionButton with index 'option'.

func (Instance) SetShowHiddenFiles

func (self Instance) SetShowHiddenFiles(value bool)

SetShowHiddenFiles sets the property returned by [IsShowingHiddenFiles].

func (Instance) ShowHiddenFiles

func (self Instance) ShowHiddenFiles() bool

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

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MoreArgs

type MoreArgs [1]gdclass.EditorFileDialog

MoreArgs is a container for Instance functions with additional 'optional' arguments.

func (MoreArgs) AddFilter

func (self MoreArgs) AddFilter(filter string, description string)

Adds a comma-separated 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)".

func (MoreArgs) AddSideMenu

func (self MoreArgs) AddSideMenu(menu Control.Instance, title 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL