Godot-TextEditor/addons/text_editor/TE_MetaTabs.gd

25 lines
561 B
GDScript3
Raw Normal View History

2021-10-18 21:20:19 +02:00
tool
extends TabContainer
2021-10-19 01:50:21 +02:00
onready var editor:TE_Editor = owner
2021-10-18 21:20:19 +02:00
func _ready():
if not editor.is_plugin_active():
return
add_font_override("font", editor.FONT_R)
func _unhandled_key_input(e):
if not editor.is_plugin_active():
return
# Ctrl + M = meta tabs
if e.scancode == KEY_M and e.control and e.pressed:
2021-11-24 17:09:48 +01:00
get_parent().visible = not get_parent().visible
2021-10-18 21:20:19 +02:00
get_tree().set_input_as_handled()
2021-11-24 17:09:48 +01:00
func show_image(file_path:String):
get_parent().visible = true
current_tab = $image.get_index()
$image/image.texture = TE_Util.load_image(file_path)