Add the REM interface generators (tools) and ignore dumps, logs and server files
make_icon_3db, make_image_3db and make_hud_txm with their helpers, standalone (the name CRC table is in flcrc.py). The .gitignore keeps crash dumps, logs, traces, debug symbols and everything of the server out of the mod.
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
"""The REM HUD texture file (.txm) -- the icons drawn in the target brackets (rem_target_hud.cpp).
|
||||
|
||||
A .txm is a UTF file with one "Texture library" node, as DATA\\INTERFACE\\ButtonTextures.txm. Each
|
||||
PNG becomes a grey 32-bit TGA with alpha (brightest pixel white, three mips) named
|
||||
"REM_<name>.tga"; the HUD tints it with the bracket colour like Freelancer's own target corners.
|
||||
DATA\\INTERFACE\\REM\\rem_hud.ini lists the textures as shapes (tex_shape = REM_<name>.tga).
|
||||
|
||||
python tools/make_hud_txm.py <out.txm> <name>=<in.png> [<name>=<in.png> ...]
|
||||
|
||||
Example (the shipped file):
|
||||
|
||||
python tools/make_hud_txm.py DATA/INTERFACE/REM/rem_hud.txm \\
|
||||
skull=EXE/REM/UI/ICON/skull_icon.png \\
|
||||
probe=EXE/REM/UI/ICON/sensorprobe_active.png \\
|
||||
menu=EXE/REM/UI/ICON/target_menu.png
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.dirname(__file__))
|
||||
import make_icon_3db as icon # noqa: E402
|
||||
import utf # noqa: E402
|
||||
|
||||
TEX_SIZE = 64
|
||||
|
||||
|
||||
def make(out, entries):
|
||||
N = utf.Node
|
||||
textures = []
|
||||
for name, png in entries:
|
||||
w, h, rows = icon.read_png(png)
|
||||
w, h, rows = icon.crop_to_content(w, h, rows)
|
||||
mips = [icon.tga(icon.to_grey(icon.resample(w, h, rows, size)))
|
||||
for size in (TEX_SIZE, TEX_SIZE // 2, TEX_SIZE // 4)]
|
||||
textures.append(N('REM_' + name + '.tga', children=[N('MIP%d' % i, data=m) for i, m in enumerate(mips)]))
|
||||
root = N('\\', children=[N('Texture library', children=textures)])
|
||||
os.makedirs(os.path.dirname(os.path.abspath(out)), exist_ok=True)
|
||||
utf.write(out, root)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3 or any('=' not in a for a in sys.argv[2:]):
|
||||
print(__doc__)
|
||||
sys.exit(1)
|
||||
make(sys.argv[1], [a.split('=', 1) for a in sys.argv[2:]])
|
||||
print('wrote', sys.argv[1])
|
||||
Reference in New Issue
Block a user