You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
@tool
|
|
|
|
|
extends Node3D
|
|
|
|
|
|
|
|
|
|
var animation_library = load("res://resource/skill_animation_library/animation_library.tres")
|
|
|
|
|
|
|
|
|
|
func get_resource_name(resource:Resource) -> String:
|
|
|
|
|
return resource.resource_path.get_file().trim_suffix('.tres') #todo 性能
|
|
|
|
|
|
|
|
|
|
func refresh_animation_lib():
|
|
|
|
|
var dir_path = "res://resource/skill_animation"
|
|
|
|
|
var dir = DirAccess.open(dir_path)
|
|
|
|
|
for file in dir.get_files():
|
|
|
|
|
var path = dir_path + "/" + file
|
|
|
|
|
var res = load(path)
|
|
|
|
|
if res is Animation:
|
|
|
|
|
var animation = res as Animation
|
|
|
|
|
var animation_name = Util.get_resource_name(animation)
|
|
|
|
|
animation_library.add_animation(animation_name,animation)
|
|
|
|
|
animation_library.animation_added.emit(animation_name)
|
|
|
|
|
|