mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Make EditorFileDialog inherit FileDialog
This commit is contained in:
@@ -1,36 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="EditorFileDialog" inherits="ConfirmationDialog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<class name="EditorFileDialog" inherits="FileDialog" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
|
||||
<brief_description>
|
||||
A modified version of [FileDialog] used by the editor.
|
||||
</brief_description>
|
||||
<description>
|
||||
[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 [member EditorSettings.interface/editor/use_native_file_dialogs] editor setting. They are also enabled automatically when running in sandbox (e.g. on macOS).
|
||||
[EditorFileDialog] is a [FileDialog] tweaked to work in the editor. It automatically handles favorite and recent directory lists, and synchronizes some properties with their corresponding editor settings.
|
||||
[EditorFileDialog] will automatically show a native dialog based on the [member EditorSettings.interface/editor/use_native_file_dialogs] editor setting and ignores [member FileDialog.use_native_dialog].
|
||||
[b]Note:[/b] [EditorFileDialog] is invisible by default. To make it visible, call one of the [code]popup_*[/code] methods from [Window] on the node, such as [method Window.popup_centered_clamped].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
<methods>
|
||||
<method name="add_filter">
|
||||
<return type="void" />
|
||||
<param index="0" name="filter" type="String" />
|
||||
<param index="1" name="description" type="String" default="""" />
|
||||
<description>
|
||||
Adds a comma-separated file name [param filter] option to the [EditorFileDialog] with an optional [param description], which restricts what files can be picked.
|
||||
A [param filter] should be of the form [code]"filename.extension"[/code], where filename and extension can be [code]*[/code] to match any string. Filters starting with [code].[/code] (i.e. empty filenames) are not allowed.
|
||||
For example, a [param filter] of [code]"*.tscn, *.scn"[/code] and a [param description] of [code]"Scenes"[/code] results in filter text "Scenes (*.tscn, *.scn)".
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_option">
|
||||
<return type="void" />
|
||||
<param index="0" name="name" type="String" />
|
||||
<param index="1" name="values" type="PackedStringArray" />
|
||||
<param index="2" name="default_value_index" type="int" />
|
||||
<description>
|
||||
Adds an additional [OptionButton] to the file dialog. If [param values] is empty, a [CheckBox] is added instead.
|
||||
[param default_value_index] should be an index of the value in the [param values]. If [param values] is empty it should be either [code]1[/code] (checked), or [code]0[/code] (unchecked).
|
||||
</description>
|
||||
</method>
|
||||
<method name="add_side_menu" deprecated="This feature is no longer supported.">
|
||||
<return type="void" />
|
||||
<param index="0" name="menu" type="Control" />
|
||||
@@ -39,199 +19,10 @@
|
||||
This method is kept for compatibility and does nothing. As an alternative, you can display another dialog after showing the file dialog.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_filename_filter">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Clear the filter for file names.
|
||||
</description>
|
||||
</method>
|
||||
<method name="clear_filters">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Removes all filters except for "All Files (*.*)".
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_filename_filter" qualifiers="const">
|
||||
<return type="String" />
|
||||
<description>
|
||||
Returns the value of the filter for file names.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_line_edit">
|
||||
<return type="LineEdit" />
|
||||
<description>
|
||||
Returns the LineEdit for the selected file.
|
||||
[b]Warning:[/b] 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 [member CanvasItem.visible] property.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_option_default" qualifiers="const">
|
||||
<return type="int" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<description>
|
||||
Returns the default value index of the [OptionButton] or [CheckBox] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_option_name" qualifiers="const">
|
||||
<return type="String" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<description>
|
||||
Returns the name of the [OptionButton] or [CheckBox] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_option_values" qualifiers="const">
|
||||
<return type="PackedStringArray" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<description>
|
||||
Returns an array of values of the [OptionButton] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_selected_options" qualifiers="const">
|
||||
<return type="Dictionary" />
|
||||
<description>
|
||||
Returns a [Dictionary] with the selected values of the additional [OptionButton]s and/or [CheckBox]es. [Dictionary] keys are names and values are selected value indices.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_vbox">
|
||||
<return type="VBoxContainer" />
|
||||
<description>
|
||||
Returns the [VBoxContainer] used to display the file system.
|
||||
[b]Warning:[/b] 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 [member CanvasItem.visible] property.
|
||||
</description>
|
||||
</method>
|
||||
<method name="invalidate">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Notify the [EditorFileDialog] that its view of the data is no longer accurate. Updates the view contents on next view update.
|
||||
</description>
|
||||
</method>
|
||||
<method name="popup_file_dialog">
|
||||
<return type="void" />
|
||||
<description>
|
||||
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.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_filename_filter">
|
||||
<return type="void" />
|
||||
<param index="0" name="filter" type="String" />
|
||||
<description>
|
||||
Sets the value of the filter for file names.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_option_default">
|
||||
<return type="void" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<param index="1" name="default_value_index" type="int" />
|
||||
<description>
|
||||
Sets the default value index of the [OptionButton] or [CheckBox] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_option_name">
|
||||
<return type="void" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<param index="1" name="name" type="String" />
|
||||
<description>
|
||||
Sets the name of the [OptionButton] or [CheckBox] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_option_values">
|
||||
<return type="void" />
|
||||
<param index="0" name="option" type="int" />
|
||||
<param index="1" name="values" type="PackedStringArray" />
|
||||
<description>
|
||||
Sets the option values of the [OptionButton] with index [param option].
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="access" type="int" setter="set_access" getter="get_access" enum="EditorFileDialog.Access" default="0">
|
||||
The location from which the user may select a file, including [code]res://[/code], [code]user://[/code], and the local file system.
|
||||
</member>
|
||||
<member name="current_dir" type="String" setter="set_current_dir" getter="get_current_dir">
|
||||
The currently occupied directory.
|
||||
</member>
|
||||
<member name="current_file" type="String" setter="set_current_file" getter="get_current_file">
|
||||
The currently selected file.
|
||||
</member>
|
||||
<member name="current_path" type="String" setter="set_current_path" getter="get_current_path">
|
||||
The file system path in the address bar.
|
||||
</member>
|
||||
<member name="dialog_hide_on_ok" type="bool" setter="set_hide_on_ok" getter="get_hide_on_ok" overrides="AcceptDialog" default="false" />
|
||||
<member name="disable_overwrite_warning" type="bool" setter="set_disable_overwrite_warning" getter="is_overwrite_warning_disabled" default="false">
|
||||
<member name="disable_overwrite_warning" type="bool" setter="set_disable_overwrite_warning" getter="is_overwrite_warning_disabled" default="false" deprecated="Use [member FileDialog.overwrite_warning_enabled] instead.">
|
||||
If [code]true[/code], the [EditorFileDialog] will not warn the user before overwriting files.
|
||||
</member>
|
||||
<member name="display_mode" type="int" setter="set_display_mode" getter="get_display_mode" enum="EditorFileDialog.DisplayMode" default="0">
|
||||
The view format in which the [EditorFileDialog] displays resources to the user.
|
||||
</member>
|
||||
<member name="file_mode" type="int" setter="set_file_mode" getter="get_file_mode" enum="EditorFileDialog.FileMode" default="4">
|
||||
The dialog's open or save mode, which affects the selection behavior.
|
||||
</member>
|
||||
<member name="filters" type="PackedStringArray" setter="set_filters" getter="get_filters" default="PackedStringArray()">
|
||||
The available file type filters. For example, this shows only [code].png[/code] and [code].gd[/code] files: [code]set_filters(PackedStringArray(["*.png ; PNG Images","*.gd ; GDScript Files"]))[/code]. Multiple file types can also be specified in a single filter. [code]"*.png, *.jpg, *.jpeg ; Supported Images"[/code] will show both PNG and JPEG files when selected.
|
||||
</member>
|
||||
<member name="option_count" type="int" setter="set_option_count" getter="get_option_count" default="0">
|
||||
The number of additional [OptionButton]s and [CheckBox]es in the dialog.
|
||||
</member>
|
||||
<member name="show_hidden_files" type="bool" setter="set_show_hidden_files" getter="is_showing_hidden_files" default="false">
|
||||
If [code]true[/code], hidden files and directories will be visible in the [EditorFileDialog]. This property is synchronized with [member EditorSettings.filesystem/file_dialog/show_hidden_files].
|
||||
</member>
|
||||
<member name="title" type="String" setter="set_title" getter="get_title" overrides="Window" default=""Save a File"" />
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="dir_selected">
|
||||
<param index="0" name="dir" type="String" />
|
||||
<description>
|
||||
Emitted when a directory is selected.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="file_selected">
|
||||
<param index="0" name="path" type="String" />
|
||||
<description>
|
||||
Emitted when a file is selected.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="filename_filter_changed">
|
||||
<param index="0" name="filter" type="String" />
|
||||
<description>
|
||||
Emitted when the filter for file names changes.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="files_selected">
|
||||
<param index="0" name="paths" type="PackedStringArray" />
|
||||
<description>
|
||||
Emitted when multiple files are selected.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
<constants>
|
||||
<constant name="FILE_MODE_OPEN_FILE" value="0" enum="FileMode">
|
||||
The [EditorFileDialog] can select only one file. Accepting the window will open the file.
|
||||
</constant>
|
||||
<constant name="FILE_MODE_OPEN_FILES" value="1" enum="FileMode">
|
||||
The [EditorFileDialog] can select multiple files. Accepting the window will open all files.
|
||||
</constant>
|
||||
<constant name="FILE_MODE_OPEN_DIR" value="2" enum="FileMode">
|
||||
The [EditorFileDialog] can select only one directory. Accepting the window will open the directory.
|
||||
</constant>
|
||||
<constant name="FILE_MODE_OPEN_ANY" value="3" enum="FileMode">
|
||||
The [EditorFileDialog] can select a file or directory. Accepting the window will open it.
|
||||
</constant>
|
||||
<constant name="FILE_MODE_SAVE_FILE" value="4" enum="FileMode">
|
||||
The [EditorFileDialog] can select only one file. Accepting the window will save the file.
|
||||
</constant>
|
||||
<constant name="ACCESS_RESOURCES" value="0" enum="Access">
|
||||
The [EditorFileDialog] can only view [code]res://[/code] directory contents.
|
||||
</constant>
|
||||
<constant name="ACCESS_USERDATA" value="1" enum="Access">
|
||||
The [EditorFileDialog] can only view [code]user://[/code] directory contents.
|
||||
</constant>
|
||||
<constant name="ACCESS_FILESYSTEM" value="2" enum="Access">
|
||||
The [EditorFileDialog] can view the entire local file system.
|
||||
</constant>
|
||||
<constant name="DISPLAY_THUMBNAILS" value="0" enum="DisplayMode">
|
||||
The [EditorFileDialog] displays resources as thumbnails.
|
||||
</constant>
|
||||
<constant name="DISPLAY_LIST" value="1" enum="DisplayMode">
|
||||
The [EditorFileDialog] displays resources as a list of filenames.
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
||||
@@ -118,6 +118,12 @@
|
||||
Returns [code]true[/code] if the provided [param flag] is enabled.
|
||||
</description>
|
||||
</method>
|
||||
<method name="popup_file_dialog">
|
||||
<return type="void" />
|
||||
<description>
|
||||
Shows the [FileDialog] using the default size and position for file dialogs, and selects the file name if there is a current file.
|
||||
</description>
|
||||
</method>
|
||||
<method name="set_customization_flag_enabled">
|
||||
<return type="void" />
|
||||
<param index="0" name="flag" type="int" enum="FileDialog.Customization" />
|
||||
@@ -274,6 +280,7 @@
|
||||
[b]Note:[/b] On Linux and macOS, sandboxed apps always use native dialogs to access the host file system.
|
||||
[b]Note:[/b] On macOS, sandboxed apps will save security-scoped bookmarks to retain access to the opened folders across multiple sessions. Use [method OS.get_granted_permissions] to get a list of saved bookmarks.
|
||||
[b]Note:[/b] Native dialogs are isolated from the base process, file dialog properties can't be modified once the dialog is shown.
|
||||
[b]Note:[/b] This property is ignored in [EditorFileDialog].
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
|
||||
Reference in New Issue
Block a user