Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
docs(video-loop): a jump whose body crosses the canvas is cut with --cycle once --start --length from its closest return, and the CHANGELOG's Unreleased (v3.12.1)
Soohong Kim0da5b27441e8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2a00793..3c0f61b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,15 @@All notable public changes to `sprite-gen` are recorded here. Versions track the `version:` field in `SKILL.md` and `pyproject.toml`.+## Unreleased (v3.12.1)++**Upgrading from 3.12.0: Thresholds, the search window, which clips are cut, and every cut's pictures and report values are the same as 3.12.0.** Only the refusal text changes where no pair of frames returns, and `--report` gains `cycle.closest_return`. The refusal now names the closest return, its frames, its ratio of departure, and that pair's moved instead of reporting `moved 0.00`. Where a pair returns but what lies between is not an action, or where no pair departs at all, the refusal line is the 3.12.0 line as before.++- **Fix: A one-shot cut where no pair of frames returns now names the closest return, its ratio and its moved instead of reporting `moved 0.00`.** In 3.12.0 and earlier, where no pair of frames returned, the refusal said `the clip never leaves its rest pose and returns with observed endpoints (moved 0.00, need 0.4)`. The moved it reported was the largest moved among pairs that had returned, and because none had, it always read 0.00; a body that jumps across the canvas therefore read as one that never moved. Where no pair returns, the refusal now names the closest return: the pair of frames whose return distance over departure is the least of every pair the search read, that ratio, and that pair's moved. After the fixed prefix, the line is `the clip does not come back to a pose it left: the closest return, frames A-B, is R of its departure away, over 0.25 (moved M, need 0.4)`. On a synthetic leap whose body lands 240 px along a 360 px canvas, the new line reads `frames 0-34, is 1.12 of its departure away, over 0.25 (moved 0.36, need 0.4)`. The report written with `--report` gains `cycle.closest_return` with keys `pair`, `ratio`, `seam`, `departure` and `moved`. Where a pair does return but what lies between is not an action (too little contrast or moved, fewer than four active frames, or a departure under three times the steps between its frames), or where no pair departs at all, the 3.12.0 line is printed as before.+- Python callers: `loop.ONE_SHOT_RETURN_MAX` names the return bound (0.25). The `CycleSelectionError` diagnostics of `detect_one_shot` carry `closest_return` where some pair departed.+- **Docs**: [video-pipeline.md](docs/video-pipeline.md) (section "One-shot actions") documents the return bound `ONE_SHOT_RETURN_MAX`, the refusal line, `cycle.closest_return`, and cutting canvas-crossing jumps with `--cycle once --start S --length L` from the closest return's frames. `SKILL.md` updates its single-play motion guidance with the same command and refusal quote.+- **Tests**: `tests/video/test_one_shot_refusal.py` adds five tests drawn with rectangles and no real footage: (1) a leap whose body crosses the canvas is refused on its closest return, naming the pair with the least return over departure in the searched window and matching `closest_return` in the report; (2) the same leap in place is cut from rest to rest; (3) in place, a take-off crouch and a landing crouch that are two different pictures, ending in the landing stance, is refused on its closest return; (4) a stand moved up to 3 px along and up or down every frame is refused across twelve seeds (the test runs one seed); (5) a clip that never departs is refused with the 3.12.0 line and no `closest_return`. Red first: on 3.12.0, 2 failed and 3 passed (tests 1 and 3 refused with `moved 0.00`); on 3.12.1, 5 passed.+## v3.12.0 - Prop plate painted on the canvas (video-canvas --prop-plate) and erased from keyed frames (video-frames --prop-plate <canvas report json>)**Upgrading from 3.11.0: runs without the new options produce unchanged outputs: every canvas, frame, strip, GIF, WebP, and report keeps its exact bytes (with only the loop report's `producer.implementation_sha256` changing with source code changes).**diff --git a/SKILL.md b/SKILL.mdindex c87f07a..6113118 100644--- a/SKILL.md+++ b/SKILL.md@@ -133,7 +133,7 @@ For attack repeat coverage, observed one-shot returns and structured loop failurEvery cut is read for held cells (neighbour cells showing the same picture), and by default they are filled with RIFE's frames between and the cut read again (`video-loop --fill-held auto`; `off` cuts as filmed). Tell the user each motion's poses over cells in one line from `held_fill` (`poses/cells`, before and after, e.g. `24/27` to `27/27`). A run whose frames between were all refused stays as filmed and is named in a `warning:` line: say so with its poses over cells. A cut wanted above its clip's rate is given with `--out-fps`, frames between, never repeats. Details in [loop repair](docs/loop-repair.md#7-held-cells-a-picture-shown-again-and-a-cut-at-a-higher-rate).-A move played once (a jump, a vault: `once`, `once-return`, `one-shot`) carries its root motion in the strip sidecar by default, the cells unchanged: `root_motion` gives each cell's root (the body's mass centre, cell px), what it stands on, and each air's take-off, landing, seconds and apex; a game reads `root` to place each cell and moves the body on its own physics. A move cut out of a longer motion is named with `video-loop --cycle once --start S --length L`, a hand on something the clip does not draw with `--contact hand=A:B`, metres with `--meters-per-px`. To give the air its own length, gravity and speed, `--air-retime gravity=G,air=T,speed=V` redraws it on that parabola with RIFE's frames between; contacts and the take-off and landing stay as filmed. Tell the user each air in one line, its seconds and its apex (the summary's `air`, e.g. `air 0.42 s, apex 0.21 m`). Details in [video-pipeline](docs/video-pipeline.md#root-motion--a-cut-played-once-where-the-body-is-what-it-stands-on-its-air).+A move played once (a jump, a vault: `once`, `once-return`, `one-shot`) carries its root motion in the strip sidecar by default, the cells unchanged: `root_motion` gives each cell's root (the body's mass centre, cell px), what it stands on, and each air's take-off, landing, seconds and apex; a game reads `root` to place each cell and moves the body on its own physics. A move cut out of a longer motion is named with `video-loop --cycle once --start S --length L`, a hand on something the clip does not draw with `--contact hand=A:B`, metres with `--meters-per-px`; a jump whose body crosses the canvas is named the same way, because it never comes back to a pose it left: the one-shot cut refuses it and its line names the closest return (`the closest return, frames A-B, is R of its departure away`), whose frames are where to start the range. To give the air its own length, gravity and speed, `--air-retime gravity=G,air=T,speed=V` redraws it on that parabola with RIFE's frames between; contacts and the take-off and landing stay as filmed. Tell the user each air in one line, its seconds and its apex (the summary's `air`, e.g. `air 0.42 s, apex 0.21 m`). Details in [video-pipeline](docs/video-pipeline.md#root-motion--a-cut-played-once-where-the-body-is-what-it-stands-on-its-air).For a move over an obstacle that clears a low wall (such as a vault or a jump), paint a flat magenta plate on the green key with `video-canvas --prop-plate` (which requires `--report`), then pass that canvas report to `video-frames --prop-plate <canvas report json>` to erase the plate from keyed frames. The plate box lives in the canvas report, which `video-frames` reads directly to scale and position the erase box; there is no second copy. If the video model drew the plate off its place by even a single pixel, grey blend lines remain down its sides: tell the user if any keyed frame kept lines of the plate. Details in [video-pipeline](docs/video-pipeline.md#prop-plate---prop-plate).diff --git a/docs/video-pipeline.md b/docs/video-pipeline.mdindex 46adbfa..7c04bee 100644--- a/docs/video-pipeline.md+++ b/docs/video-pipeline.md@@ -572,6 +572,20 @@ wrap plays like the step into that last frame. Where the pinned frame redraws th`--cycle once --start S --length L` plays exactly those frames once, a move cut out of a longer motion that settleson no pose ([root motion](#root-motion--a-cut-played-once-where-the-body-is-what-it-stands-on-its-air)).+A one-shot cut is accepted only where its two end frames return: the distance between the end frames is at most a quarter+of how far the body departs between them, bounded by `ONE_SHOT_RETURN_MAX` (0.25). Other existing rules then apply to what+lies between (contrast or moved mass over `ONE_SHOT_MIN_MOVED` 0.4, at least four active frames, a departure at least+three times the steps between frames, and rest frames on both sides). A jump whose body crosses the canvas lands where it+did not stand, so no two frames return and the one-shot cut refuses it. Where no pair returns, the refusal line names the+closest return: `the clip does not come back to a pose it left: the closest return, frames A-B, is R of its departure away, over 0.25 (moved M, need 0.4)`.+The report written with `--report` gains `cycle.closest_return` with keys `pair`, `ratio`, `seam`, `departure` and `moved`.++Such a jump is cut with `video-loop --cycle once --start S --length L`, starting from the closest return's frames: pass+`--start A` and `L` = B - A + 1, then move either end. Where a pair does return but what lies between is not an action+(too little contrast or moved, fewer than four active frames, or a departure under three times the steps between its+frames), or where no pair departs at all, the refusal gives the 3.12.0 line as before:+`the clip never leaves its rest pose and returns with observed endpoints (moved M, need 0.4)`.+`--cycle once-return` is for a clip pinned to end on its first frame that plays once (`video-set--play once-return`, [play modes](#play-modes)). It keeps every frame, the last too, so the stripstarts and ends on the first pose and a game plays it once and goes on from the pose it started in.