mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 01:00:13 +02:00
A SteamVR dashboard patch (vr-pet) drawing a baked 3D pet next to the windows: the Toon Cat in five coats, a Shiba Inu, a Fox and a Dachshund, plus models from steamFrame.pet.extraModels. It walks around, follows, sits, lies and sleeps, can be picked up by its grip bar, petted and switched in its menu; its spot, pose and model are saved state. Also the vr-pet command, "Pet" in the "+" menu with the current model's icon (steam-frame-nix-pet-icon), the flake outputs pet-models, pet-icons and pet-preview, and the check pet. A built-in model with "private": true fails evaluation; private models belong in extraModels.
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
"""The "+" menu icons (package.nix `icons`): one per model folder, 256 px
|
|
square, transparent around a visible animal, and default.txt naming one.
|
|
|
|
usage: icons.test.py models-dir icons-dir
|
|
"""
|
|
import os
|
|
import sys
|
|
from PIL import Image
|
|
|
|
models, icons = sys.argv[1:3]
|
|
ids = sorted(d for d in os.listdir(models) if os.path.isdir(os.path.join(models, d)))
|
|
pngs = sorted(f[:-4] for f in os.listdir(icons) if f.endswith('.png'))
|
|
assert pngs == ids, f'icons {pngs} != model folders {ids}'
|
|
for i in ids:
|
|
im = Image.open(os.path.join(icons, i + '.png'))
|
|
assert im.size == (256, 256) and im.mode == 'RGBA', f'{i}: {im.size} {im.mode}'
|
|
a = im.getchannel('A')
|
|
assert a.getpixel((0, 0)) == 0, f'{i}: corner not transparent'
|
|
assert sum(a.histogram()[129:]) > 256 * 256 // 10, f'{i}: hardly anything drawn'
|
|
default = open(os.path.join(icons, 'default.txt')).read().strip()
|
|
assert default in ids, f'default.txt: {default!r}'
|
|
print(f'ok icons: {len(ids)} ({", ".join(ids)}), 256 px; default {default}')
|