Godot-TextEditor/addons/text_editor/plugin.gd

27 lines
602 B
GDScript3
Raw Normal View History

2021-10-11 18:41:26 +02:00
tool
extends EditorPlugin
const TEPanel:PackedScene = preload("res://addons/text_editor/TextEditor.tscn")
var panel:Node
func get_plugin_name(): return "Text"
func get_plugin_icon(): return get_editor_interface().get_base_control().get_icon("Font", "EditorIcons")
func has_main_screen(): return true
func _enter_tree():
panel = TEPanel.instance()
panel.plugin = self
panel.plugin_hint = true
get_editor_interface().get_editor_viewport().add_child(panel)
make_visible(false)
func _exit_tree():
if panel:
panel.queue_free()
func make_visible(visible):
if panel:
panel.visible = visible