list all artworks from res://

I cannot simply explore the res:// filesystem on Android.
As a workaround, I create a static list of embedded artworks.
This commit is contained in:
Fabien Freling 2020-06-17 19:11:20 +02:00
parent e90eb40630
commit cd49ba8afc
8 changed files with 112 additions and 107 deletions

View file

@ -3,11 +3,25 @@ class_name ImagePicker
extends Panel
signal file_selected(path)
signal texture_selected(texture)
signal canceled()
var _fs_tab_index := 1
onready var fs_list := $VBoxContainer/TabContainer/Filesystem/FileList
func _ready():
fs_list.populate(OS.get_system_dir(OS.SYSTEM_DIR_PICTURES))
# 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))
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")