EditorDock
Inherits: MarginContainer < Container < Control < CanvasItem < Entity < Object
Inherited by: FileSystemDock, ScriptEditor
Description
Section titled “Description”Dockable container for the editor.
EditorDock is a 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 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 EditorPlugin.add_dock(). The dock can be customized by changing its properties.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | accessibility_region |
true (overrides Container) |
| bool | allow_switch_screen |
false |
| BitField[DockLayout] | available_layouts |
5 |
| bool | closable |
false |
| DockSlot | default_slot |
-1 |
| Texture2D | dock_icon |
|
| Shortcut | dock_shortcut |
|
| bool | force_show_icon |
false |
| bool | global |
true |
| StringName | icon_name |
&"" |
| String | layout_key |
"" |
| String | title |
"" |
| Color | title_color |
Color(0, 0, 0, 0) |
| bool | transient |
false |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | _load_layout_from_config(config: ConfigFile, section: String) virtual |
| void | _save_layout_to_config(config: ConfigFile, section: String) virtual const |
| void | _update_layout_and_slot(layout: int, slot: int) virtual |
| void | close() |
| void | make_visible() |
| void | open() |
Signals
Section titled “Signals”closed
closed()
Emitted when the dock is closed, before it’s removed from its parent. The dock can be closed using Close button in the dock popup, using close(), or as a result of a layout change.
opened
opened()
Emitted when the dock is opened via the Editor > Editor Docks menu, before it’s made visible.
Enumerations
Section titled “Enumerations”DockLayout
enum DockLayout (flags)
DOCK_LAYOUT_VERTICAL = 1
Allows placing the dock in the vertical dock slots on either side of the editor.
DOCK_LAYOUT_HORIZONTAL = 2
Allows placing the dock in the horizontal dock slots at the bottom.
DOCK_LAYOUT_FLOATING = 4
Allows making the dock floating (opened as a separate window).
DOCK_LAYOUT_MAIN_SCREEN = 8
Allows using the dock as main screen.
DOCK_LAYOUT_ALL = 7
Allows placing the dock in all available slots, except in main screen.
DockSlot
enum DockSlot
DOCK_SLOT_NONE = -1
The dock is closed.
DOCK_SLOT_LEFT_UL = 0
Dock slot, left side, upper-left (empty in default layout).
DOCK_SLOT_LEFT_BL = 1
Dock slot, left side, bottom-left (empty in default layout).
DOCK_SLOT_LEFT_UR = 2
Dock slot, left side, upper-right (in default layout includes Scene and Import docks).
DOCK_SLOT_LEFT_BR = 3
Dock slot, left side, bottom-right (in default layout includes FileSystem and History docks).
DOCK_SLOT_RIGHT_UL = 4
Dock slot, right side, upper-left (in default layout includes Inspector, Signal, and Group docks).
DOCK_SLOT_RIGHT_BL = 5
Dock slot, right side, bottom-left (empty in default layout).
DOCK_SLOT_RIGHT_UR = 6
Dock slot, right side, upper-right (empty in default layout).
DOCK_SLOT_RIGHT_BR = 7
Dock slot, right side, bottom-right (empty in default layout).
DOCK_SLOT_BOTTOM = 8
Bottom panel.
DOCK_SLOT_BOTTOM_L = 9
Dock slot at the bottom, below bottom panel, on the left side.
DOCK_SLOT_BOTTOM_R = 10
Dock slot at the bottom, below bottom panel, on the right side.
DOCK_SLOT_MAIN_SCREEN = 11
The editor’s main screen.
DOCK_SLOT_MAX = 12
Represents the size of the DockSlot enum.
Property descriptions
Section titled “Property descriptions”allow_switch_screen
bool allow_switch_screen = false
If true and this dock is docked in the main screen, selecting a node in the scene tree can switch away from this dock. The selected node needs to be handled by another main screen dock (2D, 3D) for the switch to happen.
available_layouts
BitField[DockLayout] available_layouts = 5
The available layouts for this dock, as a bitmask. By default, the dock allows vertical and floating layouts.
closable
bool closable = false
If true, the dock can be closed with the Close button in the context popup. Docks with global enabled are always closable.
default_slot
DockSlot default_slot = -1
The default dock slot used when adding the dock with EditorPlugin.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.
dock_icon
Texture2D dock_icon
The icon for the dock, as a texture. If specified, it will override icon_name.
dock_shortcut
Shortcut dock_shortcut
The shortcut used to open the dock.
force_show_icon
bool force_show_icon = false
If true, the dock will always display an icon, regardless of EditorSettings.interface/editor/docks/dock_tab_style or EditorSettings.interface/editor/docks/bottom_dock_tab_style.
global
bool global = true
If true, the dock appears in the Editor > Editor Docks menu and can be closed. Non-global docks can still be closed using close() or when closable is true.
icon_name
StringName 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.
layout_key
String layout_key = ""
The key representing this dock in the editor’s layout file. If empty, the dock’s displayed name will be used instead.
title
String title = ""
The title of the dock’s tab. If empty, the dock’s Entity.name will be used. If the name is auto-generated (contains @), the first child’s name will be used instead.
title_color
Color title_color = Color(0, 0, 0, 0)
The color of the dock tab’s title. If its alpha is 0.0, the default font color will be used.
transient
bool transient = false
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 TileMapLayer or AnimationTree node.
Method descriptions
Section titled “Method descriptions”_load_layout_from_config
void _load_layout_from_config(config: ConfigFile, section: String) virtual
Implement this method to handle loading this dock’s layout. It’s equivalent to EditorPlugin._set_window_layout(). section is a unique section based on layout_key.
_save_layout_to_config
void _save_layout_to_config(config: ConfigFile, section: String) virtual const
Implement this method to handle saving this dock’s layout. It’s equivalent to EditorPlugin._get_window_layout(). section is a unique section based on layout_key.
_update_layout_and_slot
void _update_layout_and_slot(layout: int, slot: int) virtual
Implement this method to handle the layout/slot switching for this dock. layout is one of the DockLayout constants, and slot is one of the DockSlot ones.
close
void close()
Closes the dock, making its tab hidden.
make_visible
void make_visible()
Focuses the dock’s tab (or window if it’s floating). If the dock was closed, it will be opened. If it’s a bottom dock, makes the bottom panel visible.
open
void open()
Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating.
Note: This does not focus the dock. If you want to open and focus the dock, use make_visible().
