Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

refactor(video-loop): a loop report's kind and the status of a delivered one are named once in video/loop.py, as REPORT_KIND and REPORT_PASSED, which loop writes and align, compare, source and the source-restoration demo read

Soohong Kimca872c6a3734
diff --git a/scripts/dev/source_restoration_demo.py b/scripts/dev/source_restoration_demo.py
index 0c40539..b6c9ff2 100644
--- a/scripts/dev/source_restoration_demo.py
+++ b/scripts/dev/source_restoration_demo.py
@@ -205,7 +205,7 @@ def write_delivered(out: Path, source: dict[str, Path]) -> tuple[dict[str, Path]
"cycle_frames": N, "subsampled": False, "loop": True, "scale": round(1 / ZOOM, 4),
"source_rect": [0, 0, SW, SH], "sample_indices": list(range(N)), "foot_anchor": "none",
"source_cut": {"source": identity, "start": 0, "length": N, "samples": list(range(N))}}
- report = {"kind": "sprite-gen-video-loop-report", "status": "passed", "fps": FPS, "frames_total": N,
+ report = {"kind": loop.REPORT_KIND, "status": loop.REPORT_PASSED, "fps": FPS, "frames_total": N,
"source": identity, "cycle": {"start": 0, "length": N}, "anchor": "none",
"jump_repair": {"replaced": list(DAMAGED), "facing": "right"}, "strip": meta, "n_out": N, "delay_ms": DELAY,
"note": ("synthetic stand-in for a delivered loop: cells cut by the loop recipe from drawn keyed frames; "
diff --git a/sprite_gen/video/align.py b/sprite_gen/video/align.py
index 684aa55..5de225d 100644
--- a/sprite_gen/video/align.py
+++ b/sprite_gen/video/align.py
@@ -897,7 +897,7 @@ def cut_report(loop_dir: Path, meta_path: Path, meta: dict[str, Any]) -> tuple[P
data = json.loads(path.read_text(encoding="utf-8"))
except (OSError, ValueError):
continue
- if not isinstance(data, dict) or data.get("kind") != "sprite-gen-video-loop-report" or data.get("status") != "passed":
+ if not isinstance(data, dict) or data.get("kind") != loop_mod.REPORT_KIND or data.get("status") != loop_mod.REPORT_PASSED:
continue
cycle = data.get("cycle") or {}
if (Path(str((data.get("strip") or {}).get("path", ""))).name == strip_name
diff --git a/sprite_gen/video/compare.py b/sprite_gen/video/compare.py
index 5e4f0dc..1577f9c 100644
--- a/sprite_gen/video/compare.py
+++ b/sprite_gen/video/compare.py
@@ -92,7 +92,7 @@ class Loop:
cycle = self.source_report.get("cycle")
if not all(isinstance(v, dict) for v in (cut, src, cycle)):
return "source-provenance-missing"
- if self.source_report.get("kind") != "sprite-gen-video-loop-report" or self.source_report.get("status") != "passed":
+ if self.source_report.get("kind") != loop_mod.REPORT_KIND or self.source_report.get("status") != loop_mod.REPORT_PASSED:
return "source-report-unverified"
sha = src.get("sha256")
if (src.get("kind") != "keyed-frame-sequence" or not isinstance(sha, str) or len(sha) != 64
diff --git a/sprite_gen/video/loop.py b/sprite_gen/video/loop.py
index 1b0f01a..0496b0c 100644
--- a/sprite_gen/video/loop.py
+++ b/sprite_gen/video/loop.py
@@ -87,6 +87,10 @@ PERIODICITY_MIN = 0.15 # the period must dip at least 15% below the profile mea
# Where a size hold or the gait fallback writes the frames it scaled back: a folder of the run's own in the out dir,
# `.gait-fallback-frames.<pid>-<random>` (`_Scratch`), removed however the run ends.
FALLBACK_FRAMES = "gait-fallback-frames"
+# What a video-loop report is (its `kind`), and the `status` of one whose cut was handed over: align, compare and
+# source read a report as a delivered loop's only when it says both.
+REPORT_KIND = "sprite-gen-video-loop-report"
+REPORT_PASSED = "passed"
GIF_FPS_DEFAULT = 24.0 # GIF/WebP playback density = the source rate: every cycle frame is kept, a fast action never looks slow (12 made a jump read sluggish, 2026-09-09)
GIF_FRAMES_MIN = 4
ONE_SHOT_MIN_CONTRAST = 3.0 # one-shot: the excursion peak must stand this far above the rest-pose noise (in MADs)
@@ -2407,7 +2411,7 @@ def _cut_loop(
masses = effect.frame_masses(files) if cycle_mode == "lifetime" else frame_masses(files)
periodic_attempt: dict[str, Any] | None = None
report_base = {
- "kind": "sprite-gen-video-loop-report", "frames_dir": str(frames_dir),
+ "kind": REPORT_KIND, "frames_dir": str(frames_dir),
"source": evidence_mod.source_identity(files, fps),
"producer": evidence_mod.engine_identity(),
"out_dir": str(out_dir), "state": state, "fps": fps, "frames_total": n,
@@ -3215,7 +3219,7 @@ def _cut_loop(
payload = {
**report_base,
- "kind": "sprite-gen-video-loop-report",
+ "kind": REPORT_KIND,
"frames_dir": str(frames_dir),
"out_dir": str(out_dir),
"state": state,
@@ -3230,7 +3234,7 @@ def _cut_loop(
"n_out": n_out,
"gif_fps": gif_fps,
"delay_ms": delay_ms,
- "status": "passed",
+ "status": REPORT_PASSED,
"resampled_seam": resampled_seam,
"resampled_inner_mean_adjacent": resampled_adjacent,
"resampled_seam_ratio": None if single_play else round(seam_ratio, 4),
diff --git a/sprite_gen/video/source.py b/sprite_gen/video/source.py
index 0dc1c54..ad7050e 100644
--- a/sprite_gen/video/source.py
+++ b/sprite_gen/video/source.py
@@ -167,7 +167,7 @@ def project(baseline: Any, source: Source) -> tuple[Projection | None, str | Non
from sprite_gen.video.frames import drop_specks
m, report = baseline.meta, baseline.source_report
- if report.get("kind") != "sprite-gen-video-loop-report" or report.get("status") != "passed":
+ if report.get("kind") != loop.REPORT_KIND or report.get("status") != loop.REPORT_PASSED:
return None, "source-report-unverified"
if loop.sway_recorded(m):
return None, "follow-source-warp-unverified"