forked from Fast-64/fast64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
f3d_generate_presets.py
29 lines (23 loc) · 927 Bytes
/
f3d_generate_presets.py
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
import os
basePath = "presets/f3d"
data = ""
presetList = "material_presets = {\n"
for subdir in os.listdir(basePath):
subPath = os.path.join(basePath, subdir)
if subdir != "__pycache__" and subdir != "user" and os.path.isdir(subPath):
presetList += '\t"' + subdir + '" : {\n'
for filename in os.listdir(subPath):
presetPath = os.path.join(subPath, filename)
if os.path.isfile(presetPath):
print(presetPath)
presetFile = open(presetPath, "r")
presetData = presetFile.read()
presetFile.close()
data += filename[:-3] + " = '''\n" + presetData + "'''\n\n"
presetList += '\t\t"' + filename[:-3] + '" : ' + filename[:-3] + ",\n"
presetList += "\t},\n"
presetList += "}\n"
data += presetList
outFile = open("f3d_material_presets.py", "w")
outFile.write(data)
outFile.close()