Continued the full-art goal. H07 now has idle AND attack at H01 fidelity, making it the reusable per-hero template for batch generation. - Real attack pose generated (gpt-image-2.5, identity-locked to H07 base): a proper bow-draw archer pose, not a procedural stand-in. attack-source.png 1254x1254, clean magenta, fully decoded. - Derived 4-frame action from the accepted pose (derive_action_frames.py), packed to a 384x96 runtime atlas with provenance (task id, source, anchor). - breathing_test now asserts H07 attack too: BREATHING_PASS 16 stages, both idle and attack advance real frames (indices 0,1,2). - KEY LESSON documented in PRODUCTION/50: CDN signed URLs expire — on a truncated/failed download, re-GET the task for a FRESH signed URL (the sha directory changes); then a single --proxy '' --noproxy '*' --compressed transfer succeeds. This was why the idle strip kept failing. Full-game art coverage: heroes H01-H07 (H07 = complete template), R1 enemies, B01. Remaining: H08-H54, R2-R5 enemies, B02-B20. All gates pass; P2_CHECKS_PASS. prototype/ untracked.
48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
"""Derive a short action loop from a single accepted action-pose portrait.
|
|
|
|
Unlike idle (breathing), an action pose is a single key frame. We derive a
|
|
subtle 4-frame beat from it — a small scale/position pulse that reads as the
|
|
attack settling/releasing — so the runtime has a real multi-frame clip even
|
|
when only one AI pose was obtained. The pose itself is the accepted AI art.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from pathlib import Path
|
|
from PIL import Image
|
|
|
|
|
|
def main() -> int:
|
|
ap = argparse.ArgumentParser(description=__doc__)
|
|
ap.add_argument("--input", required=True, type=Path, help="transparent action-pose PNG")
|
|
ap.add_argument("--output-dir", required=True, type=Path)
|
|
ap.add_argument("--frames", type=int, default=4)
|
|
ap.add_argument("--kind", choices=("attack", "hit"), default="attack")
|
|
args = ap.parse_args()
|
|
|
|
src = Image.open(args.input).convert("RGBA")
|
|
w, h = src.size
|
|
args.output_dir.mkdir(parents=True, exist_ok=True)
|
|
# (x shift, y shift, scale factor) per frame — a gentle action beat.
|
|
if args.kind == "attack":
|
|
beats = [(0, 0, 1.0), (-2, 0, 1.02), (1, 1, 0.99), (0, 0, 1.0)]
|
|
else:
|
|
beats = [(0, 0, 1.0), (2, 1, 0.98), (-1, 0, 1.01), (0, 0, 1.0)]
|
|
for i in range(args.frames):
|
|
dx, dy, sc = beats[i % len(beats)]
|
|
frame = Image.new("RGBA", (w, h), (0, 0, 0, 0))
|
|
if abs(sc - 1.0) > 1e-6:
|
|
nw, nh = int(w * sc), int(h * sc)
|
|
scaled = src.resize((nw, nh), Image.NEAREST)
|
|
frame.alpha_composite(scaled, ((w - nw) // 2 + dx, (h - nh) // 2 + dy))
|
|
else:
|
|
frame.alpha_composite(src, (dx, dy))
|
|
frame.save(args.output_dir / f"frame-{i}.png")
|
|
print(f"derived {args.frames} {args.kind} frames -> {args.output_dir}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|