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 [method EditorPlugin.add_dock]. The dock can be customized by changing its properties.
[codeblock]
@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
[/codeblock]
$DOCS_URL/tutorials/plugins/editor/making_plugins.html
Implement this method to handle loading this dock's layout. It's equivalent to [method EditorPlugin._set_window_layout]. [param section] is a unique section based on [member layout_key].
Implement this method to handle saving this dock's layout. It's equivalent to [method EditorPlugin._get_window_layout]. [param section] is a unique section based on [member layout_key].
Implement this method to handle the layout switching for this dock. [param layout] is one of the [enum DockLayout] constants.
[codeblock]
_update_layout(layout):
box_container.vertical = (layout == DOCK_LAYOUT_VERTICAL)
[/codeblock]
The available layouts for this dock, as a bitmask.
If you want to make all layouts available, use [code]available_layouts = DOCK_LAYOUT_VERTICAL | DOCK_LAYOUT_HORIZONTAL[/code].
The default dock slot used when adding the dock with [method 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.
The icon for the dock, as a texture. If specified, it will override [member icon_name].
The shortcut used to open the dock. This property can only be set before this dock is added via [method EditorPlugin.add_dock].
The icon for the dock, as a name from the [code]EditorIcons[/code] theme type in the editor theme. You can find the list of available icons [url=https://godot-editor-icons.github.io/]here[/url].
The key representing this dock in the editor's layout file. If empty, the dock's displayed name will be used instead.
The title of the dock's tab. If empty, the dock's [member Node.name] will be used. If the name is auto-generated (contains [code]@[/code]), the first child's name will be used instead.
Allows placing the dock in the vertical dock slots on either side of the editor.
[b]Note:[/b] 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.
Allows placing the dock in the editor's bottom panel. Implement [method _update_layout] to handle changing layouts.