Preload all textures
This commit is contained in:
@@ -6,24 +6,15 @@ func _ready() -> void:
|
||||
func update_background_list() -> void:
|
||||
clear()
|
||||
var i : int = 0
|
||||
for file in DirAccess.get_files_at("res://Backgrounds"):
|
||||
if file.ends_with(".png.import"):
|
||||
add_item(file.left(-11), i)
|
||||
set_item_metadata(i, "res://Backgrounds/%s" % file.left(-7))
|
||||
i += 1
|
||||
for file in DirAccess.get_files_at("user://Backgrounds"):
|
||||
if file.ends_with(".png"):
|
||||
add_item(file.left(-11), i)
|
||||
set_item_metadata(i, "user://Backgrounds/%s" % file)
|
||||
i += 1
|
||||
var keys = Global.Backgrounds.keys()
|
||||
keys.sort()
|
||||
for bg in keys:
|
||||
add_item(bg)
|
||||
|
||||
func select_by_name(name : String) -> void:
|
||||
for i in item_count:
|
||||
if get_item_text(i) == name:
|
||||
selected = i
|
||||
|
||||
func get_selected_filename() -> String:
|
||||
return get_item_metadata(selected)
|
||||
|
||||
func get_selected_text() -> String:
|
||||
return get_item_text(selected)
|
||||
|
||||
Reference in New Issue
Block a user