#@tool #extends SpriteFrames # #class_name AutoSpriteFrames # # #@export var base_location: String: get = base_location_get, set = base_location_set # ##func _get_property_list(): ## var properties = [] ## properties.append({ ## name = "base_location", ## type = TYPE_STRING ## }) ## return properties # #func base_location_set(bl): #print("BL", bl) ##if bl: ## base_location = bl ## reset_anims() # #func base_location_get(): #return base_location # #func get_pngs(path): #var result = [] #var subdir = DirAccess.open(path) # ##subdir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547 #var frame_name = subdir.get_next() #print(frame_name) #while frame_name != "": #if not subdir.current_is_dir(): # #if frame_name.ends_with(".png"): #print("adding frame", frame_name) #result.push_back(frame_name) #frame_name = subdir.get_next() # #result.sort() #return result # ## Called when the node enters the scene tree for the first time. #func reset_anims(): #self.clear_all() # # #var d = DirAccess.open(self.base_location) # #d.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547 #var file_name = d.get_next() #while file_name != "": #if d.current_is_dir() and file_name != ".." and file_name != ".": #for n in ["N", "E", "S", "W", "NE", "SE", "SW", "NW"]: #var current_animation = file_name + "_" + n #self.add_animation(current_animation) #self.set_animation_speed(current_animation, 16) #var base_path = self.base_location + "/" + file_name + "/" + n #print(base_path) #for f in get_pngs(base_path): #if self.get_frame_count("default") == 0: #self.add_frame("default", load(base_path + "/" + f)) #self.add_frame(current_animation, load(base_path + "/" + f)) #file_name = d.get_next() # # # ## Called every frame. 'delta' is the elapsed time since the previous frame. ##func _process(delta): ## pass