taqin/src/ImagePicker.gd

28 lines
640 B
GDScript3
Raw Normal View History

2020-06-16 19:28:50 +02:00
tool
class_name ImagePicker
extends Panel
signal file_selected(path)
signal texture_selected(texture)
signal canceled()
var _fs_tab_index := 1
2020-06-16 19:28:50 +02:00
onready var fs_list := $VBoxContainer/TabContainer/Filesystem/FileList
func _ready():
# TODO: fix Android
if OS.get_name() == "Android":
$VBoxContainer/TabContainer.set_tab_disabled(_fs_tab_index, true)
else:
fs_list.populate(OS.get_system_dir(OS.SYSTEM_DIR_PICTURES))
2020-06-16 19:28:50 +02:00
func _on_FileList_file_selected(path):
emit_signal("file_selected", path)
func _on_FileList_texture_selected(texture):
emit_signal("texture_selected", texture)
func _on_Cancel_pressed():
emit_signal("canceled")