Initial Commit
This commit is contained in:
commit
48a5e71e00
1136 changed files with 64347 additions and 0 deletions
32
tools/create_skins.gd
Normal file
32
tools/create_skins.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
@tool
|
||||
extends EditorScript
|
||||
|
||||
var template: SpriteFrames = load("res://ChatAvatars/CatSlimes/SpriteFrames/white.tres")
|
||||
const assets_path: String = "res://ChatAvatars/CatSlimes/Assets/"
|
||||
const skins_path: String = "res://ChatAvatars/CatSlimes/SpriteFrames/"
|
||||
|
||||
# Called when the script is executed (using File -> Run in Script Editor).
|
||||
func _run() -> void:
|
||||
var folders = DirAccess.get_directories_at(assets_path)
|
||||
for folder in folders:
|
||||
var skin := folder.to_snake_case()
|
||||
if skin == "white": continue
|
||||
print("Generating Skin %s..." % [skin])
|
||||
var anims = template.get_animation_names()
|
||||
var sf: SpriteFrames = SpriteFrames.new()
|
||||
for anim in anims:
|
||||
sf.add_animation(anim)
|
||||
var anim_file_name = anim.capitalize()
|
||||
anim_file_name = "".join(anim_file_name.split(" "))
|
||||
var anim_file := assets_path.path_join(folder).path_join(anim_file_name) + ".png"
|
||||
var img := load(anim_file)
|
||||
for i in template.get_frame_count(anim):
|
||||
var txtr: AtlasTexture = template.get_frame_texture(anim, i)
|
||||
var frame: AtlasTexture = AtlasTexture.new()
|
||||
frame.atlas = img
|
||||
frame.region = txtr.region
|
||||
sf.add_frame(anim, frame)
|
||||
sf.remove_animation(&"default")
|
||||
ResourceSaver.save(sf, skins_path.path_join(skin) + ".tres")
|
||||
print("Saved to: %s" % [skins_path.path_join(skin) + ".tres"])
|
||||
print ("Done.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue