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.")
|
||||
1
tools/create_skins.gd.uid
Normal file
1
tools/create_skins.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://da4jhwvbt1r5s
|
||||
23
tools/typed_object_set.gd
Normal file
23
tools/typed_object_set.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
@tool
|
||||
extends EditorScript
|
||||
|
||||
class Test:
|
||||
var my_typed_dict: Dictionary[String, int] = {}
|
||||
var my_typed_array: Array[int]
|
||||
|
||||
# Called when the script is executed (using File -> Run in Script Editor).
|
||||
func _run() -> void:
|
||||
var obj: Test = Test.new()
|
||||
var dict_data = "{\"test\": 1, \"alpha\": 2}"
|
||||
var array_data = "[13,12,5]"
|
||||
print("Normal Object.set()")
|
||||
obj.set("my_typed_dict", JSON.parse_string(dict_data))
|
||||
obj.set("my_typed_array", JSON.parse_string(array_data))
|
||||
print("Typed Dictionary: ", obj.my_typed_dict)
|
||||
print("Typed Array: ", obj.my_typed_array)
|
||||
|
||||
print("Typed Object.get().assign()")
|
||||
obj.get("my_typed_dict").assign(JSON.parse_string(dict_data))
|
||||
obj.get("my_typed_array").assign(JSON.parse_string(array_data))
|
||||
print("Typed Dictionary: ", obj.my_typed_dict)
|
||||
print("Typed Array: ", obj.my_typed_array)
|
||||
1
tools/typed_object_set.gd.uid
Normal file
1
tools/typed_object_set.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://ccxhqc4cqxt7l
|
||||
Loading…
Add table
Add a link
Reference in a new issue