class_editordock.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  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>` | ``1`` |
  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:`StringName<class_StringName>` | :ref:`icon_name<class_EditorDock_property_icon_name>` | ``&""`` |
  58. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  59. | :ref:`String<class_String>` | :ref:`layout_key<class_EditorDock_property_layout_key>` | ``""`` |
  60. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  61. | :ref:`String<class_String>` | :ref:`title<class_EditorDock_property_title>` | ``""`` |
  62. +-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
  63. .. rst-class:: classref-reftable-group
  64. Methods
  65. -------
  66. .. table::
  67. :widths: auto
  68. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | |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| |
  70. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | |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| |
  72. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | |void| | :ref:`_update_layout<class_EditorDock_private_method__update_layout>`\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| |
  74. +--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. .. rst-class:: classref-section-separator
  76. ----
  77. .. rst-class:: classref-descriptions-group
  78. Enumerations
  79. ------------
  80. .. _enum_EditorDock_DockLayout:
  81. .. rst-class:: classref-enumeration
  82. flags **DockLayout**: :ref:`🔗<enum_EditorDock_DockLayout>`
  83. .. _class_EditorDock_constant_DOCK_LAYOUT_VERTICAL:
  84. .. rst-class:: classref-enumeration-constant
  85. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_VERTICAL** = ``1``
  86. Allows placing the dock in the vertical dock slots on either side of the editor.
  87. \ **Note:** Currently this flag has no effect because the bottom panel is not a proper dock slot. This means that the dock can always be vertical.
  88. .. _class_EditorDock_constant_DOCK_LAYOUT_HORIZONTAL:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_HORIZONTAL** = ``2``
  91. Allows placing the dock in the editor's bottom panel. Implement :ref:`_update_layout()<class_EditorDock_private_method__update_layout>` to handle changing layouts.
  92. .. rst-class:: classref-section-separator
  93. ----
  94. .. rst-class:: classref-descriptions-group
  95. Property Descriptions
  96. ---------------------
  97. .. _class_EditorDock_property_available_layouts:
  98. .. rst-class:: classref-property
  99. |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **available_layouts** = ``1`` :ref:`🔗<class_EditorDock_property_available_layouts>`
  100. .. rst-class:: classref-property-setget
  101. - |void| **set_available_layouts**\ (\ value\: |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\]\ )
  102. - |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **get_available_layouts**\ (\ )
  103. The available layouts for this dock, as a bitmask.
  104. If you want to make all layouts available, use ``available_layouts = DOCK_LAYOUT_VERTICAL | DOCK_LAYOUT_HORIZONTAL``.
  105. .. rst-class:: classref-item-separator
  106. ----
  107. .. _class_EditorDock_property_default_slot:
  108. .. rst-class:: classref-property
  109. :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **default_slot** = ``-1`` :ref:`🔗<class_EditorDock_property_default_slot>`
  110. .. rst-class:: classref-property-setget
  111. - |void| **set_default_slot**\ (\ value\: :ref:`DockSlot<enum_EditorPlugin_DockSlot>`\ )
  112. - :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **get_default_slot**\ (\ )
  113. The default dock slot used when adding the dock with :ref:`EditorPlugin.add_dock()<class_EditorPlugin_method_add_dock>`.
  114. 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.
  115. .. rst-class:: classref-item-separator
  116. ----
  117. .. _class_EditorDock_property_dock_icon:
  118. .. rst-class:: classref-property
  119. :ref:`Texture2D<class_Texture2D>` **dock_icon** :ref:`🔗<class_EditorDock_property_dock_icon>`
  120. .. rst-class:: classref-property-setget
  121. - |void| **set_dock_icon**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
  122. - :ref:`Texture2D<class_Texture2D>` **get_dock_icon**\ (\ )
  123. The icon for the dock, as a texture. If specified, it will override :ref:`icon_name<class_EditorDock_property_icon_name>`.
  124. .. rst-class:: classref-item-separator
  125. ----
  126. .. _class_EditorDock_property_dock_shortcut:
  127. .. rst-class:: classref-property
  128. :ref:`Shortcut<class_Shortcut>` **dock_shortcut** :ref:`🔗<class_EditorDock_property_dock_shortcut>`
  129. .. rst-class:: classref-property-setget
  130. - |void| **set_dock_shortcut**\ (\ value\: :ref:`Shortcut<class_Shortcut>`\ )
  131. - :ref:`Shortcut<class_Shortcut>` **get_dock_shortcut**\ (\ )
  132. 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>`.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_EditorDock_property_icon_name:
  136. .. rst-class:: classref-property
  137. :ref:`StringName<class_StringName>` **icon_name** = ``&""`` :ref:`🔗<class_EditorDock_property_icon_name>`
  138. .. rst-class:: classref-property-setget
  139. - |void| **set_icon_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
  140. - :ref:`StringName<class_StringName>` **get_icon_name**\ (\ )
  141. 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/>`__.
  142. .. rst-class:: classref-item-separator
  143. ----
  144. .. _class_EditorDock_property_layout_key:
  145. .. rst-class:: classref-property
  146. :ref:`String<class_String>` **layout_key** = ``""`` :ref:`🔗<class_EditorDock_property_layout_key>`
  147. .. rst-class:: classref-property-setget
  148. - |void| **set_layout_key**\ (\ value\: :ref:`String<class_String>`\ )
  149. - :ref:`String<class_String>` **get_layout_key**\ (\ )
  150. The key representing this dock in the editor's layout file. If empty, the dock's displayed name will be used instead.
  151. .. rst-class:: classref-item-separator
  152. ----
  153. .. _class_EditorDock_property_title:
  154. .. rst-class:: classref-property
  155. :ref:`String<class_String>` **title** = ``""`` :ref:`🔗<class_EditorDock_property_title>`
  156. .. rst-class:: classref-property-setget
  157. - |void| **set_title**\ (\ value\: :ref:`String<class_String>`\ )
  158. - :ref:`String<class_String>` **get_title**\ (\ )
  159. 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.
  160. .. rst-class:: classref-section-separator
  161. ----
  162. .. rst-class:: classref-descriptions-group
  163. Method Descriptions
  164. -------------------
  165. .. _class_EditorDock_private_method__load_layout_from_config:
  166. .. rst-class:: classref-method
  167. |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>`
  168. 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>`.
  169. .. rst-class:: classref-item-separator
  170. ----
  171. .. _class_EditorDock_private_method__save_layout_to_config:
  172. .. rst-class:: classref-method
  173. |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>`
  174. 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>`.
  175. .. rst-class:: classref-item-separator
  176. ----
  177. .. _class_EditorDock_private_method__update_layout:
  178. .. rst-class:: classref-method
  179. |void| **_update_layout**\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| :ref:`🔗<class_EditorDock_private_method__update_layout>`
  180. Implement this method to handle the layout switching for this dock. ``layout`` is one of the :ref:`DockLayout<enum_EditorDock_DockLayout>` constants.
  181. ::
  182. _update_layout(layout):
  183. box_container.vertical = (layout == DOCK_LAYOUT_VERTICAL)
  184. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  185. .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
  186. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  187. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  188. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  189. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  190. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  191. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  192. .. |void| replace:: :abbr:`void (No return value.)`