godot-xterm/addons/godot_xterm/plugin.gd

39 lines
1.1 KiB
GDScript
Raw Permalink Normal View History

2022-11-09 21:57:46 +01:00
@tool
2020-05-09 19:07:31 +02:00
extends EditorPlugin
var pty_supported := OS.get_name() in ["Linux", "FreeBSD", "NetBSD", "OpenBSD", "BSD", "macOS"]
var asciicast_import_plugin
var xrdb_import_plugin
var terminal_panel: Control
2020-05-09 19:07:31 +02:00
func _enter_tree():
asciicast_import_plugin = preload("./import_plugins/asciicast_import_plugin.gd").new()
add_import_plugin(asciicast_import_plugin)
xrdb_import_plugin = preload("./import_plugins/xrdb_import_plugin.gd").new()
add_import_plugin(xrdb_import_plugin)
var asciicast_script = preload("./resources/asciicast.gd")
add_custom_type("Asciicast", "Animation", asciicast_script, null)
if pty_supported:
2022-11-09 21:57:46 +01:00
terminal_panel = preload("./editor_plugins/terminal/terminal_panel.tscn").instantiate()
terminal_panel.editor_plugin = self
terminal_panel.editor_interface = get_editor_interface()
add_control_to_bottom_panel(terminal_panel, "Terminal")
2020-05-09 19:07:31 +02:00
func _exit_tree():
remove_import_plugin(asciicast_import_plugin)
asciicast_import_plugin = null
remove_import_plugin(xrdb_import_plugin)
xrdb_import_plugin = null
remove_custom_type("Asciicast")
if pty_supported:
remove_control_from_bottom_panel(terminal_panel)
terminal_panel.free()