Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
docs(changelog): the v4.0.0 section shows the before and after GIF of a loop's wrap and lists the two alignment tests' timeout, pins and slow mark
Soohong Kime192c3839549
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 58abc42..4294c37 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -28,6 +28,10 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the### No picture shown again by default+The clip is a walk 24 frames long whose loop comes back to its first picture and stays there: when cut to 26 cells, its last two cells (24 and 25) show the same picture as cell 0, so three cells in a row across the loop's wrap show one picture and the foot stops there on every loop. Both panels cut the same frames with rife-v4.25 and default settings. The left panel is the cut made by 3.15.0, labelled "3.15.0 poses 25/26", which kept those two last cells as filmed because a run that ended on a loop's last cell was not filled and the step across the wrap was not read, while the right panel is the cut made by 4.0.0, labelled "4.0.0 poses 26/26", where 4.0.0 reads the loop as a ring and makes cells 24 and 25 again with RIFE between cell 23 and cell 0 (cell 0 unchanged), each cell RIFE made is outlined in blue on the right, and the foot keeps moving through the wrap.+++- **Changed: `video-loop` reads a loop as a ring, so a run that ends on the loop's last cell and a cut one cell too long are made again (`held_fill.wrap_same`, `held_fill.before.wrap`, `held_fill.wrap_held`).** Before, a run that ended on a loop's last cell was kept as filmed and the last cell and the first were never read as a run. Now the run that ends on the last cell is made again between its first cell and the loop's first cell (its next pose is the first cell, across the wrap); the first cell is never changed. When the last cell (or last cells) shows the picture of the first cell, the wrap steps from a picture to the same picture: those last cells are made again between the cell before them and the first cell, and the first cell stays, read on the cut's frames as filmed (`held_fill.wrap_same`). A run joined across the wrap (cells at the end plus cells at the start, all one picture) longer than `HOLD_MAX` 3 cells in total is a hold the motion means: both parts are kept as filmed. A frame made at the wrap is judged as every frame the fill makes; refused, the cells are kept as filmed and a `warning:` line names them and the faults. `held_fill.before.wrap` records the run across the wrap (`start`, `length`, `joined`, `filled`, `made`), `held_fill.wrap_held` says the cut as filmed showed one picture across its wrap, and a loop's last cell that shows its first cell's picture is not counted as a pose.- **New: the cut is read again after its repairs (`held_fill.again`).** The fill runs where it ran before: after the anchor and `source_projection`, before the ghost screen, the wrap blend, the part pop and the jump repair. Once the repairs have run (the jump repair, the ghost RIFE frames, the eased retime, the overlapped wrap, the wrap blend, the part pop, the seam bridge), the cut is read again for held cells, and a run a repair left (one the first fill did not see) is made again the same way, judged the same way, with the same keeps. It is recorded as `held_fill.again` in the loop report and the strip metadata (`before`, `made`, `frames`, `cells`, `poses`, `held_runs`); its `warning:` lines start with `read again after the repair:`. A filmed ghost the repair gave way to the frame beside it (`ghost_given_way`) is not tried again; its own warning already names it. The repairs themselves are unchanged: they keep the cut's cell count and beat and are not a fill. `--fill-held off` turns the read-again off too. Measured on the tests' synthetic walker without a staff: its repairs left four runs and one wrap step showing a picture again (42/48 poses/cells); read again, it is 48/48.- **New: a run kept as the motion means it carries `keep`, `held_fill.KEEPS` names the kinds, and the strip metadata gains `holds` and `fps` (`held_fill.intended`, `held_fill.strip_holds`).** The rules for a hold the motion means are unchanged: a run longer than `HOLD_MAX` 3 cells (`motion-hold`); every run of a cut drawn on twos or threes (`drawn`); the opening pose (`opening`) and the closing pose (`closing`) of a cut played once (one-shot, once, once-return); `hold_last`; atlas clones. Each run kept for one of these reasons carries `keep` (its kind) in `held_fill.before.held_runs`, and `held_fill.KEEPS` names the kinds: `motion-hold`, `drawn`, `opening`, `closing`. The strip metadata (`<name>.strip.json`) gains `holds`: a list of `{from, to, kind, reason}`, one per kept run, as cells of the strip (`from` and `to` both included), the same list form a renderer's hold list uses; `inspect-holds` and `scene-render` read it as holds meant. `held_fill.intended(record)` gives the runs, `held_fill.strip_holds` maps them onto the strip's cells. The strip metadata also gains `fps`, the strip's exact rate (cells over the cycle's seconds, rounded to 6 places), next to `delay_ms`, which stays rounded to hundredths.@@ -43,7 +47,7 @@ All notable public changes to `sprite-gen` are recorded here. Versions track the- **Fixed: `inspect-holds` reads a frame's largest part as a figure however few pixels it has, reads nothing in a `--box` that holds no pixel, exits 2 where no frame was read against the frame before, and reports `steps` and `inspected`; the Grok clip reading of `video`, `video-extend`, `video-edit` and `video-resume` does not read a clip whose every frame is the canvas alone.** A part is a speck, and is not read, where it holds under 2 % of the pixels of the frame's largest part, or under 64 px; the 64 px floor applied to every part, the frame's largest included, so a frame whose only figure had under 64 px read no figure at all: a 7 x 9 block (63 px) shown on three identical frames of a 24 x 24 clear canvas read an empty table and `--gate` exited 0 with nothing on stderr, although its frames 1 and 2 show the picture of the frame before, where an 8 x 8 block (64 px) read 2 unlisted holds and `--gate` exited 1. Now the 64 px floor is never more than half the frame's largest part, so the largest part is always a figure and a part half its size or more is a figure too (two small figures in one frame are both read); both blocks read 2 unlisted holds (frames 1-2) and `--gate` exits 1, and where a frame's largest part has 128 px or more the rule is exactly what it was. Dots of 1, 2 and 3 px far from the figure, the same on every frame, are still not read. With `--box`, two frames whose box held no pixel with alpha over 8 (clear there, or past the frame's edge) read as one picture shown again, so a box over clear frames, or past the frame's edge, read a hold on every frame after the first; now such a frame shows no figure there and two such frames are no picture shown again. The report gains each figure's `steps` (its frames read against the frame before; on a loop read across its wrap, the wrap is one step) and `inspected` (the number of figures read on one step or more); the other fields are unchanged, exit 0, 1 and 2 keep their meanings, and a reading that reads no frame against the frame before is now one of the errors (exit 2). A reading that reads no frame against the frame before (no frame: an empty folder, `--frames` that starts past the last frame of a folder, a video, a strip or a log, a log of no line; no figure on any frame: clear frames, frames whose every pixel has alpha 8 or under, a key that leaves nothing, a box that holds nothing, a log whose `--log-figure` keys name no cell on any line; no figure shown on two frames in a row, for example one frame) is an error: it exits 2 with or without `--gate`, its report is still printed on stdout and written to `--report` with `inspected` 0, and one line on stderr says why. Before, most of these passed `--gate` (exit 0, an empty table, nothing on stderr); an empty folder and a log of no line exited 2 but printed no report; a strip given `--frames` past its last cell was refused with the wrong reason (as opaque frames); a box over nothing failed the gate on frames that showed nothing. In Python, `inspect(...)` and `read(...)` in `sprite_gen.qa.holds` raise `NothingRead`, a `ValueError` whose `report` attribute is the report, with `inspected` 0. The Grok clip reading of `video`, `video-extend`, `video-edit` and `video-resume` read a clip whose every frame is the canvas alone (no pixel left once the canvas colour is taken out) as one run of all its frames, recorded as a hold the motion means, and said nothing; now such a clip is not read, its report's `held` is `read` false with `frames`, `background` and a `why`, the warning line says its frames were not read for a picture shown again, and the clip is still published.- **New: `sprite-gen video-chain` plays pieces of keyed clips as one move at the caller's time (`--piece`, `--bridge`, `--out-fps`, `--places`, `--holds`, `--refuse`, `--fill-held`, `--gate`).** It joins keyed clips of matching canvas, key and rate, making frames between join points or retimed places with RIFE. A run of frames showing one picture, unless a list of holds meant names it, is made again between the poses beside it, and any unlisted frame showing the picture before it fails the run. Pieces that disagree in size, key, or rate, opaque frames, overlapping paths, or places off the chain refuse the run before anything is touched. By default every fault the judge finds refuses a frame; `--refuse` names those that do; which to leave out is the caller's to decide by looking at the material; `held`, the bar a frame made off its time must stand under and the final reading refuse whatever it says; a fault left out stays on the frame's record and a `warning:` line; the judge and its bars do not change. `held_fill` gains `FAULTS` and a `refuse` argument on `at_times` and `fill`, `loop.fill_cut` gains `refuse`, `frames` gains `KEYS_READ` and `key_kind`, a `held_fill` try gains `judged` and, with `refuse`, `kept_faults`, and the `video-frames` report gains `key_read`.- **Python callers.** `held_fill`: new `wrap_same`, `KEEPS`, `intended`, `again`, `strip_holds`; `premultiplied` (was `_premultiplied`); `fill(..., wrap=, drawn_on=)`; `reading(..., wrap=)`. `loop`: new `cut_again`; `fill_cut`, `fill_lines`, `out_fps_lines` (were `_fill_held`, `_fill_lines`, `_out_fps_lines`). `align`: new `filled`, `unfilled_source`, `CUT_AGAIN_DIR`; `align_set(..., fill_held=, out_fps=)`. `batch`: new `held_summary`, `loop_summary`, `cut_again_unaligned`; `align_gaits(..., fill_held=, out_fps=)`. `spec.assets`: new `frame_seconds`, `SNAP_MS`, `FrameSequence.index_at`. `scene.render.Renderer(..., fill_held=, interpolate=, between_cache=)`. New module `sprite_gen.qa.holds`. `stop.make_stop(..., fill_held=, interpolate=)`.-- **Tests: `tests/video/test_no_repeat_default.py`, `tests/scene/test_scene_fill_held.py`, `tests/qa/test_inspect_holds.py`, `tests/gen/test_video_held.py`, `tests/video/test_face_bake_held.py` (new); `tests/video/test_held_fill.py`, `tests/video/test_stop.py`, `tests/video/test_face_layer.py`, `tests/video/test_root_motion.py`, `tests/video/test_loop_prop_seam_held.py`, `tests/video/test_motion_anchor.py` (changed).** `test_no_repeat_default.py` covers a loop's last cells, a cut one cell too long, the read again after the repairs, the strip's `holds`, `cut_args` and `cut_again`, the lifetime warning, the alignment's end fill, its cut again with the fill off and its refusal, `--out-fps` once aligned, a set with no held cell aligned as before, and `video-set` cutting aligned items as filmed and cutting again the ones no alignment took. `test_held_fill.py`'s wrap tests: a run at a loop's wrap is made, a last cell showing the first again is made and the first kept, a hold across the wrap longer than three cells kept whole, a cut played once reads no wrap. `test_stop.py`: the stop fills by default; with no held cell and with `--fill-held off` it is the pictures pinned before. `test_face_layer.py`, `test_root_motion.py` and `test_loop_prop_seam_held.py`: the strip metadata grows `fps` and `holds`, the old pins otherwise unchanged. `test_motion_anchor.py`: its anchored cells 5 to 7 differ by one pixel, so the test cuts with `--fill-held off` to check the anchor's own cells. No-repeat outputs keep their pictures: the six cuts pinned before, a stop with no held cell, a set aligned with no held cell (pinned on commit 4f5ccd5) and scenes at 25, 20, 30, 12 and 48 fps.+- **Tests: `tests/video/test_no_repeat_default.py`, `tests/scene/test_scene_fill_held.py`, `tests/qa/test_inspect_holds.py`, `tests/gen/test_video_held.py`, `tests/video/test_face_bake_held.py` (new); `tests/video/test_held_fill.py`, `tests/video/test_stop.py`, `tests/video/test_face_layer.py`, `tests/video/test_root_motion.py`, `tests/video/test_loop_prop_seam_held.py`, `tests/video/test_follow_read_on.py`, `tests/video/test_motion_anchor.py` (changed).** `test_no_repeat_default.py` covers a loop's last cells, a cut one cell too long, the read again after the repairs, the strip's `holds`, `cut_args` and `cut_again`, the lifetime warning, the alignment's end fill, its cut again with the fill off and its refusal, `--out-fps` once aligned, a set with no held cell aligned as before, and `video-set` cutting aligned items as filmed and cutting again the ones no alignment took. `test_held_fill.py`'s wrap tests: a run at a loop's wrap is made, a last cell showing the first again is made and the first kept, a hold across the wrap longer than three cells kept whole, a cut played once reads no wrap. `test_stop.py`: the stop fills by default; with no held cell and with `--fill-held off` it is the pictures pinned before. `test_face_layer.py`, `test_root_motion.py` and `test_loop_prop_seam_held.py`: the strip metadata grows `fps` and `holds`, the old pins otherwise unchanged. `test_motion_anchor.py`: its anchored cells 5 to 7 differ by one pixel, so the test cuts with `--fill-held off` to check the anchor's own cells. No-repeat outputs keep their pictures: the six cuts pinned before, a stop with no held cell, a set aligned with no held cell (pinned on commit 4f5ccd5) and scenes at 25, 20, 30, 12 and 48 fps. Two alignment tests now reach the RIFE binary through the alignment's fill at the end: `test_cycle_align_aligns_a_two_step_loop_as_the_one_cycle_it_is` in `test_loop_prop_seam_held.py` and `test_the_first_alignment_records_the_cut_it_was_made_from_and_later_ones_keep_it` in `test_follow_read_on.py`. Like the other tests the default fill sends to the binary often (the rule in `docs/release.md`), each now has a timeout of its own, `@pytest.mark.timeout(900)`, and pins the binary's calls by model with `as_pinned` (exactly for `rife-v4.6`, between a floor and a top for `rife-v4.25`), and the second test is now marked `slow`, so the fast bundle (a plain `pytest`) leaves it out.## v3.15.0 - RIFE is `rife-v4.25` from TNTwise's 20250112 release by default, padded to 128 with no augmentation, the old `rife-v4.6` kept by name (`SPRITE_GEN_RIFE_MODEL_NAME`), and `sprite-gen rife install` run again