2020-06-16 19:28:50 +02:00
|
|
|
tool
|
|
|
|
class_name ImagePicker
|
|
|
|
extends Panel
|
|
|
|
|
|
|
|
signal file_selected(path)
|
2020-06-17 19:11:20 +02:00
|
|
|
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():
|
2020-06-17 19:11:20 +02:00
|
|
|
# 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)
|
2020-06-17 19:11:20 +02:00
|
|
|
|
|
|
|
func _on_FileList_texture_selected(texture):
|
|
|
|
emit_signal("texture_selected", texture)
|
|
|
|
|
|
|
|
func _on_Cancel_pressed():
|
|
|
|
emit_signal("canceled")
|