class_editordock.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorDock.xml.
  6. .. _class_EditorDock:
  7. EditorDock
  8. ==========
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`MarginContainer<class_MarginContainer>` **<** :ref:`Container<class_Container>` **<** :ref:`Control<class_Control>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. **Inherited By:** :ref:`FileSystemDock<class_FileSystemDock>`
  12. Dockable container for the editor.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. EditorDock is a :ref:`Container<class_Container>` node that can be docked in one of the editor's dock slots. Docks are added by plugins to provide space for controls related to an :ref:`EditorPlugin<class_EditorPlugin>`. The editor comes with a few built-in docks, such as the Scene dock, FileSystem dock, etc.
  17. You can add a dock by using :ref:`EditorPlugin.add_dock()<class_EditorPlugin_method_add_dock>`. The dock can be customized by changing its properties.
  18. ::
  19. @tool
  20. extends EditorPlugin
  21. # Dock reference.
  22. var dock
  23. # Plugin initialization.
  24. func _enter_tree():
  25. dock = EditorDock.new()
  26. dock.title = "My Dock"
  27. dock.dock_icon = preload("./dock_icon.png")
  28. dock.default_slot = EditorPlugin.DOCK_SLOT_RIGHT_UL
  29. var dock_content = preload("./dock_content.tscn").instantiate()
  30. dock.add_child(dock_content)
  31. add_dock(dock)
  32. # Plugin clean-up.
  33. func _exit_tree():
  34. remove_dock(dock)
  35. dock.queue_free()
  36. dock = null
  37. .. rst-class:: classref-introduction-group
  38. Tutorials
  39. ---------
  40. - :doc:`Making plugins <../tutorials/plugins/editor/making_plugins>`
  41. .. rst-class:: classref-reftable-group
  42. Properties
  43. ----------
  44. .. table::
  45. :widths: auto
  46. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  47. | |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] | :ref:`available_layouts<class_EditorDock_property_available_layouts>` | ``5`` |
  48. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  49. | :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
  50. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  51. | :ref:`DockSlot<enum_EditorPlugin_DockSlot>` | :ref:`default_slot<class_EditorDock_property_default_slot>` | ``-1`` |
  52. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  53. | :ref:`Texture2D<class_Texture2D>` | :ref:`dock_icon<class_EditorDock_property_dock_icon>` | |
  54. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  55. | :ref:`Shortcut<class_Shortcut>` | :ref:`dock_shortcut<class_EditorDock_property_dock_shortcut>` | |
  56. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  57. | :ref:`bool<class_bool>` | :ref:`global<class_EditorDock_property_global>` | ``true`` |
  58. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  59. | :ref:`StringName<class_StringName>` | :ref:`icon_name<class_EditorDock_property_icon_name>` | ``&""`` |
  60. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  61. | :ref:`String<class_String>` | :ref:`layout_key<class_EditorDock_property_layout_key>` | ``""`` |
  62. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  63. | :ref:`String<class_String>` | :ref:`title<class_EditorDock_property_title>` | ``""`` |
  64. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  65. | :ref:`Color<class_Color>` | :ref:`title_color<class_EditorDock_property_title_color>` | ``Color(0, 0, 0, 0)`` |
  66. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`transient<class_EditorDock_property_transient>` | ``false`` |
  68. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  69. .. rst-class:: classref-reftable-group
  70. Methods
  71. -------
  72. .. table::
  73. :widths: auto
  74. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | |void| | :ref:`_load_layout_from_config<class_EditorDock_private_method__load_layout_from_config>`\ (\ config\: :ref:`ConfigFile<class_ConfigFile>`, section\: :ref:`String<class_String>`\ ) |virtual| |
  76. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | |void| | :ref:`_save_layout_to_config<class_EditorDock_private_method__save_layout_to_config>`\ (\ config\: :ref:`ConfigFile<class_ConfigFile>`, section\: :ref:`String<class_String>`\ ) |virtual| |const| |
  78. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | |void| | :ref:`_update_layout<class_EditorDock_private_method__update_layout>`\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| |
  80. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | |void| | :ref:`close<class_EditorDock_method_close>`\ (\ ) |
  82. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | |void| | :ref:`open<class_EditorDock_method_open>`\ (\ ) |
  84. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. .. rst-class:: classref-section-separator
  86. ----
  87. .. rst-class:: classref-descriptions-group
  88. Enumerations
  89. ------------
  90. .. _enum_EditorDock_DockLayout:
  91. .. rst-class:: classref-enumeration
  92. flags **DockLayout**: :ref:`🔗<enum_EditorDock_DockLayout>`
  93. .. _class_EditorDock_constant_DOCK_LAYOUT_VERTICAL:
  94. .. rst-class:: classref-enumeration-constant
  95. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_VERTICAL** = ``1``
  96. Allows placing the dock in the vertical dock slots on either side of the editor.
  97. .. _class_EditorDock_constant_DOCK_LAYOUT_HORIZONTAL:
  98. .. rst-class:: classref-enumeration-constant
  99. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_HORIZONTAL** = ``2``
  100. Allows placing the dock in the editor's bottom panel.
  101. .. _class_EditorDock_constant_DOCK_LAYOUT_FLOATING:
  102. .. rst-class:: classref-enumeration-constant
  103. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_FLOATING** = ``4``
  104. Allows making the dock floating (opened as a separate window).
  105. .. _class_EditorDock_constant_DOCK_LAYOUT_ALL:
  106. .. rst-class:: classref-enumeration-constant
  107. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_ALL** = ``7``
  108. Allows placing the dock in all available slots.
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Property Descriptions
  113. ---------------------
  114. .. _class_EditorDock_property_available_layouts:
  115. .. rst-class:: classref-property
  116. |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **available_layouts** = ``5`` :ref:`🔗<class_EditorDock_property_available_layouts>`
  117. .. rst-class:: classref-property-setget
  118. - |void| **set_available_layouts**\ (\ value\: |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\]\ )
  119. - |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **get_available_layouts**\ (\ )
  120. The available layouts for this dock, as a bitmask. By default, the dock allows vertical and floating layouts.
  121. .. rst-class:: classref-item-separator
  122. ----
  123. .. _class_EditorDock_property_default_slot:
  124. .. rst-class:: classref-property
  125. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **default_slot** = ``-1`` :ref:`🔗<class_EditorDock_property_default_slot>`
  126. .. rst-class:: classref-property-setget
  127. - |void| **set_default_slot**\ (\ value\: :ref:`DockSlot<enum_EditorPlugin_DockSlot>`\ )
  128. - :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **get_default_slot**\ (\ )
  129. The default dock slot used when adding the dock with :ref:`EditorPlugin.add_dock()<class_EditorPlugin_method_add_dock>`.
  130. After the dock is added, it can be moved to a different slot and the editor will automatically remember its position between sessions. If you remove and re-add the dock, it will be reset to default.
  131. .. rst-class:: classref-item-separator
  132. ----
  133. .. _class_EditorDock_property_dock_icon:
  134. .. rst-class:: classref-property
  135. :ref:`Texture2D<class_Texture2D>` **dock_icon** :ref:`🔗<class_EditorDock_property_dock_icon>`
  136. .. rst-class:: classref-property-setget
  137. - |void| **set_dock_icon**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
  138. - :ref:`Texture2D<class_Texture2D>` **get_dock_icon**\ (\ )
  139. The icon for the dock, as a texture. If specified, it will override :ref:`icon_name<class_EditorDock_property_icon_name>`.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_EditorDock_property_dock_shortcut:
  143. .. rst-class:: classref-property
  144. :ref:`Shortcut<class_Shortcut>` **dock_shortcut** :ref:`🔗<class_EditorDock_property_dock_shortcut>`
  145. .. rst-class:: classref-property-setget
  146. - |void| **set_dock_shortcut**\ (\ value\: :ref:`Shortcut<class_Shortcut>`\ )
  147. - :ref:`Shortcut<class_Shortcut>` **get_dock_shortcut**\ (\ )
  148. The shortcut used to open the dock. This property can only be set before this dock is added via :ref:`EditorPlugin.add_dock()<class_EditorPlugin_method_add_dock>`.
  149. .. rst-class:: classref-item-separator
  150. ----
  151. .. _class_EditorDock_property_global:
  152. .. rst-class:: classref-property
  153. :ref:`bool<class_bool>` **global** = ``true`` :ref:`🔗<class_EditorDock_property_global>`
  154. .. rst-class:: classref-property-setget
  155. - |void| **set_global**\ (\ value\: :ref:`bool<class_bool>`\ )
  156. - :ref:`bool<class_bool>` **is_global**\ (\ )
  157. If ``true``, the dock appears in the **Editor > Editor Docks** menu and can be closed. Non-global docks can still be closed using :ref:`close()<class_EditorDock_method_close>`.
  158. .. rst-class:: classref-item-separator
  159. ----
  160. .. _class_EditorDock_property_icon_name:
  161. .. rst-class:: classref-property
  162. :ref:`StringName<class_StringName>` **icon_name** = ``&""`` :ref:`🔗<class_EditorDock_property_icon_name>`
  163. .. rst-class:: classref-property-setget
  164. - |void| **set_icon_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  165. - :ref:`StringName<class_StringName>` **get_icon_name**\ (\ )
  166. The icon for the dock, as a name from the ``EditorIcons`` theme type in the editor theme. You can find the list of available icons `here <https://godot-editor-icons.github.io/>`__.
  167. .. rst-class:: classref-item-separator
  168. ----
  169. .. _class_EditorDock_property_layout_key:
  170. .. rst-class:: classref-property
  171. :ref:`String<class_String>` **layout_key** = ``""`` :ref:`🔗<class_EditorDock_property_layout_key>`
  172. .. rst-class:: classref-property-setget
  173. - |void| **set_layout_key**\ (\ value\: :ref:`String<class_String>`\ )
  174. - :ref:`String<class_String>` **get_layout_key**\ (\ )
  175. The key representing this dock in the editor's layout file. If empty, the dock's displayed name will be used instead.
  176. .. rst-class:: classref-item-separator
  177. ----
  178. .. _class_EditorDock_property_title:
  179. .. rst-class:: classref-property
  180. :ref:`String<class_String>` **title** = ``""`` :ref:`🔗<class_EditorDock_property_title>`
  181. .. rst-class:: classref-property-setget
  182. - |void| **set_title**\ (\ value\: :ref:`String<class_String>`\ )
  183. - :ref:`String<class_String>` **get_title**\ (\ )
  184. The title of the dock's tab. If empty, the dock's :ref:`Node.name<class_Node_property_name>` will be used. If the name is auto-generated (contains ``@``), the first child's name will be used instead.
  185. .. rst-class:: classref-item-separator
  186. ----
  187. .. _class_EditorDock_property_title_color:
  188. .. rst-class:: classref-property
  189. :ref:`Color<class_Color>` **title_color** = ``Color(0, 0, 0, 0)`` :ref:`🔗<class_EditorDock_property_title_color>`
  190. .. rst-class:: classref-property-setget
  191. - |void| **set_title_color**\ (\ value\: :ref:`Color<class_Color>`\ )
  192. - :ref:`Color<class_Color>` **get_title_color**\ (\ )
  193. The color of the dock tab's title. If its alpha is ``0.0``, the default font color will be used.
  194. .. rst-class:: classref-item-separator
  195. ----
  196. .. _class_EditorDock_property_transient:
  197. .. rst-class:: classref-property
  198. :ref:`bool<class_bool>` **transient** = ``false`` :ref:`🔗<class_EditorDock_property_transient>`
  199. .. rst-class:: classref-property-setget
  200. - |void| **set_transient**\ (\ value\: :ref:`bool<class_bool>`\ )
  201. - :ref:`bool<class_bool>` **is_transient**\ (\ )
  202. If ``true``, the dock is not automatically opened or closed when loading an editor layout, only moved. It also can't be opened using a shortcut. This is meant for docks that are opened and closed in specific cases, such as when selecting a :ref:`TileMap<class_TileMap>` or :ref:`AnimationTree<class_AnimationTree>` node.
  203. .. rst-class:: classref-section-separator
  204. ----
  205. .. rst-class:: classref-descriptions-group
  206. Method Descriptions
  207. -------------------
  208. .. _class_EditorDock_private_method__load_layout_from_config:
  209. .. rst-class:: classref-method
  210. |void| **_load_layout_from_config**\ (\ config\: :ref:`ConfigFile<class_ConfigFile>`, section\: :ref:`String<class_String>`\ ) |virtual| :ref:`🔗<class_EditorDock_private_method__load_layout_from_config>`
  211. Implement this method to handle loading this dock's layout. It's equivalent to :ref:`EditorPlugin._set_window_layout()<class_EditorPlugin_private_method__set_window_layout>`. ``section`` is a unique section based on :ref:`layout_key<class_EditorDock_property_layout_key>`.
  212. .. rst-class:: classref-item-separator
  213. ----
  214. .. _class_EditorDock_private_method__save_layout_to_config:
  215. .. rst-class:: classref-method
  216. |void| **_save_layout_to_config**\ (\ config\: :ref:`ConfigFile<class_ConfigFile>`, section\: :ref:`String<class_String>`\ ) |virtual| |const| :ref:`🔗<class_EditorDock_private_method__save_layout_to_config>`
  217. Implement this method to handle saving this dock's layout. It's equivalent to :ref:`EditorPlugin._get_window_layout()<class_EditorPlugin_private_method__get_window_layout>`. ``section`` is a unique section based on :ref:`layout_key<class_EditorDock_property_layout_key>`.
  218. .. rst-class:: classref-item-separator
  219. ----
  220. .. _class_EditorDock_private_method__update_layout:
  221. .. rst-class:: classref-method
  222. |void| **_update_layout**\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| :ref:`🔗<class_EditorDock_private_method__update_layout>`
  223. Implement this method to handle the layout switching for this dock. ``layout`` is one of the :ref:`DockLayout<enum_EditorDock_DockLayout>` constants.
  224. ::
  225. _update_layout(layout):
  226. box_container.vertical = (layout == DOCK_LAYOUT_VERTICAL)
  227. .. rst-class:: classref-item-separator
  228. ----
  229. .. _class_EditorDock_method_close:
  230. .. rst-class:: classref-method
  231. |void| **close**\ (\ ) :ref:`🔗<class_EditorDock_method_close>`
  232. Closes the dock, making its tab hidden.
  233. .. rst-class:: classref-item-separator
  234. ----
  235. .. _class_EditorDock_method_open:
  236. .. rst-class:: classref-method
  237. |void| **open**\ (\ ) :ref:`🔗<class_EditorDock_method_open>`
  238. Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating.
  239. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  240. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  241. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  242. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  243. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  244. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  245. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  246. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  247. .. |void| replace:: :abbr:`void (No return value.)`