mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-03 05:48:42 +03:00
319 lines
15 KiB
ReStructuredText
319 lines
15 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. DO NOT EDIT THIS FILE!!!
|
|
.. Generated automatically from Godot engine sources.
|
|
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
|
|
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/EditorDock.xml.
|
|
|
|
.. _class_EditorDock:
|
|
|
|
EditorDock
|
|
==========
|
|
|
|
**Experimental:** This class may be changed or removed in future versions.
|
|
|
|
**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>`
|
|
|
|
**Inherited By:** :ref:`FileSystemDock<class_FileSystemDock>`
|
|
|
|
Dockable container for the editor.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Description
|
|
-----------
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
::
|
|
|
|
@tool
|
|
extends EditorPlugin
|
|
|
|
# Dock reference.
|
|
var dock
|
|
|
|
# Plugin initialization.
|
|
func _enter_tree():
|
|
dock = EditorDock.new()
|
|
dock.title = "My Dock"
|
|
dock.dock_icon = preload("./dock_icon.png")
|
|
dock.default_slot = EditorPlugin.DOCK_SLOT_RIGHT_UL
|
|
var dock_content = preload("./dock_content.tscn").instantiate()
|
|
dock.add_child(dock_content)
|
|
add_dock(dock)
|
|
|
|
# Plugin clean-up.
|
|
func _exit_tree():
|
|
remove_dock(dock)
|
|
dock.queue_free()
|
|
dock = null
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorials
|
|
---------
|
|
|
|
- :doc:`Making plugins <../tutorials/plugins/editor/making_plugins>`
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Properties
|
|
----------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] | :ref:`available_layouts<class_EditorDock_property_available_layouts>` | ``1`` |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`bool<class_bool>` | clip_contents | ``true`` (overrides :ref:`Control<class_Control_property_clip_contents>`) |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`DockSlot<enum_EditorPlugin_DockSlot>` | :ref:`default_slot<class_EditorDock_property_default_slot>` | ``-1`` |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`Texture2D<class_Texture2D>` | :ref:`dock_icon<class_EditorDock_property_dock_icon>` | |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`Shortcut<class_Shortcut>` | :ref:`dock_shortcut<class_EditorDock_property_dock_shortcut>` | |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`StringName<class_StringName>` | :ref:`icon_name<class_EditorDock_property_icon_name>` | ``&""`` |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`layout_key<class_EditorDock_property_layout_key>` | ``""`` |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
| :ref:`String<class_String>` | :ref:`title<class_EditorDock_property_title>` | ``""`` |
|
|
+-------------------------------------------------------------+-----------------------------------------------------------------------+---------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Methods
|
|
-------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |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| |
|
|
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |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| |
|
|
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`_update_layout<class_EditorDock_private_method__update_layout>`\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| |
|
|
+--------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Enumerations
|
|
------------
|
|
|
|
.. _enum_EditorDock_DockLayout:
|
|
|
|
.. rst-class:: classref-enumeration
|
|
|
|
flags **DockLayout**: :ref:`🔗<enum_EditorDock_DockLayout>`
|
|
|
|
.. _class_EditorDock_constant_DOCK_LAYOUT_VERTICAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_VERTICAL** = ``1``
|
|
|
|
Allows placing the dock in the vertical dock slots on either side of the editor.
|
|
|
|
\ **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.
|
|
|
|
.. _class_EditorDock_constant_DOCK_LAYOUT_HORIZONTAL:
|
|
|
|
.. rst-class:: classref-enumeration-constant
|
|
|
|
:ref:`DockLayout<enum_EditorDock_DockLayout>` **DOCK_LAYOUT_HORIZONTAL** = ``2``
|
|
|
|
Allows placing the dock in the editor's bottom panel. Implement :ref:`_update_layout()<class_EditorDock_private_method__update_layout>` to handle changing layouts.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Property Descriptions
|
|
---------------------
|
|
|
|
.. _class_EditorDock_property_available_layouts:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
|bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **available_layouts** = ``1`` :ref:`🔗<class_EditorDock_property_available_layouts>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_available_layouts**\ (\ value\: |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\]\ )
|
|
- |bitfield|\[:ref:`DockLayout<enum_EditorDock_DockLayout>`\] **get_available_layouts**\ (\ )
|
|
|
|
The available layouts for this dock, as a bitmask.
|
|
|
|
If you want to make all layouts available, use ``available_layouts = DOCK_LAYOUT_VERTICAL | DOCK_LAYOUT_HORIZONTAL``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_default_slot:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`DockSlot<enum_EditorPlugin_DockSlot>` **default_slot** = ``-1`` :ref:`🔗<class_EditorDock_property_default_slot>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_default_slot**\ (\ value\: :ref:`DockSlot<enum_EditorPlugin_DockSlot>`\ )
|
|
- :ref:`DockSlot<enum_EditorPlugin_DockSlot>` **get_default_slot**\ (\ )
|
|
|
|
The default dock slot used when adding the dock with :ref:`EditorPlugin.add_dock()<class_EditorPlugin_method_add_dock>`.
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_dock_icon:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Texture2D<class_Texture2D>` **dock_icon** :ref:`🔗<class_EditorDock_property_dock_icon>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_dock_icon**\ (\ value\: :ref:`Texture2D<class_Texture2D>`\ )
|
|
- :ref:`Texture2D<class_Texture2D>` **get_dock_icon**\ (\ )
|
|
|
|
The icon for the dock, as a texture. If specified, it will override :ref:`icon_name<class_EditorDock_property_icon_name>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_dock_shortcut:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Shortcut<class_Shortcut>` **dock_shortcut** :ref:`🔗<class_EditorDock_property_dock_shortcut>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_dock_shortcut**\ (\ value\: :ref:`Shortcut<class_Shortcut>`\ )
|
|
- :ref:`Shortcut<class_Shortcut>` **get_dock_shortcut**\ (\ )
|
|
|
|
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>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_icon_name:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`StringName<class_StringName>` **icon_name** = ``&""`` :ref:`🔗<class_EditorDock_property_icon_name>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_icon_name**\ (\ value\: :ref:`StringName<class_StringName>`\ )
|
|
- :ref:`StringName<class_StringName>` **get_icon_name**\ (\ )
|
|
|
|
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/>`__.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_layout_key:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **layout_key** = ``""`` :ref:`🔗<class_EditorDock_property_layout_key>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_layout_key**\ (\ value\: :ref:`String<class_String>`\ )
|
|
- :ref:`String<class_String>` **get_layout_key**\ (\ )
|
|
|
|
The key representing this dock in the editor's layout file. If empty, the dock's displayed name will be used instead.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_property_title:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **title** = ``""`` :ref:`🔗<class_EditorDock_property_title>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_title**\ (\ value\: :ref:`String<class_String>`\ )
|
|
- :ref:`String<class_String>` **get_title**\ (\ )
|
|
|
|
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.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Method Descriptions
|
|
-------------------
|
|
|
|
.. _class_EditorDock_private_method__load_layout_from_config:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|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>`
|
|
|
|
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>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_private_method__save_layout_to_config:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|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>`
|
|
|
|
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>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_EditorDock_private_method__update_layout:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **_update_layout**\ (\ layout\: :ref:`int<class_int>`\ ) |virtual| :ref:`🔗<class_EditorDock_private_method__update_layout>`
|
|
|
|
Implement this method to handle the layout switching for this dock. ``layout`` is one of the :ref:`DockLayout<enum_EditorDock_DockLayout>` constants.
|
|
|
|
::
|
|
|
|
_update_layout(layout):
|
|
box_container.vertical = (layout == DOCK_LAYOUT_VERTICAL)
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
|
|
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
|
|
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
|
|
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
|
|
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
|
|
.. |void| replace:: :abbr:`void (No return value.)`
|