#!/usr/bin/env bash # 화면 UI 미리보기: 빌드 → 저장 버전 업로드 → 로블록스 서버에서 UI 덤프(장면 6개씩 나눠서) → 그림(PNG)으로. # tools/preview.sh 출력폴더 [장면이름...] set -euo pipefail cd "$(dirname "$0")/.." export PATH="$HOME/.rokit/bin:$PATH" out=${1:-.cache/preview} shift || true mkdir -p .cache "$out" rojo build default.project.json -o build/BunsikTycoon.rbxl >/dev/null ver=$(python3 tools/cloud.py publish build/BunsikTycoon.rbxl | awk '{print $2}') if [ $# -gt 0 ]; then names="$*" else names=$(grep -o 'shot(\s*"[a-z_0-9]*"\|^\s*"[a-z_0-9]*",$' tests/cloud/dump_gui.luau | grep -o '"[a-z_0-9]*"' | tr -d '"' | tr '\n' ' ') fi rm -f .cache/gui_part_*.json i=0 batch=() run_batch() { local list list=$(printf '"%s",' "${batch[@]}") sed "s/^local ONLY: { string }? = nil/local ONLY: { string }? = { ${list%,} }/" tests/cloud/dump_gui.luau >.cache/dump_gui_batch.luau python3 tools/cloud.py run .cache/dump_gui_batch.luau --version "$ver" --out ".cache/gui_part_$i.json" >.cache/dump_raw.txt || { tail -20 .cache/dump_raw.txt; exit 1; } i=$((i + 1)) batch=() } for n in $names; do batch+=("$n") if [ ${#batch[@]} -ge 6 ]; then run_batch; fi done if [ ${#batch[@]} -gt 0 ]; then run_batch; fi python3 - <<'PY' import glob, json shots, images = [], {} for f in sorted(glob.glob(".cache/gui_part_*.json")): d = json.load(open(f)) shots += d["shots"] images.update(d["images"]) json.dump({"shots": shots, "images": images}, open(".cache/gui_dump.json", "w")) PY python3 tools/gui_render.py .cache/gui_dump.json "$out"