Add custom dock plugin

This commit is contained in:
James Skemp 2023-12-02 17:34:22 -06:00
parent ceafcfc799
commit 8674071819
3 changed files with 18 additions and 3 deletions

View File

@ -1,12 +1,20 @@
@tool
extends EditorPlugin
var dock
func _enter_tree():
# Initialization of the plugin goes here.
pass
# Load and instantiate the dock scene.
dock = preload("res://addons/my_custom_dock/my_dock.tscn").instantiate()
# Add the loaded scene to the dock.
# Left ot the editor, Upper Left (UL).
add_control_to_dock(DOCK_SLOT_LEFT_UL, dock)
func _exit_tree():
# Clean-up of the plugin goes here.
pass
# Remove the dock.
remove_control_from_docks(dock)
# Free from memory.
dock.free()

View File

@ -0,0 +1,7 @@
[gd_scene format=3 uid="uid://beaqgns7vwsyt"]
[node name="My Dock" type="Button"]
offset_right = 40.0
offset_bottom = 40.0
theme_override_font_sizes/font_size = 24
text = "Click My Dock Button!"

View File

@ -16,7 +16,7 @@ config/icon="res://icon.svg"
[editor_plugins]
enabled=PackedStringArray("res://addons/my_custom_node/plugin.cfg")
enabled=PackedStringArray("res://addons/my_custom_dock/plugin.cfg", "res://addons/my_custom_node/plugin.cfg")
[rendering]