| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="EditorDock" inherits="MarginContainer" experimental="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd"> |
| 3 | <brief_description> |
| 4 | Dockable container for the editor. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | 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. |
| 8 | You can add a dock by using [method EditorPlugin.add_dock]. The dock can be customized by changing its properties. |
| 9 | [codeblock] |
| 10 | @tool |
| 11 | extends EditorPlugin |
| 12 | |
| 13 | # Dock reference. |
| 14 | var dock |
| 15 | |
| 16 | # Plugin initialization. |
| 17 | func _enter_tree(): |
| 18 | dock = EditorDock.new() |
| 19 | dock.title = "My Dock" |
| 20 | dock.dock_icon = preload("./dock_icon.png") |
| 21 | dock.default_slot = EditorDock.DOCK_SLOT_RIGHT_UL |
| 22 | var dock_content = preload("./dock_content.tscn").instantiate() |
| 23 | dock.add_child(dock_content) |
| 24 | add_dock(dock) |
| 25 | |
| 26 | # Plugin clean-up. |
| 27 | func _exit_tree(): |
| 28 | remove_dock(dock) |
| 29 | dock.queue_free() |
| 30 | dock = null |
| 31 | [/codeblock] |
| 32 | </description> |
| 33 | <tutorials> |
| 34 | <link title="Making plugins">$DOCS_URL/tutorials/plugins/editor/making_plugins.html</link> |
| 35 | </tutorials> |
| 36 | <methods> |
| 37 | <method name="_load_layout_from_config" qualifiers="virtual"> |
| 38 | <return type="void" /> |
| 39 | <param index="0" name="config" type="ConfigFile" /> |
| 40 | <param index="1" name="section" type="String" /> |
| 41 | <description> |
| 42 | 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]. |
| 43 | </description> |
| 44 | </method> |
| 45 | <method name="_save_layout_to_config" qualifiers="virtual const"> |
| 46 | <return type="void" /> |
| 47 | <param index="0" name="config" type="ConfigFile" /> |
| 48 | <param index="1" name="section" type="String" /> |
| 49 | <description> |
| 50 | 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]. |
| 51 | </description> |
| 52 | </method> |
| 53 | <method name="_update_layout" qualifiers="virtual"> |
| 54 | <return type="void" /> |
| 55 | <param index="0" name="layout" type="int" /> |
| 56 | <description> |
| 57 | Implement this method to handle the layout switching for this dock. [param layout] is one of the [enum DockLayout] constants. |
| 58 | [codeblock] |
| 59 | func _update_layout(layout): |
| 60 | box_container.vertical = (layout == DOCK_LAYOUT_VERTICAL) |
| 61 | [/codeblock] |
| 62 | </description> |
| 63 | </method> |
| 64 | <method name="close"> |
| 65 | <return type="void" /> |
| 66 | <description> |
| 67 | Closes the dock, making its tab hidden. |
| 68 | </description> |
| 69 | </method> |
| 70 | <method name="make_visible"> |
| 71 | <return type="void" /> |
| 72 | <description> |
| 73 | 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. |
| 74 | </description> |
| 75 | </method> |
| 76 | <method name="open"> |
| 77 | <return type="void" /> |
| 78 | <description> |
| 79 | Opens the dock. It will appear in the last used dock slot. If the dock has no default slot, it will be opened floating. |
| 80 | [b]Note:[/b] This does not focus the dock. If you want to open and focus the dock, use [method make_visible]. |
| 81 | </description> |
| 82 | </method> |
| 83 | </methods> |
| 84 | <members> |
| 85 | <member name="available_layouts" type="int" setter="set_available_layouts" getter="get_available_layouts" enum="EditorDock.DockLayout" is_bitfield="true" default="5"> |
| 86 | The available layouts for this dock, as a bitmask. By default, the dock allows vertical and floating layouts. |
| 87 | </member> |
| 88 | <member name="closable" type="bool" setter="set_closable" getter="is_closable" default="false"> |
| 89 | If [code]true[/code], the dock can be closed with the Close button in the context popup. Docks with [member global] enabled are always closable. |
| 90 | </member> |
| 91 | <member name="default_slot" type="int" setter="set_default_slot" getter="get_default_slot" enum="EditorDock.DockSlot" default="-1"> |
| 92 | The default dock slot used when adding the dock with [method EditorPlugin.add_dock]. |
| 93 | 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. |
| 94 | </member> |
| 95 | <member name="dock_icon" type="Texture2D" setter="set_dock_icon" getter="get_dock_icon"> |
| 96 | The icon for the dock, as a texture. If specified, it will override [member icon_name]. |
| 97 | </member> |
| 98 | <member name="dock_shortcut" type="Shortcut" setter="set_dock_shortcut" getter="get_dock_shortcut"> |
| 99 | The shortcut used to open the dock. |
| 100 | </member> |
| 101 | <member name="force_show_icon" type="bool" setter="set_force_show_icon" getter="get_force_show_icon" default="false"> |
| 102 | If [code]true[/code], the dock will always display an icon, regardless of [member EditorSettings.interface/editor/dock_tab_style] or [member EditorSettings.interface/editor/bottom_dock_tab_style]. |
| 103 | </member> |
| 104 | <member name="global" type="bool" setter="set_global" getter="is_global" default="true"> |
| 105 | If [code]true[/code], the dock appears in the [b]Editor > Editor Docks[/b] menu and can be closed. Non-global docks can still be closed using [method close] or when [member closable] is [code]true[/code]. |
| 106 | </member> |
| 107 | <member name="icon_name" type="StringName" setter="set_icon_name" getter="get_icon_name" default="&"""> |
| 108 | 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]. |
| 109 | </member> |
| 110 | <member name="layout_key" type="String" setter="set_layout_key" getter="get_layout_key" default=""""> |
| 111 | The key representing this dock in the editor's layout file. If empty, the dock's displayed name will be used instead. |
| 112 | </member> |
| 113 | <member name="title" type="String" setter="set_title" getter="get_title" default=""""> |
| 114 | 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. |
| 115 | </member> |
| 116 | <member name="title_color" type="Color" setter="set_title_color" getter="get_title_color" default="Color(0, 0, 0, 0)"> |
| 117 | The color of the dock tab's title. If its alpha is [code]0.0[/code], the default font color will be used. |
| 118 | </member> |
| 119 | <member name="transient" type="bool" setter="set_transient" getter="is_transient" default="false"> |
| 120 | If [code]true[/code], 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 [TileMap] or [AnimationTree] node. |
| 121 | </member> |
| 122 | </members> |
| 123 | <signals> |
| 124 | <signal name="closed"> |
| 125 | <description> |
| 126 | Emitted when the dock is closed with the Close button in the context popup, before it's removed from its parent. See [member closable]. |
| 127 | </description> |
| 128 | </signal> |
| 129 | </signals> |
| 130 | <constants> |
| 131 | <constant name="DOCK_LAYOUT_VERTICAL" value="1" enum="DockLayout" is_bitfield="true"> |
| 132 | Allows placing the dock in the vertical dock slots on either side of the editor. |
| 133 | </constant> |
| 134 | <constant name="DOCK_LAYOUT_HORIZONTAL" value="2" enum="DockLayout" is_bitfield="true"> |
| 135 | Allows placing the dock in the editor's bottom panel. |
| 136 | </constant> |
| 137 | <constant name="DOCK_LAYOUT_FLOATING" value="4" enum="DockLayout" is_bitfield="true"> |
| 138 | Allows making the dock floating (opened as a separate window). |
| 139 | </constant> |
| 140 | <constant name="DOCK_LAYOUT_ALL" value="7" enum="DockLayout" is_bitfield="true"> |
| 141 | Allows placing the dock in all available slots. |
| 142 | </constant> |
| 143 | <constant name="DOCK_SLOT_NONE" value="-1" enum="DockSlot"> |
| 144 | The dock is closed. |
| 145 | </constant> |
| 146 | <constant name="DOCK_SLOT_LEFT_UL" value="0" enum="DockSlot"> |
| 147 | Dock slot, left side, upper-left (empty in default layout). |
| 148 | </constant> |
| 149 | <constant name="DOCK_SLOT_LEFT_BL" value="1" enum="DockSlot"> |
| 150 | Dock slot, left side, bottom-left (empty in default layout). |
| 151 | </constant> |
| 152 | <constant name="DOCK_SLOT_LEFT_UR" value="2" enum="DockSlot"> |
| 153 | Dock slot, left side, upper-right (in default layout includes Scene and Import docks). |
| 154 | </constant> |
| 155 | <constant name="DOCK_SLOT_LEFT_BR" value="3" enum="DockSlot"> |
| 156 | Dock slot, left side, bottom-right (in default layout includes FileSystem and History docks). |
| 157 | </constant> |
| 158 | <constant name="DOCK_SLOT_RIGHT_UL" value="4" enum="DockSlot"> |
| 159 | Dock slot, right side, upper-left (in default layout includes Inspector, Signal, and Group docks). |
| 160 | </constant> |
| 161 | <constant name="DOCK_SLOT_RIGHT_BL" value="5" enum="DockSlot"> |
| 162 | Dock slot, right side, bottom-left (empty in default layout). |
| 163 | </constant> |
| 164 | <constant name="DOCK_SLOT_RIGHT_UR" value="6" enum="DockSlot"> |
| 165 | Dock slot, right side, upper-right (empty in default layout). |
| 166 | </constant> |
| 167 | <constant name="DOCK_SLOT_RIGHT_BR" value="7" enum="DockSlot"> |
| 168 | Dock slot, right side, bottom-right (empty in default layout). |
| 169 | </constant> |
| 170 | <constant name="DOCK_SLOT_BOTTOM" value="8" enum="DockSlot"> |
| 171 | Bottom panel. |
| 172 | </constant> |
| 173 | <constant name="DOCK_SLOT_MAX" value="9" enum="DockSlot"> |
| 174 | Represents the size of the [enum DockSlot] enum. |
| 175 | </constant> |
| 176 | </constants> |
| 177 | </class> |