Skip to content

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

fix(prepare): retire stick-pose motion guides

Soohong Kim21561b8cbd6a
diff --git a/docs/README.md b/docs/README.md
index 8774b6c..8734284 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -67,7 +67,7 @@ grouping is derived from `sprite_gen/_modules.py`, the one taxonomy table.
|---|---|
| [curation.md](curation.md) | The webview, standalone candidate view, finished-sheet editing and every `curation.json` field |
| [breathing.md](breathing.md) | The idle-breathing post-process layer and the static-pose row recipe |
-| [locomotion-curation.md](locomotion-curation.md) | Motion-phase experiments, manual selected cycles, clean GIF export |
+| [locomotion-curation.md](locomotion-curation.md) | Manual selected cycles, clean GIF export |
## Post-processing (pipeline D)
diff --git a/docs/architecture.md b/docs/architecture.md
index aa007d0..1af4658 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -144,8 +144,7 @@ Every run starts here. It owns the recipe consumed by both prompts and scripts:
"chroma": { "mode": "rgb" },
"states": { "idle": { "frames": 4, "fps": 4, "loop": true, "action": "..." } },
"fit": { "pixel_unfake": true, "logical_height": 64, "palette_size": 24, "align_x": "foot-centroid", "align_y": "bottom", "segmentation": "components" },
- "style": "...",
- "motion_phase_guides": false
+ "style": "..."
}
```
@@ -164,7 +163,6 @@ Every run starts here. It owns the recipe consumed by both prompts and scripts:
- `chroma.mode` is `rgb` by default; opt-in `ycbcr` is owned by
[`chroma-alpha.md`](chroma-alpha.md). The extract and inspect CLIs can
explicitly override it.
-- `motion_phase_guides` only does something for 8-frame locomotion states.
## 4. The cell model (read this — it is the most misunderstood part)
diff --git a/docs/directional-anchor-workflow.md b/docs/directional-anchor-workflow.md
index 4401c62..5f25833 100644
--- a/docs/directional-anchor-workflow.md
+++ b/docs/directional-anchor-workflow.md
@@ -164,9 +164,8 @@ in one image.
For cyclic locomotion (`running`, `walking`, `run`, `walk`, and directional
variants), do **not** feed a single peak-pose state anchor into the final
row. A single contact pose causes the model to repeat that same leg phase
- across every frame. Locomotion needs a motion-phase reference that contains
- both opposite contacts, such as a contact sheet, selected cycle, or layout
- phase guide.
+ across every frame. An optional motion reference should contain both opposite contacts,
+ such as a generated contact sheet or selected cycle.
4. **Asymmetric identity gate** — lock side-specific character features before
paired direction generation. Hairpins, earrings, scars, logos, handed props,
@@ -187,7 +186,7 @@ in one image.
identity rendering, for non-locomotion states only
- locomotion motion sheet/contact sheet: foot-contact phase and gait rhythm
- paired basis row: timing, scale, and animation intensity
- - layout guide: frame count, slots, margins, optional motion phase
+ - layout guide: frame count, slots, centers and margins only
The row prompt must keep character detail as an already-approved idle-anchor input and
spend its degrees of freedom on animation only: limb contacts, arm
counter-swing, body height, torso lean, head bob, hair bounce, and loop seam.
diff --git a/docs/layer-tracks.md b/docs/layer-tracks.md
index f88bde1..190a119 100644
--- a/docs/layer-tracks.md
+++ b/docs/layer-tracks.md
@@ -81,7 +81,7 @@ boundary instead of a memory.
- **B1 — `prepare` re-emits the request from a whitelist.** `prepare._run` builds a
fresh dict (`version`/`kind`/`engine`/`character`/`cell`/`chroma_key`/`states`/
- `style`/`motion_phase_guides`, plus `directions`/`layout`/`fit` when present), and
+ `style`, plus `directions`/`layout`/`fit` when present), and
`normalize_states` rebuilds each state entry as `frames`/`fps`/`loop`/`action`.
Anything else in `--request` / `--request-json` is dropped, and the command still
exits 0 — measured, not inferred: a request carrying `rig`, `tracks` and
diff --git a/docs/locomotion-curation.md b/docs/locomotion-curation.md
index a296189..5d43104 100644
--- a/docs/locomotion-curation.md
+++ b/docs/locomotion-curation.md
@@ -1,18 +1,6 @@
# Locomotion Curation & Clean GIF Export — sprite-gen reference
-> Owns: Motion-phase experiments, manual selected cycles, clean GIF export · Index: [docs/README.md](README.md)
-
-> `SKILL.md` 에서 분리한 시나리오 상세. motion-phase 실험·수동 selected-cycle·클린 GIF export 가 필요할 때 따른다. 내용은 손실 없이 `SKILL.md` 본문에서 그대로 옮겨졌다.
-
-### Motion Phase Guide Experiment
-
-For 8-frame run rows, `prepare_sprite_run.py --motion-phase-guides` adds simple stick-pose hints to the layout guide:
-
-```text
-contact -> down -> passing -> up -> opposite contact -> down -> passing -> up
-```
-
-Use this only for explicit locomotion experiments. The guide is not final art and must not appear in the generated row. Its purpose is to nudge foot contact, body height, and leg phase. It can improve leg alternation, but it is not a guarantee of a natural run loop; visual motion QA remains blocking.
+> Owns: Manual selected cycles, clean GIF export · Index: [docs/README.md](README.md)
### Manual Selected Cycle
diff --git a/scripts/dev/validate_pr6_subject_profile.py b/scripts/dev/validate_pr6_subject_profile.py
index 1009182..599139b 100644
--- a/scripts/dev/validate_pr6_subject_profile.py
+++ b/scripts/dev/validate_pr6_subject_profile.py
@@ -43,7 +43,6 @@ def _request(subject: str | None) -> dict[str, object]:
"chroma_key": {"name": "magenta", "hex": "#FF00FF", "rgb": [255, 0, 255], "selection": "explicit"},
"states": {"burst": {"frames": 3, "fps": 6, "loop": True}},
"style": "same raw A/B proof",
- "motion_phase_guides": False,
"layout": "taxonomy/v1",
}
if subject is not None:
diff --git a/sprite_gen/cli.py b/sprite_gen/cli.py
index 3db04f3..2d0fae3 100644
--- a/sprite_gen/cli.py
+++ b/sprite_gen/cli.py
@@ -75,7 +75,6 @@ def _add_prepare(p: argparse.ArgumentParser) -> None:
p.add_argument("--fit-detail-bias", action=argparse.BooleanOptionalAction, default=None)
p.add_argument("--fit-outline", type=_outline_config, default=None, metavar="{on,off,STRENGTH}")
p.add_argument("--fit-pitch-hint", type=int, default=None)
- p.add_argument("--motion-phase-guides", action="store_true")
p.add_argument("--request", type=Path)
p.add_argument("--request-json")
p.add_argument("--force", action="store_true")
diff --git a/sprite_gen/gen/prepare.py b/sprite_gen/gen/prepare.py
index 0a41c0c..7fb4983 100644
--- a/sprite_gen/gen/prepare.py
+++ b/sprite_gen/gen/prepare.py
@@ -135,65 +135,6 @@ STATE_REQUIREMENTS = {
],
}
-RUN_PHASE_CYCLE = [
- {
- "name": "contact",
- "body_y": 0,
- "front_leg": "forward_straight",
- "back_leg": "back_extended",
- "note": "front foot contacts ground, back foot pushes off",
- },
- {
- "name": "down",
- "body_y": 6,
- "front_leg": "under_bent",
- "back_leg": "back_bent",
- "note": "weight drops over planted foot",
- },
- {
- "name": "passing",
- "body_y": 2,
- "front_leg": "under_vertical",
- "back_leg": "passing_forward",
- "note": "swing leg passes under body",
- },
- {
- "name": "up",
- "body_y": -6,
- "front_leg": "back_lifted",
- "back_leg": "forward_lifted",
- "note": "body lifts before the opposite contact",
- },
- {
- "name": "opposite_contact",
- "body_y": 0,
- "front_leg": "back_extended",
- "back_leg": "forward_straight",
- "note": "opposite foot contacts ground",
- },
- {
- "name": "opposite_down",
- "body_y": 6,
- "front_leg": "back_bent",
- "back_leg": "under_bent",
- "note": "weight drops over the opposite planted foot",
- },
- {
- "name": "opposite_passing",
- "body_y": 2,
- "front_leg": "passing_forward",
- "back_leg": "under_vertical",
- "note": "first leg passes under body",
- },
- {
- "name": "opposite_up",
- "body_y": -6,
- "front_leg": "forward_lifted",
- "back_leg": "back_lifted",
- "note": "body lifts back toward frame 1",
- },
-]
-
CHROMA_CANDIDATES = [
("magenta", "#FF00FF"),
("green", "#00FF00"),
@@ -525,7 +466,7 @@ def normalize_states(raw: dict[str, Any] | None) -> dict[str, dict[str, Any]]:
# after the fact (docs/layer-tracks.md §2 B1). The lists are the one place that
# rule is written down, and `dropped_key_notes` makes every drop observable
# instead of silent.
-REQUEST_KEYS_CARRIED = ("cell", "states", "style", "motion_phase_guides",
+REQUEST_KEYS_CARRIED = ("cell", "states", "style",
"directions", "fit", "rig", "layers")
# Written by prepare itself, from CLI flags and from measuring the base image. An
# incoming copy is not carried either, but it is restated rather than lost, so the
@@ -601,20 +542,6 @@ def load_request(path: Path | None, inline_json: str | None) -> dict[str, Any]:
return {}
-def state_motion_phases(state: str, frames: int) -> list[dict[str, Any]]:
- if frames != 8:
- return []
- if (
- state in {"running-right", "running-left", "run", "walk"}
- or state.startswith("running-front-")
- or state.startswith("running-back-")
- or state.startswith("walking-front-")
- or state.startswith("walking-back-")
- ):
- return RUN_PHASE_CYCLE
- return []
-
-
# --- 방향 계약 (directions block) -------------------------------------------
# base = down(정면) 기본자세 하나. 방향 앵커(<dir>_<anchor_suffix>)를 base 에서 먼저
# 뽑고, 각 행은 자기 방향 앵커를 identity 로 생성한다 (directional-anchor-workflow.md).
@@ -798,81 +725,7 @@ def directional_requirements(state: str) -> list[str]:
return requirements
-def mirrored_x(center_x: int, x: int, facing: str) -> int:
- if facing == "left":
- return center_x - (x - center_x)
- return x
-
-
-def leg_points(root: tuple[int, int], pose: str, facing: str, scale: float) -> tuple[tuple[int, int], tuple[int, int]]:
- root_x, root_y = root
- forward = round(34 * scale)
- back = round(32 * scale)
- down = round(54 * scale)
- bend = round(24 * scale)
- lift = round(22 * scale)
- if pose == "forward_straight":
- knee = (root_x + round(forward * 0.45), root_y + round(down * 0.48))
- foot = (root_x + forward, root_y + down)
- elif pose == "back_extended":
- knee = (root_x - round(back * 0.45), root_y + round(down * 0.48))
- foot = (root_x - back, root_y + down)
- elif pose == "under_bent":
- knee = (root_x + round(bend * 0.2), root_y + round(down * 0.45))
- foot = (root_x + round(bend * 0.55), root_y + round(down * 0.82))
- elif pose == "back_bent":
- knee = (root_x - round(bend * 0.65), root_y + round(down * 0.42))
- foot = (root_x - round(bend * 0.2), root_y + round(down * 0.78))
- elif pose == "passing_forward":
- knee = (root_x + round(bend * 0.45), root_y + round(down * 0.35))
- foot = (root_x + round(bend * 0.1), root_y + round(down * 0.63))
- elif pose == "under_vertical":
- knee = (root_x, root_y + round(down * 0.42))
- foot = (root_x, root_y + round(down * 0.88))
- elif pose == "forward_lifted":
- knee = (root_x + round(forward * 0.45), root_y + round(down * 0.18))
- foot = (root_x + round(forward * 0.7), root_y + round(down * 0.35))
- elif pose == "back_lifted":
- knee = (root_x - round(back * 0.45), root_y + round(down * 0.18))
- foot = (root_x - round(back * 0.7), root_y + round(down * 0.35))
- else:
- knee = (root_x, root_y + round(down * 0.45))
- foot = (root_x, root_y + down)
- if facing == "left":
- knee = (root_x - (knee[0] - root_x), knee[1])
- foot = (root_x - (foot[0] - root_x), foot[1])
- return knee, foot
-
-
-def draw_motion_phase(draw: ImageDraw.ImageDraw, slot_left: int, cell_width: int, cell_height: int, phase: dict[str, Any], facing: str) -> None:
- scale = min(cell_width / 192, cell_height / 208)
- center_x = slot_left + cell_width // 2
- hip_y = round(cell_height * 0.52 + int(phase["body_y"]) * scale)
- shoulder_y = hip_y - round(42 * scale)
- head_y = shoulder_y - round(26 * scale)
- hip = (center_x, hip_y)
- shoulder = (center_x, shoulder_y)
- head_bbox = (
- center_x - round(11 * scale),
- head_y - round(11 * scale),
- center_x + round(11 * scale),
- head_y + round(11 * scale),
- )
- draw.ellipse(head_bbox, outline="#6b7280", width=max(1, round(2 * scale)))
- draw.line((shoulder, hip), fill="#6b7280", width=max(2, round(3 * scale)))
- front_arm = (mirrored_x(center_x, center_x - round(26 * scale), facing), shoulder_y + round(30 * scale))
- back_arm = (mirrored_x(center_x, center_x + round(26 * scale), facing), shoulder_y + round(18 * scale))
- draw.line((shoulder, front_arm), fill="#94a3b8", width=max(1, round(2 * scale)))
- draw.line((shoulder, back_arm), fill="#cbd5e1", width=max(1, round(2 * scale)))
- front_knee, front_foot = leg_points(hip, str(phase["front_leg"]), facing, scale)
- back_knee, back_foot = leg_points(hip, str(phase["back_leg"]), facing, scale)
- draw.line((hip, front_knee, front_foot), fill="#ef4444", width=max(2, round(4 * scale)))
- draw.line((hip, back_knee, back_foot), fill="#2563eb", width=max(2, round(4 * scale)))
- ground_y = round(cell_height * 0.52 + 54 * scale + int(phase["body_y"]) * scale)
- draw.line((slot_left + round(34 * scale), ground_y, slot_left + cell_width - round(34 * scale), ground_y), fill="#cbd5e1", width=1)
-
-
-def draw_guide(path: Path, state: str, frames: int, cell: dict[str, Any], motion_phase_guides: bool = False) -> None:
+def draw_guide(path: Path, frames: int, cell: dict[str, Any]) -> None:
cell_width = int(cell["width"])
cell_height = int(cell["height"])
safe_margin_x = int(cell["safe_margin_x"])
@@ -893,11 +746,6 @@ def draw_guide(path: Path, state: str, frames: int, cell: dict[str, Any], motion
)
draw.rectangle(safe, outline="#2f80ed", width=2)
draw.line((left + cell_width // 2, safe_margin_y, left + cell_width // 2, height - safe_margin_y), fill="#b8c8e8", width=1)
- if motion_phase_guides:
- phases = state_motion_phases(state, frames)
- facing = "left" if state.endswith("left") else "right"
- for index, phase in enumerate(phases):
- draw_motion_phase(draw, index * cell_width, cell_width, cell_height, phase, facing)
path.parent.mkdir(parents=True, exist_ok=True)
image.save(path)
@@ -921,21 +769,6 @@ def row_prompt(request: dict[str, Any], state: str, entry: dict[str, Any]) -> st
state_requirement_text = "\n\nState-specific requirements:\n" + "\n".join(
f"- {requirement}" for requirement in state_requirements
)
- phase_prompt_text = ""
- phases = state_motion_phases(state, frames) if request.get("motion_phase_guides") else []
- if phases:
- phase_lines = [
- f"- frame {index + 1}: {phase['name']} — {phase['note']}"
- for index, phase in enumerate(phases)
- ]
- phase_prompt_text = (
- "\n\nMotion phase requirements:\n"
- "- The layout guide includes simple stick-pose motion hints inside each slot. Use those hints only for body height, foot contact, and leg phase. Do not copy guide colors or guide lines into the artwork.\n"
- "- Make the sequence loop as one continuous locomotion cycle, not eight unrelated poses.\n"
- "- The motion phase guide and any multi-pose contact sheet override a single running/walking pose anchor for leg phase. Do not repeat one anchor's forward leg across every frame.\n"
- "- Opposite contact frames must visibly trade which leg reaches forward; passing frames must not look like duplicate contact frames.\n"
- + "\n".join(phase_lines)
- )
transparency_artifact_text = "\n".join(f"- {rule}" for rule in TRANSPARENCY_ARTIFACT_RULES)
runtime_size = f"{cell_width}x{cell_height}"
reference_contract = (
@@ -969,18 +802,17 @@ Anchor lock:
- Do not redesign or reinterpret identity details while animating. Keep face, hair shape, markings, palette, outline weight, body proportions, outfit, props, and silhouette copied from the approved anchors.
- Preserve side-specific features exactly as the approved anchors show them. Do not solve hairpin side, earring side, logos, handed props, scars, one-sided markings, asymmetric clothing, or lighting cues from scratch inside the row.
- When generating a paired left/right row, use the paired row reference only for timing, scale, and animation intensity. Rotate the body, feet, shoulders, face angle, and gaze to the target facing, but keep identity details attached according to the accepted target-direction anchor.
-- For cyclic locomotion, do not let a single running/walking pose anchor determine every frame's leg phase. Use multi-pose motion references and the layout phase guide for foot contacts.
+- For cyclic locomotion, do not let a single running/walking pose anchor determine every frame's leg phase. When a multi-pose motion reference is attached, use it for foot contacts.
- Prefer a subtler animation over any change that mutates the character identity.
{state_requirement_text}
-{phase_prompt_text}
Transparency and artifact rules:
{transparency_artifact_text}
Layout requirements:
- Exactly {frames} full-body frames, left to right, in one horizontal row.
-- The attached layout guide shows the {frames} frame boxes, inner safe area, and optional motion phase hints for this row. Follow its slot count, spacing, centering, padding, and phase timing.
-- Do not reproduce the layout guide itself: no visible boxes, guide lines, center marks, labels, stick figures, guide colors, or guide background may appear in the output.
+- The attached layout guide shows the {frames} frame boxes, inner safe area, and centers for this row. Follow its slot count, spacing, centering, and padding.
+- Do not reproduce the layout guide itself: no visible boxes, guide lines, center marks, labels, guide colors, or guide background may appear in the output.
- Treat the image as {frames} equal-width invisible {runtime_size} frame slots. Fill every slot: each requested slot must contain exactly one complete full-body pose.
- Spread the {frames} poses evenly across the whole image width. Do not leave any requested slot blank or create large empty gaps between poses.
- Center one complete pose in each slot. No pose may cross into the neighboring slot.
@@ -1038,7 +870,6 @@ def _build_parser() -> argparse.ArgumentParser:
parser.add_argument("--fit-detail-bias", action=argparse.BooleanOptionalAction, default=None, help="pixel unfake dominant-color voting bias toward near-black detail clusters (default on)")
parser.add_argument("--fit-outline", type=_outline_config, default=None, metavar="{on,off,STRENGTH}", help="pixel unfake outline enforcement: on (strength 0.62), off, or an explicit 0..1 strength")
parser.add_argument("--fit-pitch-hint", type=int, default=None, help="pixel unfake fallback pixel pitch when per-frame detection is inconclusive")
- parser.add_argument("--motion-phase-guides", action="store_true", help="draw simple per-frame motion phase hints into locomotion layout guides")
parser.add_argument("--directions", help="comma list of generated directions (e.g. down,side,up); states must be named <direction>_<state>; missing <direction>_idle anchors are synthesized and a generation plan is written")
parser.add_argument("--mirror", help="comma list of target=source pairs covered by runtime mirroring instead of generation (e.g. left=side)")
parser.add_argument("--request", type=Path)
@@ -1128,7 +959,6 @@ def _run(args: argparse.Namespace):
"chroma_key": chroma_key,
"states": states,
"style": raw_request.get("style", args.style),
- "motion_phase_guides": bool(raw_request.get("motion_phase_guides", args.motion_phase_guides)),
}
# Subject profile: CLI wins over --request-json; absent = character. The
# field stays omitted for the default so the request has one canonical
@@ -1177,10 +1007,8 @@ def _run(args: argparse.Namespace):
parent.mkdir(parents=True, exist_ok=True)
draw_guide(
guide_path,
- state,
int(entry["frames"]),
cell,
- motion_phase_guides=bool(request["motion_phase_guides"]),
)
prompt_path.write_text(row_prompt(request, state, entry).rstrip() + "\n", encoding="utf-8")
diff --git a/tests/compose/test_layer_compose.py b/tests/compose/test_layer_compose.py
index fdfae09..e7d39cb 100644
--- a/tests/compose/test_layer_compose.py
+++ b/tests/compose/test_layer_compose.py
@@ -75,7 +75,6 @@ def _request(**overrides) -> dict:
"track": "prop_effect"},
},
"style": "flat solid shapes on magenta",
- "motion_phase_guides": False,
"rig": {"profile": "humanoid_biped", "landmarks": json.loads(json.dumps(LANDMARKS))},
"layers": {
"walk_with_can": {"stack": [
diff --git a/tests/compose/test_layer_contract.py b/tests/compose/test_layer_contract.py
index 13e2d1c..e68d217 100644
--- a/tests/compose/test_layer_contract.py
+++ b/tests/compose/test_layer_contract.py
@@ -427,7 +427,7 @@ def test_landmark_map_reads_a_whole_frame_and_never_invents_one() -> None:
NON_LAYER_REQUEST_KEYS = {
"version", "kind", "engine", "character", "cell", "chroma_key",
- "states", "style", "motion_phase_guides", "layout",
+ "states", "style", "layout",
}
NON_LAYER_MANIFEST_KEYS = {
diff --git a/tests/curate/test_snap_phase_policy.py b/tests/curate/test_snap_phase_policy.py
index 893ac89..63435d8 100644
--- a/tests/curate/test_snap_phase_policy.py
+++ b/tests/curate/test_snap_phase_policy.py
@@ -71,7 +71,6 @@ def _build_run(run_dir: Path, frames: int = 2) -> Image.Image:
"states": {"idle": {"frames": frames, "fps": 8, "loop": True,
"action": "offset-phase probe"}},
"style": "synthetic, flat solid shapes on magenta",
- "motion_phase_guides": False,
}
(run_dir / "sprite-request.json").write_text(json.dumps(request, indent=2), encoding="utf-8")
return art
diff --git a/tests/fixtures/run-fused/sprite-request.json b/tests/fixtures/run-fused/sprite-request.json
index 9f1b763..295b02c 100644
--- a/tests/fixtures/run-fused/sprite-request.json
+++ b/tests/fixtures/run-fused/sprite-request.json
@@ -40,6 +40,5 @@
"segmentation": "projection",
"align_x": "bbox-center"
},
- "style": "synthetic fused fixture, flat solid shapes on magenta",
- "motion_phase_guides": false
+ "style": "synthetic fused fixture, flat solid shapes on magenta"
}
diff --git a/tests/fixtures/run/sprite-request.json b/tests/fixtures/run/sprite-request.json
index 8b485ea..5fc43f3 100644
--- a/tests/fixtures/run/sprite-request.json
+++ b/tests/fixtures/run/sprite-request.json
@@ -36,6 +36,5 @@
"action": "synthetic shapes for golden regression"
}
},
- "style": "synthetic golden fixture, flat solid shapes on magenta",
- "motion_phase_guides": false
+ "style": "synthetic golden fixture, flat solid shapes on magenta"
}
diff --git a/tests/test_prepare_layout_guides.py b/tests/test_prepare_layout_guides.py
new file mode 100644
index 0000000..f657e02
--- /dev/null
+++ b/tests/test_prepare_layout_guides.py
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: Apache-2.0
+"""Prepared guides carry geometry only, including when old recipes are reused."""
+
+import json
+import subprocess
+import sys
+from pathlib import Path
+
+import pytest
+from PIL import Image
+
+from conftest import run_script
+from sprite_gen.gen import prepare
+
+
[email protected]("frames", [8, 16])
+def test_reused_request_cannot_restore_pose_guides(tmp_path: Path, frames: int):
+ payload = {"states": {"running-right": {
+ "frames": frames, "fps": 16, "loop": True, "action": "running in place",
+ }}}
+ guide_pixels = []
+ prompt_texts = []
+ for name, old_value in (("clean", None), ("enabled", True), ("disabled", False)):
+ request = dict(payload)
+ if old_value is not None:
+ request["motion_phase_guides"] = old_value
+ out_dir = tmp_path / name
+ result = run_script("prepare_sprite_run.py", "--out-dir", str(out_dir),
+ "--character-id", "runner", "--request-json", json.dumps(request))
+ assert result.returncode == 0, result.stdout + result.stderr
+ emitted = json.loads((out_dir / "sprite-request.json").read_text())
+ assert "motion_phase_guides" not in emitted
+ if old_value is not None:
+ assert "motion_phase_guides" in result.stderr
+ assert "dropped" in result.stderr
+ with Image.open(next((out_dir / "references/layout-guides").rglob("*.png"))) as guide:
+ assert guide.size == (frames * 256, 256)
+ # A limb/head drawing would add colours beyond the empty geometry.
+ assert {color for _count, color in guide.getcolors(maxcolors=256)} == {
+ (246, 246, 246), (51, 51, 51), (47, 128, 237), (184, 200, 232),
+ }
+ guide_pixels.append(guide.tobytes())
+ prompt = next((out_dir / "prompts").rglob("*.txt")).read_text()
+ assert "Animation action: running in place" in prompt
+ for retired in ("stick", "phase guide", "phase hints", "Motion phase requirements"):
+ assert retired not in prompt
+ prompt_texts.append(prompt)
+ assert guide_pixels[0] == guide_pixels[1] == guide_pixels[2]
+ assert prompt_texts[0] == prompt_texts[1] == prompt_texts[2]
+
+
[email protected]("entrypoint", ["wrapper", "cli"])
+def test_removed_flag_is_rejected_before_output(tmp_path: Path, entrypoint: str):
+ args = ["--out-dir", str(tmp_path / "run"), "--character-id", "runner", "--motion-phase-guides"]
+ if entrypoint == "wrapper":
+ result = run_script("prepare_sprite_run.py", *args)
+ else:
+ result = subprocess.run([sys.executable, "-m", "sprite_gen.cli", "prepare", *args],
+ text=True, capture_output=True)
+ assert result.returncode != 0
+ assert "unrecognized arguments: --motion-phase-guides" in result.stderr
+ assert not (tmp_path / "run").exists()
+
+
+def test_library_does_not_accept_removed_option(tmp_path: Path):
+ with pytest.raises(TypeError, match="unexpected keyword argument.*motion_phase_guides"):
+ prepare.run(out_dir=tmp_path / "run", character_id="runner", motion_phase_guides=True)
+ assert not (tmp_path / "run").exists()
diff --git a/tests/test_subject_profile.py b/tests/test_subject_profile.py
index 01f8167..9fe58b4 100644
--- a/tests/test_subject_profile.py
+++ b/tests/test_subject_profile.py
@@ -32,7 +32,7 @@ def _make_run(run_dir: Path, density: int, subject: str | None, cell: int = 64)
"chroma_key": {"name": "magenta", "hex": "#FF00FF", "rgb": [255, 0, 255],
"selection": "explicit"},
"states": {"burst": {"frames": FRAMES, "fps": 8, "loop": True}},
- "style": "test", "motion_phase_guides": False, "layout": "taxonomy/v1",
+ "style": "test", "layout": "taxonomy/v1",
}
if subject:
request["subject"] = subject