extends Control @export var path = "res://asset/art/scene/" @export var static_frames = preload("res://config/art/static_sprite_frames.tres") @onready var load_btn = %LoadButton as Button # Called when the node enters the scene tree for the first time. func _ready() -> void: load_btn.pressed.connect(_reload_all) func _reload_all(): static_frames.clear_all() var dir = DirAccess.open(path) as DirAccess static_frames.add_animation("placeholder") # static_frames.add_frame("placeholder", placeholder_texture) for c_dir in dir.get_directories(): print("c_dir=", c_dir) var c_path = path + c_dir + "/" var c_dir_access = DirAccess.open(c_path) as DirAccess for s_dir in c_dir_access.get_directories(): print("s_dir=", s_dir) var s_path = c_path + s_dir + "/" var s_dir_access = DirAccess.open(s_path) as DirAccess for png_file in s_dir_access.get_files(): if png_file.ends_with(".png"): #print("png_file=", png_file) var png_path = s_path + png_file var texture = load(png_path) as Texture var c = c_dir.split("_")[0] var s = s_dir.split("_")[0] var title = c + "_" + s + "_" + png_file.get_basename() static_frames.add_animation(title) static_frames.add_frame(title, texture) ResourceSaver.save(static_frames)