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 ¶
- type Access
- type Advanced
- type Any
- type DisplayMode
- type Expanded
- type Extension
- func (self *Extension[T]) AsAcceptDialog() AcceptDialog.Instance
- func (self *Extension[T]) AsConfirmationDialog() ConfirmationDialog.Instance
- func (self *Extension[T]) AsEditorFileDialog() Instance
- func (self *Extension[T]) AsNode() Node.Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsViewport() Viewport.Instance
- func (self *Extension[T]) AsWindow() Window.Instance
- type FileMode
- type ID
- type Instance
- func (self Instance) Access() Access
- func (self Instance) AddFilter(filter string)
- func (self Instance) AddOption(name string, values []string, default_value_index int)
- func (self Instance) AddSideMenu(menu Control.Instance)
- func (self Instance) AsAcceptDialog() AcceptDialog.Instance
- func (self Instance) AsConfirmationDialog() ConfirmationDialog.Instance
- func (self Instance) AsEditorFileDialog() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsViewport() Viewport.Instance
- func (self Instance) AsWindow() Window.Instance
- func (self Instance) ClearFilenameFilter()
- func (self Instance) ClearFilters()
- func (self Instance) CurrentDir() string
- func (self Instance) CurrentFile() string
- func (self Instance) CurrentPath() string
- func (self Instance) DisableOverwriteWarning() bool
- func (self Instance) DisplayMode() DisplayMode
- func (self Instance) FileMode() FileMode
- func (self Instance) Filters() []string
- func (self Instance) GetFilenameFilter() string
- func (self Instance) GetLineEdit() LineEdit.Instance
- func (self Instance) GetOptionDefault(option int) int
- func (self Instance) GetOptionName(option int) string
- func (self Instance) GetOptionValues(option int) []string
- func (self Instance) GetSelectedOptions() map[string]int
- func (self Instance) GetVbox() VBoxContainer.Instance
- func (self Instance) ID() ID
- func (self Instance) Invalidate()
- func (self Instance) MoreArgs() MoreArgs
- func (self Instance) OnDirSelected(cb func(dir string), flags ...Signal.Flags)
- func (self Instance) OnFileSelected(cb func(path string), flags ...Signal.Flags)
- func (self Instance) OnFilenameFilterChanged(cb func(filter string), flags ...Signal.Flags)
- func (self Instance) OnFilesSelected(cb func(paths []string), flags ...Signal.Flags)
- func (self Instance) OptionCount() int
- func (self Instance) PopupFileDialog()
- func (self Instance) SetAccess(value Access)
- func (self Instance) SetCurrentDir(value string)
- func (self Instance) SetCurrentFile(value string)
- func (self Instance) SetCurrentPath(value string)
- func (self Instance) SetDisableOverwriteWarning(value bool)
- func (self Instance) SetDisplayMode(value DisplayMode)
- func (self Instance) SetFileMode(value FileMode)
- func (self Instance) SetFilenameFilter(filter string)
- func (self Instance) SetFilters(value []string)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOptionCount(value int)
- func (self Instance) SetOptionDefault(option int, default_value_index int)
- func (self Instance) SetOptionName(option int, name string)
- func (self Instance) SetOptionValues(option int, values []string)
- func (self Instance) SetShowHiddenFiles(value bool)
- func (self Instance) ShowHiddenFiles() bool
- func (self Instance) Virtual(name string) reflect.Value
- type MoreArgs
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 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 Extension ¶
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 (*Extension[T]) AsViewport ¶
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 ¶
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.
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 (Instance) Access ¶
The location from which the user may select a file, including res://, user://, and the local file system.
func (Instance) AddFilter ¶
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 ¶
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 ¶
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 (Instance) AsViewport ¶
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 ¶
The currently occupied directory.
func (Instance) CurrentFile ¶
The currently selected file.
func (Instance) CurrentPath ¶
The file system path in the address bar.
func (Instance) DisableOverwriteWarning ¶
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) 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.
func (Instance) GetFilenameFilter ¶
Returns the value of the filter for file names.
func (Instance) 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 CanvasItem.Visible property.
func (Instance) GetOptionDefault ¶
Returns the default value index of the OptionButton or CheckBox with index 'option'.
func (Instance) GetOptionName ¶
Returns the name of the OptionButton or CheckBox with index 'option'.
func (Instance) GetOptionValues ¶
Returns an array of values of the OptionButton with index 'option'.
func (Instance) GetSelectedOptions ¶
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) 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 ¶
MoreArgs enables certain functions to be called with additional 'optional' arguments.
func (Instance) OnDirSelected ¶
Emitted when a directory is selected.
func (Instance) OnFileSelected ¶
Emitted when a file is selected.
func (Instance) OnFilenameFilterChanged ¶
Emitted when the filter for file names changes.
func (Instance) OnFilesSelected ¶
Emitted when multiple files are selected.
func (Instance) OptionCount ¶
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) SetCurrentDir ¶
SetCurrentDir sets the property returned by [GetCurrentDir].
func (Instance) SetCurrentFile ¶
SetCurrentFile sets the property returned by [GetCurrentFile].
func (Instance) SetCurrentPath ¶
SetCurrentPath sets the property returned by [GetCurrentPath].
func (Instance) SetDisableOverwriteWarning ¶
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 ¶
SetFileMode sets the property returned by [GetFileMode].
func (Instance) SetFilenameFilter ¶
Sets the value of the filter for file names.
func (Instance) SetFilters ¶
SetFilters sets the property returned by [GetFilters].
func (Instance) SetOptionCount ¶
SetOptionCount sets the property returned by [GetOptionCount].
func (Instance) SetOptionDefault ¶
Sets the default value index of the OptionButton or CheckBox with index 'option'.
func (Instance) SetOptionName ¶
Sets the name of the OptionButton or CheckBox with index 'option'.
func (Instance) SetOptionValues ¶
Sets the option values of the OptionButton with index 'option'.
func (Instance) SetShowHiddenFiles ¶
SetShowHiddenFiles sets the property returned by [IsShowingHiddenFiles].
func (Instance) 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".
type MoreArgs ¶
type MoreArgs [1]gdclass.EditorFileDialog
MoreArgs is a container for Instance functions with additional 'optional' arguments.
func (MoreArgs) AddFilter ¶
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)".