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): the gait states, walk and run, are declared once, as video.nonloop.GAIT_STATES next to CYCLIC_STATES, where qa.handed and video.batch each held a copy

Soohong Kimbe12f850d3a5
diff --git a/sprite_gen/qa/handed.py b/sprite_gen/qa/handed.py
index 5c99229..3dd4610 100644
--- a/sprite_gen/qa/handed.py
+++ b/sprite_gen/qa/handed.py
@@ -58,6 +58,7 @@ from sprite_gen.gen.facing import FACINGS
from sprite_gen.spec.runio import atomic_write_text
from sprite_gen.util.hexcolor import parse_hex
from sprite_gen.util.console import utf8_streams
+from sprite_gen.video.nonloop import GAIT_STATES
# Opaque enough to be the character: the body's centre and the marker are read on these pixels.
ALPHA_MIN = 128
@@ -99,7 +100,6 @@ FAR_FRONT_MIN = 0.1
# In a walk or run, a far limb's item must show in at least this share of the frames: it is in view for about
# half of each step, and a walk that never shows it has lost it.
FAR_SHOWN_MIN = 0.25
-GAIT_STATES = ("walk", "run")
def parse_marker(value: str) -> tuple[int, int, int]:
diff --git a/sprite_gen/video/batch.py b/sprite_gen/video/batch.py
index 815aa5d..5ab9dca 100644
--- a/sprite_gen/video/batch.py
+++ b/sprite_gen/video/batch.py
@@ -187,7 +187,7 @@ HOLD_TEXT = {
# What stays put while a caller's own walk or run moves, by view: in place, and facing the way the image
# faces. A request interpreter may ask for any gait (a sneak, a march, a stroll); the engine keeps it on the
# spot and turned the right way, as the built-in gait sentences do. `{facing}` is the side view's.
-GAIT_STATES = frozenset({"walk", "run"})
+GAIT_STATES = nonloop.GAIT_STATES
GAIT_HOLD_TEXT = {
"front": "It stays in place as if on a treadmill, without coming any closer, and keeps facing the viewer the whole time.",
"back": (
diff --git a/sprite_gen/video/nonloop.py b/sprite_gen/video/nonloop.py
index e618601..8d089f1 100644
--- a/sprite_gen/video/nonloop.py
+++ b/sprite_gen/video/nonloop.py
@@ -39,6 +39,8 @@ ANATOMY_TEXT = {'quadruped': 'Preserve quadruped anatomical structure without re
'undulating, coiled, or fully flattened ground configurations during death or falls without '
'introducing limbs.'}
CYCLIC_STATES = frozenset({"idle", "walk", "run", "talk", "blink", "breathe"})
+# The gaits among them: a walk or run, filmed in place (`batch`) and checked for a far limb in view (`qa.handed`).
+GAIT_STATES = frozenset({"walk", "run"})
STABLE_SECONDS = 0.2
STABLE_MAX = 0.025 # distance / visible subject mass, independent of canvas padding
POSE_SHAPE_TOLERANCE = 0.05