-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateGuidMap.py
More file actions
40 lines (39 loc) · 1.47 KB
/
GenerateGuidMap.py
File metadata and controls
40 lines (39 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import yaml
import json
def genTexGuids():
tex = os.listdir("Texture2D")
txmap = {}
for texture_file in tex:
if "meta" in texture_file:
with open("Texture2D/" + texture_file, 'r') as f:
meta = yaml.load(f)
# why developers why
if "aki_3m_projectile" in texture_file:
txmap[meta['guid']] = "aki_3m_projectile."
txmap[meta['guid']] = texture_file.split('.')[0]
with open("TextureGUID.json", 'w') as f2:
json.dump(txmap, f2)
def genSpriteGuids():
sprite = os.listdir("Sprite")
spritemap = {}
i = 0
for sprite_file in sprite:
if "meta" in sprite_file:
with open("Sprite/" + sprite_file, 'r') as f:
with open("Sprite/" + sprite_file[:-5], 'r') as f2:
meta = yaml.load(f)
spriteraw = yaml.load(f2, Loader=yaml.BaseLoader)
# why developers why
if "aki_3m_projectile" in sprite_file:
spritemap[meta['guid']] = ".".join(sprite_file.split('.')[0:2])
else:
spritemap[meta['guid']] = {"file": sprite_file.split('.')[0], "offset": spriteraw["Sprite"]['m_Offset']}
i += 1
if i % 100 == 0:
print(i)
with open("SpriteGUID.json", 'w') as f2:
json.dump(spritemap, f2)
if __name__ == "_main__":
genTexGuids()
genSpriteGuids()