ludic.anim: animset_choice names the playing choice's clip as the set does, animset_can says whether the rig carries any of a state's clips (a one-shot with none is not asked for)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 20:19:05 +03:00
parent a22b8a572b
commit a87f20c66e
6 changed files with 35 additions and 3 deletions

View file

@ -113,4 +113,15 @@ program AnimSetTest {
}
expect(playing(pl) == "rig_idle")
}
test "the playing choice is named as the set names it; a state the rig has no clip for cannot be asked" (anim_st: mut AnimState, render3d_st: mut Render3dState) {
let sk = skin(render3d_st)
let pl = rig(anim_st)
expect(animset_choice(pl) == "")
animset_param(pl, "speed", 1.0)
animset_tick(anim_st, pl, sk, 0.016)
expect(animset_choice(pl) == "walk")
expect(animset_can(pl, "wave"))
expect(not animset_can(pl, "bow"))
expect(not animset_can(pl, "nope"))
}
}

View file

@ -1,5 +1,5 @@
# sets.lres - the test's one set: a ground state picking by speed bands, a one-shot that hands back,
# and a hop the code never asks for, taken when toy_hops says so
# a hop the code never asks for, taken when toy_hops says so, and a bow no rig carries
toy {
entry: "ground"
params: ["speed"]
@ -14,7 +14,8 @@ toy {
]
},
{ key: "wave", loop: false, next: "ground", choices: [{ clip: "wave" }] },
{ key: "hop", choices: [{ clip: "hop" }] }
{ key: "hop", choices: [{ clip: "hop" }] },
{ key: "bow", loop: false, next: "ground", choices: [{ clip: "bow" }] }
]
transitions: [{ from: "ground", to: "hop", blend: 0.1, when: fn toy_hops }]
}