class_editorfiledialog.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/doc/classes/EditorFileDialog.xml.
  6. .. _class_EditorFileDialog:
  7. EditorFileDialog
  8. ================
  9. **Inherits:** :ref:`ConfirmationDialog<class_ConfirmationDialog>` **<** :ref:`AcceptDialog<class_AcceptDialog>` **<** :ref:`Window<class_Window>` **<** :ref:`Viewport<class_Viewport>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A modified version of :ref:`FileDialog<class_FileDialog>` used by the editor.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **EditorFileDialog** is an enhanced version of :ref:`FileDialog<class_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.
  15. .. rst-class:: classref-reftable-group
  16. Properties
  17. ----------
  18. .. table::
  19. :widths: auto
  20. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  21. | :ref:`Access<enum_EditorFileDialog_Access>` | :ref:`access<class_EditorFileDialog_property_access>` | ``0`` |
  22. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  23. | :ref:`String<class_String>` | :ref:`current_dir<class_EditorFileDialog_property_current_dir>` | |
  24. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  25. | :ref:`String<class_String>` | :ref:`current_file<class_EditorFileDialog_property_current_file>` | |
  26. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  27. | :ref:`String<class_String>` | :ref:`current_path<class_EditorFileDialog_property_current_path>` | |
  28. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | dialog_hide_on_ok | ``false`` (overrides :ref:`AcceptDialog<class_AcceptDialog_property_dialog_hide_on_ok>`) |
  30. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`disable_overwrite_warning<class_EditorFileDialog_property_disable_overwrite_warning>` | ``false`` |
  32. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  33. | :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` | :ref:`display_mode<class_EditorFileDialog_property_display_mode>` | ``0`` |
  34. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  35. | :ref:`FileMode<enum_EditorFileDialog_FileMode>` | :ref:`file_mode<class_EditorFileDialog_property_file_mode>` | ``4`` |
  36. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  37. | :ref:`PackedStringArray<class_PackedStringArray>` | :ref:`filters<class_EditorFileDialog_property_filters>` | ``PackedStringArray()`` |
  38. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`show_hidden_files<class_EditorFileDialog_property_show_hidden_files>` | ``false`` |
  40. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  41. | :ref:`String<class_String>` | title | ``"Save a File"`` (overrides :ref:`Window<class_Window_property_title>`) |
  42. +-------------------------------------------------------+---------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------+
  43. .. rst-class:: classref-reftable-group
  44. Methods
  45. -------
  46. .. table::
  47. :widths: auto
  48. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`add_filter<class_EditorFileDialog_method_add_filter>` **(** :ref:`String<class_String>` filter, :ref:`String<class_String>` description="" **)** |
  50. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`clear_filters<class_EditorFileDialog_method_clear_filters>` **(** **)** |
  52. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | :ref:`LineEdit<class_LineEdit>` | :ref:`get_line_edit<class_EditorFileDialog_method_get_line_edit>` **(** **)** |
  54. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | :ref:`VBoxContainer<class_VBoxContainer>` | :ref:`get_vbox<class_EditorFileDialog_method_get_vbox>` **(** **)** |
  56. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`invalidate<class_EditorFileDialog_method_invalidate>` **(** **)** |
  58. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. .. rst-class:: classref-section-separator
  60. ----
  61. .. rst-class:: classref-descriptions-group
  62. Signals
  63. -------
  64. .. _class_EditorFileDialog_signal_dir_selected:
  65. .. rst-class:: classref-signal
  66. **dir_selected** **(** :ref:`String<class_String>` dir **)**
  67. Emitted when a directory is selected.
  68. .. rst-class:: classref-item-separator
  69. ----
  70. .. _class_EditorFileDialog_signal_file_selected:
  71. .. rst-class:: classref-signal
  72. **file_selected** **(** :ref:`String<class_String>` path **)**
  73. Emitted when a file is selected.
  74. .. rst-class:: classref-item-separator
  75. ----
  76. .. _class_EditorFileDialog_signal_files_selected:
  77. .. rst-class:: classref-signal
  78. **files_selected** **(** :ref:`PackedStringArray<class_PackedStringArray>` paths **)**
  79. Emitted when multiple files are selected.
  80. .. rst-class:: classref-section-separator
  81. ----
  82. .. rst-class:: classref-descriptions-group
  83. Enumerations
  84. ------------
  85. .. _enum_EditorFileDialog_FileMode:
  86. .. rst-class:: classref-enumeration
  87. enum **FileMode**:
  88. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_FILE:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_FILE** = ``0``
  91. The **EditorFileDialog** can select only one file. Accepting the window will open the file.
  92. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_FILES:
  93. .. rst-class:: classref-enumeration-constant
  94. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_FILES** = ``1``
  95. The **EditorFileDialog** can select multiple files. Accepting the window will open all files.
  96. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_DIR:
  97. .. rst-class:: classref-enumeration-constant
  98. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_DIR** = ``2``
  99. The **EditorFileDialog** can select only one directory. Accepting the window will open the directory.
  100. .. _class_EditorFileDialog_constant_FILE_MODE_OPEN_ANY:
  101. .. rst-class:: classref-enumeration-constant
  102. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_OPEN_ANY** = ``3``
  103. The **EditorFileDialog** can select a file or directory. Accepting the window will open it.
  104. .. _class_EditorFileDialog_constant_FILE_MODE_SAVE_FILE:
  105. .. rst-class:: classref-enumeration-constant
  106. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **FILE_MODE_SAVE_FILE** = ``4``
  107. The **EditorFileDialog** can select only one file. Accepting the window will save the file.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _enum_EditorFileDialog_Access:
  111. .. rst-class:: classref-enumeration
  112. enum **Access**:
  113. .. _class_EditorFileDialog_constant_ACCESS_RESOURCES:
  114. .. rst-class:: classref-enumeration-constant
  115. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_RESOURCES** = ``0``
  116. The **EditorFileDialog** can only view ``res://`` directory contents.
  117. .. _class_EditorFileDialog_constant_ACCESS_USERDATA:
  118. .. rst-class:: classref-enumeration-constant
  119. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_USERDATA** = ``1``
  120. The **EditorFileDialog** can only view ``user://`` directory contents.
  121. .. _class_EditorFileDialog_constant_ACCESS_FILESYSTEM:
  122. .. rst-class:: classref-enumeration-constant
  123. :ref:`Access<enum_EditorFileDialog_Access>` **ACCESS_FILESYSTEM** = ``2``
  124. The **EditorFileDialog** can view the entire local file system.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _enum_EditorFileDialog_DisplayMode:
  128. .. rst-class:: classref-enumeration
  129. enum **DisplayMode**:
  130. .. _class_EditorFileDialog_constant_DISPLAY_THUMBNAILS:
  131. .. rst-class:: classref-enumeration-constant
  132. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **DISPLAY_THUMBNAILS** = ``0``
  133. The **EditorFileDialog** displays resources as thumbnails.
  134. .. _class_EditorFileDialog_constant_DISPLAY_LIST:
  135. .. rst-class:: classref-enumeration-constant
  136. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **DISPLAY_LIST** = ``1``
  137. The **EditorFileDialog** displays resources as a list of filenames.
  138. .. rst-class:: classref-section-separator
  139. ----
  140. .. rst-class:: classref-descriptions-group
  141. Property Descriptions
  142. ---------------------
  143. .. _class_EditorFileDialog_property_access:
  144. .. rst-class:: classref-property
  145. :ref:`Access<enum_EditorFileDialog_Access>` **access** = ``0``
  146. .. rst-class:: classref-property-setget
  147. - void **set_access** **(** :ref:`Access<enum_EditorFileDialog_Access>` value **)**
  148. - :ref:`Access<enum_EditorFileDialog_Access>` **get_access** **(** **)**
  149. The location from which the user may select a file, including ``res://``, ``user://``, and the local file system.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_EditorFileDialog_property_current_dir:
  153. .. rst-class:: classref-property
  154. :ref:`String<class_String>` **current_dir**
  155. .. rst-class:: classref-property-setget
  156. - void **set_current_dir** **(** :ref:`String<class_String>` value **)**
  157. - :ref:`String<class_String>` **get_current_dir** **(** **)**
  158. The currently occupied directory.
  159. .. rst-class:: classref-item-separator
  160. ----
  161. .. _class_EditorFileDialog_property_current_file:
  162. .. rst-class:: classref-property
  163. :ref:`String<class_String>` **current_file**
  164. .. rst-class:: classref-property-setget
  165. - void **set_current_file** **(** :ref:`String<class_String>` value **)**
  166. - :ref:`String<class_String>` **get_current_file** **(** **)**
  167. The currently selected file.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_EditorFileDialog_property_current_path:
  171. .. rst-class:: classref-property
  172. :ref:`String<class_String>` **current_path**
  173. .. rst-class:: classref-property-setget
  174. - void **set_current_path** **(** :ref:`String<class_String>` value **)**
  175. - :ref:`String<class_String>` **get_current_path** **(** **)**
  176. The file system path in the address bar.
  177. .. rst-class:: classref-item-separator
  178. ----
  179. .. _class_EditorFileDialog_property_disable_overwrite_warning:
  180. .. rst-class:: classref-property
  181. :ref:`bool<class_bool>` **disable_overwrite_warning** = ``false``
  182. .. rst-class:: classref-property-setget
  183. - void **set_disable_overwrite_warning** **(** :ref:`bool<class_bool>` value **)**
  184. - :ref:`bool<class_bool>` **is_overwrite_warning_disabled** **(** **)**
  185. If ``true``, the **EditorFileDialog** will not warn the user before overwriting files.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_EditorFileDialog_property_display_mode:
  189. .. rst-class:: classref-property
  190. :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **display_mode** = ``0``
  191. .. rst-class:: classref-property-setget
  192. - void **set_display_mode** **(** :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` value **)**
  193. - :ref:`DisplayMode<enum_EditorFileDialog_DisplayMode>` **get_display_mode** **(** **)**
  194. The view format in which the **EditorFileDialog** displays resources to the user.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_EditorFileDialog_property_file_mode:
  198. .. rst-class:: classref-property
  199. :ref:`FileMode<enum_EditorFileDialog_FileMode>` **file_mode** = ``4``
  200. .. rst-class:: classref-property-setget
  201. - void **set_file_mode** **(** :ref:`FileMode<enum_EditorFileDialog_FileMode>` value **)**
  202. - :ref:`FileMode<enum_EditorFileDialog_FileMode>` **get_file_mode** **(** **)**
  203. The dialog's open or save mode, which affects the selection behavior. See :ref:`FileMode<enum_EditorFileDialog_FileMode>`.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_EditorFileDialog_property_filters:
  207. .. rst-class:: classref-property
  208. :ref:`PackedStringArray<class_PackedStringArray>` **filters** = ``PackedStringArray()``
  209. .. rst-class:: classref-property-setget
  210. - void **set_filters** **(** :ref:`PackedStringArray<class_PackedStringArray>` value **)**
  211. - :ref:`PackedStringArray<class_PackedStringArray>` **get_filters** **(** **)**
  212. 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.
  213. .. rst-class:: classref-item-separator
  214. ----
  215. .. _class_EditorFileDialog_property_show_hidden_files:
  216. .. rst-class:: classref-property
  217. :ref:`bool<class_bool>` **show_hidden_files** = ``false``
  218. .. rst-class:: classref-property-setget
  219. - void **set_show_hidden_files** **(** :ref:`bool<class_bool>` value **)**
  220. - :ref:`bool<class_bool>` **is_showing_hidden_files** **(** **)**
  221. If ``true``, hidden files and directories will be visible in the **EditorFileDialog**. This property is synchronized with :ref:`EditorSettings.filesystem/file_dialog/show_hidden_files<class_EditorSettings_property_filesystem/file_dialog/show_hidden_files>`.
  222. .. rst-class:: classref-section-separator
  223. ----
  224. .. rst-class:: classref-descriptions-group
  225. Method Descriptions
  226. -------------------
  227. .. _class_EditorFileDialog_method_add_filter:
  228. .. rst-class:: classref-method
  229. void **add_filter** **(** :ref:`String<class_String>` filter, :ref:`String<class_String>` description="" **)**
  230. Adds a comma-delimited file name ``filter`` option to the **EditorFileDialog** with an optional ``description``, which restricts what files can be picked.
  231. 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.
  232. For example, a ``filter`` of ``"*.tscn, *.scn"`` and a ``description`` of ``"Scenes"`` results in filter text "Scenes (\*.tscn, \*.scn)".
  233. .. rst-class:: classref-item-separator
  234. ----
  235. .. _class_EditorFileDialog_method_clear_filters:
  236. .. rst-class:: classref-method
  237. void **clear_filters** **(** **)**
  238. Removes all filters except for "All Files (\*)".
  239. .. rst-class:: classref-item-separator
  240. ----
  241. .. _class_EditorFileDialog_method_get_line_edit:
  242. .. rst-class:: classref-method
  243. :ref:`LineEdit<class_LineEdit>` **get_line_edit** **(** **)**
  244. Returns the LineEdit for the selected file.
  245. \ **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 :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  246. .. rst-class:: classref-item-separator
  247. ----
  248. .. _class_EditorFileDialog_method_get_vbox:
  249. .. rst-class:: classref-method
  250. :ref:`VBoxContainer<class_VBoxContainer>` **get_vbox** **(** **)**
  251. Returns the ``VBoxContainer`` used to display the file system.
  252. \ **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 :ref:`CanvasItem.visible<class_CanvasItem_property_visible>` property.
  253. .. rst-class:: classref-item-separator
  254. ----
  255. .. _class_EditorFileDialog_method_invalidate:
  256. .. rst-class:: classref-method
  257. void **invalidate** **(** **)**
  258. Notify the **EditorFileDialog** that its view of the data is no longer accurate. Updates the view contents on next view update.
  259. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  260. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  261. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  262. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  263. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  264. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`