spine-rigc 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +92 -11
- package/cli.ts +366 -15
- package/docs/AUTHORING.md +290 -9
- package/package.json +1 -1
- package/src/ballot.ts +869 -0
- package/src/compile.ts +612 -0
- package/src/preview.ts +2 -2
- package/src/types.ts +163 -0
- package/src/validate.ts +229 -1
package/docs/AUTHORING.md
CHANGED
|
@@ -89,6 +89,11 @@ bun cli.ts check \
|
|
|
89
89
|
# …and if nobody gave you frames, LOOK at it instead — neither needs a reference:
|
|
90
90
|
bun cli.ts render --candidate path/to/spine # PNG frames + a contact sheet grid
|
|
91
91
|
bun cli.ts preview --candidate path/to/spine # one .html that plays it in Spine's own player
|
|
92
|
+
|
|
93
|
+
# …and where you have several green candidates and no instrument that separates
|
|
94
|
+
# them, ask a human — the one loop step this toolchain cannot run for you:
|
|
95
|
+
bun cli.ts vote --candidate path/to/spine-a --candidate path/to/spine-b # -> ballot.html
|
|
96
|
+
bun cli.ts vote --record vote-<id>.json # -> votes.jsonl
|
|
92
97
|
```
|
|
93
98
|
|
|
94
99
|
`build` compiles, round-trips the result through `@esotericsoftware/spine-core`,
|
|
@@ -124,14 +129,19 @@ What the flags mean:
|
|
|
124
129
|
| `--copy-images` | `build` only: also copies every referenced page PNG into `--out` and rewrites the atlas to the copies, so the directory is self-contained enough to zip or commit on its own. Default is unchanged — page paths still point at the source art (issue #217) |
|
|
125
130
|
| `--images` | where the rig spec's `image` names resolve (overrides the rig's own `images` field, and is relative to your working directory) |
|
|
126
131
|
| `--manifest` | a cut manifest. Only for a rig with **measured art** behind it; a foreign skeleton has none |
|
|
127
|
-
| `--profile` | `spine` = the
|
|
128
|
-
| `--candidate` | `check`, `bench`, `render` and `
|
|
129
|
-
| `--animation` | `render` and `
|
|
132
|
+
| `--profile` | `spine` = the 22 validity rules (**the default**) · `spine-html` = all 36, opt-in |
|
|
133
|
+
| `--candidate` | `check`, `bench`, `render`, `preview` and `vote` only: a **compiled** artifact — the directory `build --out` wrote, or a `skeleton.json` path. `--atlas <path>` names the atlas when it does not sit beside the skeleton. **`vote` is the one command that takes it more than once** — repeat it 2–4 times, one per pane, labelled A, B, C, D in the order given; everywhere else a repeat is a typo and is refused |
|
|
134
|
+
| `--animation` | `render`, `preview` and `vote` only: which animation to show. The default is **every** one for `render`, the **first** for `preview`, and for `vote` the first of candidate A. A name the skeleton does not have is refused, with the ones it does have listed — and for `vote`, so is a name that only *some* candidates have |
|
|
135
|
+
| `--record` | `vote` only: a saved vote to check against its ballot and append to the ledger, instead of writing a ballot. This is the command's second mode; it takes no `--candidate` |
|
|
136
|
+
| `--ballot` | `vote --record` only: the ballot the vote answers (default `ballot.html`). Its embedded manifest is what the vote is checked against, so the ballot file is the record of the question |
|
|
137
|
+
| `--ledger` | `vote --record` only: the append-only JSONL the vote lands in (default `votes.jsonl`), one vote per line |
|
|
138
|
+
| `--again` | `vote --record` only: record a second vote on a ballot the ledger already has. Without it a repeat is refused by name rather than doubled |
|
|
130
139
|
|
|
131
140
|
`render` also takes `--fps <n>` (the rate it samples at, default 12 — the same
|
|
132
141
|
protocol rate the reference frames use) and `--max <px>` (the long side of a
|
|
133
|
-
frame, default 256).
|
|
134
|
-
(default `render/`), the `.html` file for `preview` (default `preview.html`)
|
|
142
|
+
frame, default 256). Three commands take `--out`: a directory for `render`
|
|
143
|
+
(default `render/`), the `.html` file for `preview` (default `preview.html`) and
|
|
144
|
+
for `vote` (default `ballot.html`).
|
|
135
145
|
|
|
136
146
|
Pick the profile deliberately, and know which one you got by saying nothing. The
|
|
137
147
|
default is `spine`: "is this valid Spine 4.3 that any runtime plays correctly",
|
|
@@ -152,6 +162,8 @@ bun cli.ts check --candidate path/to/spine --frames path/to/frames
|
|
|
152
162
|
bun cli.ts bench 3 --candidate path/to/spine [--frames path/to/frames]
|
|
153
163
|
bun cli.ts render --candidate path/to/spine [--animation …] [--fps 12] [--max 256]
|
|
154
164
|
bun cli.ts preview --candidate path/to/spine [--animation …] [--out preview.html]
|
|
165
|
+
bun cli.ts vote --candidate path/to/a --candidate path/to/b [--out ballot.html]
|
|
166
|
+
bun cli.ts vote --record vote-<id>.json [--ballot ballot.html] [--ledger votes.jsonl]
|
|
155
167
|
```
|
|
156
168
|
|
|
157
169
|
- **`explain`** is the one to reach for when a rig compiles but looks wrong. It
|
|
@@ -185,6 +197,26 @@ bun cli.ts preview --candidate path/to/spine [--animation …] [--out preview.h
|
|
|
185
197
|
double-clicking it is also the interop proof — what plays there was played by
|
|
186
198
|
Esoteric Software's runtime, not by rigc's. The player is loaded from a CDN
|
|
187
199
|
rather than copied into the file, so the first open needs a network.
|
|
200
|
+
- 🗳️ **`vote` is `preview` with more than one candidate in it and an answer
|
|
201
|
+
coming back**, and it is the one step of this loop you cannot run yourself.
|
|
202
|
+
Reach for it where the instruments have run out: two builds that `check` and
|
|
203
|
+
`diff` cannot separate, a pose fit with two local optima, a key density that is
|
|
204
|
+
a matter of taste, a first draft with no reference at all. **The intended loop
|
|
205
|
+
is: you compile 2–4 candidates that every one of them passes the gate → `rigc
|
|
206
|
+
vote` writes one `ballot.html` → a human opens it, watches the panes loop, and
|
|
207
|
+
picks a winner or declares a tie → they save the small JSON result the page
|
|
208
|
+
hands them → `rigc vote --record <that file>` checks it against the ballot and
|
|
209
|
+
appends one line to `votes.jsonl` → you read the ledger and proceed.**
|
|
210
|
+
Compile first, vote last: never put a candidate on a ballot that did not build
|
|
211
|
+
green, and never ask the human to read JSON, a diff or a spec — the page holds
|
|
212
|
+
playable pixels and nothing else. The panes are labelled `A`/`B`/`C`/`D` and
|
|
213
|
+
carry no paths, so do not describe the candidates to the voter either. What
|
|
214
|
+
comes back is machine-checkable rather than prose: each line names the winner
|
|
215
|
+
by content **digest** (a label means nothing outside one ballot), carries the
|
|
216
|
+
`coverage` set so you can compute what is still unreviewed, and carries a
|
|
217
|
+
reason code from a closed enumeration. A **tie is a recorded answer**, and
|
|
218
|
+
`both-unacceptable` is the one that means *propose again* rather than *adopt
|
|
219
|
+
either* — check for it before you treat a ballot as settled.
|
|
188
220
|
|
|
189
221
|
---
|
|
190
222
|
|
|
@@ -617,6 +649,9 @@ time puts it here.
|
|
|
617
649
|
| `tracks` | the timelines |
|
|
618
650
|
| `drawOrder` | the draw-order timeline — §4.7. Not a track: it names no target |
|
|
619
651
|
| `events` | the event timeline — §4.8. Not a track, for the same reason |
|
|
652
|
+
| `ik` | IK constraint timelines — §4.9. Not a track: its keys carry named fields, not one `v` |
|
|
653
|
+
| `transform` | transform constraint timelines — §4.10. Same reason |
|
|
654
|
+
| `deform` | deform timelines — §4.11. Same reason |
|
|
620
655
|
|
|
621
656
|
`groups` (`name → [member, …]`) lets one track target several bones or slots at
|
|
622
657
|
once; `lag` shifts every key of a track, and `stagger` adds a per-member delay in
|
|
@@ -627,6 +662,13 @@ member order.
|
|
|
627
662
|
A track names **exactly one** of `bone`, `slot`, `group`, `physics`. Two tracks on
|
|
628
663
|
the same `target.property` is a compile error: merge them.
|
|
629
664
|
|
|
665
|
+
Three families are **not** tracks and sit beside `tracks` instead — `ik` (§4.9),
|
|
666
|
+
`transform` (§4.10) and `deform` (§4.11). The reason is the key rather than the
|
|
667
|
+
target: a track's key carries one `v`, and those three carry named fields each
|
|
668
|
+
(two for an IK constraint, six for a transform constraint, a sparse vertex run for
|
|
669
|
+
a deform). Folding them in would make `v` mean four different things depending on
|
|
670
|
+
`property`. 4.3 also writes them as their own groups beside `bones` and `slots`.
|
|
671
|
+
|
|
630
672
|
| Target | `property` | Key `v` |
|
|
631
673
|
| --- | --- | --- |
|
|
632
674
|
| `bone` | `translate`, `scale`, `shear` | `[x, y]` |
|
|
@@ -819,6 +861,232 @@ decreasing time builds an `EventTimeline` whose earlier firing is simply
|
|
|
819
861
|
unreachable, with a perfectly clean load.
|
|
820
862
|
`A32_EVENT_KEYS_RESOLVE` checks all three from the other side.
|
|
821
863
|
|
|
864
|
+
### 4.9 `ik` — mixing an IK constraint in over time
|
|
865
|
+
|
|
866
|
+
The rig spec declares the constraint (§3.5); this keys it. 4.3 writes the group as
|
|
867
|
+
`animations.<a>.ik.<constraint>` — **one unnamed timeline per constraint**, so the
|
|
868
|
+
constraint name is the only target there is, and there is no timeline name between
|
|
869
|
+
the two the way a bone has `rotate` and `translate`.
|
|
870
|
+
|
|
871
|
+
```json
|
|
872
|
+
"animations": {
|
|
873
|
+
"walk": {
|
|
874
|
+
"duration": 0.8666666,
|
|
875
|
+
"loop": true,
|
|
876
|
+
"tracks": [],
|
|
877
|
+
"ik": [
|
|
878
|
+
{
|
|
879
|
+
"constraint": "rear-leg-ik",
|
|
880
|
+
"keys": [
|
|
881
|
+
{ "t": 0, "mix": 1, "softness": 0 },
|
|
882
|
+
{ "t": 0.2666666, "mix": 1, "softness": 14, "ease": "settle" },
|
|
883
|
+
{ "t": 0.5333333, "mix": 0, "softness": 0 },
|
|
884
|
+
{ "t": 0.8666666, "mix": 1, "softness": 0 }
|
|
885
|
+
]
|
|
886
|
+
}
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
⚠️ **Every number above is invented.** They are shaped like a walk cycle — the leg
|
|
893
|
+
under load is solved to the ground and the leg in flight is let go — and nothing
|
|
894
|
+
here was measured off a real rig. Copy the shape, not the values.
|
|
895
|
+
|
|
896
|
+
| Field | Meaning | Absent means |
|
|
897
|
+
| --- | --- | --- |
|
|
898
|
+
| `mix` | 0..1, how much of the solved rotation is applied | `1` |
|
|
899
|
+
| `softness` | distance from full reach at which the bones stop straightening | `0` |
|
|
900
|
+
| `bendPositive` | two-bone bend direction | `true` |
|
|
901
|
+
| `compress` | one-bone IK scales the bone down to reach a close target | `false` |
|
|
902
|
+
| `stretch` | scales the bone up to reach a far target | `false` |
|
|
903
|
+
|
|
904
|
+
- **`mix` and `softness` are the two curve channels, in that order.** A raw
|
|
905
|
+
`curve` is therefore 8 numbers, and the three booleans are stepped by nature —
|
|
906
|
+
nothing interpolates a bend direction.
|
|
907
|
+
- `mix` outside `0..1` is a compile error: `IkConstraintPose.mix` is documented as
|
|
908
|
+
a percentage. A **transform** mix is documented *unbounded*, which is why §4.10
|
|
909
|
+
has no such rule — the asymmetry is the runtime's, not ours.
|
|
910
|
+
- 🚨 **A field stated on one key and not the next is a compile error.** This is the
|
|
911
|
+
refusal worth reading twice, because the format's shape invites the mistake: the
|
|
912
|
+
parser reads every field **fresh per key** with its own default, so a key that
|
|
913
|
+
omits `softness` does not hold the previous key's 14 — it snaps to 0, and
|
|
914
|
+
interpolates down to it on the way. It loads. It plays. It is not what you
|
|
915
|
+
wrote. So state a field on every key of a track or on none of them; writing the
|
|
916
|
+
default out loud is how you opt in.
|
|
917
|
+
- Its last key counts towards the declared duration like any other (R7).
|
|
918
|
+
|
|
919
|
+
rigc refuses four things here:
|
|
920
|
+
|
|
921
|
+
| You wrote | You get |
|
|
922
|
+
| --- | --- |
|
|
923
|
+
| a constraint the rig does not declare | `keys unknown ik constraint "X"; the rig declares ik constraint(s): …` |
|
|
924
|
+
| a `transform` constraint's name | `keys "X" as an ik constraint, but the rig declares it as a "transform" constraint` |
|
|
925
|
+
| `softness` on the first key only | `key 0 names "softness" and key 1 (t=…) does not … it would snap to 0` |
|
|
926
|
+
| `mix: 1.5` | `mix is 1.5, outside 0..1 — the runtime documents it as a percentage 0-1` |
|
|
927
|
+
|
|
928
|
+
The type check matters because the parser resolves a timeline's target by name
|
|
929
|
+
**and** type: `findConstraint(name, IkConstraintData)` misses a transform
|
|
930
|
+
constraint of the same name, returns null, and `readAnimation` throws — in the
|
|
931
|
+
consumer's process, which is late. `A34_CONSTRAINT_TIMELINE_TARGETS` checks the
|
|
932
|
+
same two from the other side, plus one thing the compiler cannot produce and a
|
|
933
|
+
hand-edited file can: an **empty key array**, which the parser skips in silence.
|
|
934
|
+
|
|
935
|
+
### 4.10 `transform` — turning a muted transform constraint on
|
|
936
|
+
|
|
937
|
+
Same shape as §4.9 and the same absent-means-default rule; six mixes instead of
|
|
938
|
+
two. The idiom this exists for is an aim rig: the constraints are declared with
|
|
939
|
+
`mixRotate: 0` in the rig spec — muted at setup, so the figure is posed by its own
|
|
940
|
+
bones — and the animation that needs them mixes them in.
|
|
941
|
+
|
|
942
|
+
```json
|
|
943
|
+
"animations": {
|
|
944
|
+
"aim": {
|
|
945
|
+
"duration": 0.3333333,
|
|
946
|
+
"loop": false,
|
|
947
|
+
"tracks": [],
|
|
948
|
+
"transform": [
|
|
949
|
+
{ "constraint": "aim-head-transform", "keys": [{ "t": 0, "mixRotate": 1 }] },
|
|
950
|
+
{ "constraint": "aim-torso-transform", "keys": [{ "t": 0, "mixRotate": 0.6 }] },
|
|
951
|
+
{ "constraint": "aim-front-arm-transform", "keys": [{ "t": 0, "mixRotate": 1 }] }
|
|
952
|
+
]
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
```
|
|
956
|
+
|
|
957
|
+
⚠️ **Every number above is invented**, including the 0.6 — a torso that follows the
|
|
958
|
+
aim less than the head is a plausible rig and not a measured one.
|
|
959
|
+
|
|
960
|
+
A single key at `t: 0` is the whole timeline here, and that is not a degenerate
|
|
961
|
+
case: it says "while this animation is playing, this constraint is on", which is
|
|
962
|
+
exactly what a mix that was 0 at setup needs said.
|
|
963
|
+
|
|
964
|
+
| Field | Absent means |
|
|
965
|
+
| --- | --- |
|
|
966
|
+
| `mixRotate` | `1` |
|
|
967
|
+
| `mixX` | `1` |
|
|
968
|
+
| `mixY` | **this key's own `mixX`** — not `1` |
|
|
969
|
+
| `mixScaleX` | `1` |
|
|
970
|
+
| `mixScaleY` | `1` |
|
|
971
|
+
| `mixShearY` | `1` |
|
|
972
|
+
|
|
973
|
+
- **Six curve channels, in the order above.** A raw `curve` is 24 numbers.
|
|
974
|
+
- No range check: every one of these is documented **unbounded**, and an over-mix
|
|
975
|
+
above 1 is a real editor idiom rather than a mistake.
|
|
976
|
+
- ⚠️ A mix is only read by the runtime if the constraint declares the matching
|
|
977
|
+
`properties` mapping (§3.5). Keying `mixScaleY` on a constraint that maps
|
|
978
|
+
rotation only is dead data — legal, loaded, and it moves nothing.
|
|
979
|
+
- The refusals are §4.9's, with `transform` in place of `ik`.
|
|
980
|
+
|
|
981
|
+
### 4.11 `deform` — moving an attachment's vertices
|
|
982
|
+
|
|
983
|
+
The one timeline whose keys mean something different depending on what they are
|
|
984
|
+
attached to, and the only one keyed on a **skin / slot / attachment** triple:
|
|
985
|
+
`animations.<a>.attachments.<skin>.<slot>.<attachment>.deform`.
|
|
986
|
+
|
|
987
|
+
```json
|
|
988
|
+
"animations": {
|
|
989
|
+
"hoverboard": {
|
|
990
|
+
"duration": 1.6666666,
|
|
991
|
+
"loop": true,
|
|
992
|
+
"tracks": [],
|
|
993
|
+
"deform": [
|
|
994
|
+
{
|
|
995
|
+
"slot": "board",
|
|
996
|
+
"attachment": "board",
|
|
997
|
+
"keys": [
|
|
998
|
+
{ "t": 0 },
|
|
999
|
+
{ "t": 0.5, "fromVertex": 4, "vertices": [0, -7, 0, -7], "ease": "settle" },
|
|
1000
|
+
{ "t": 1.1666666, "fromVertex": 4, "vertices": [0, 4, 0, 4], "ease": "settle" },
|
|
1001
|
+
{ "t": 1.6666666 }
|
|
1002
|
+
]
|
|
1003
|
+
}
|
|
1004
|
+
]
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
```
|
|
1008
|
+
|
|
1009
|
+
⚠️ **Every number above is invented** — the vertex indices, the offsets and the
|
|
1010
|
+
times alike. A real deform's numbers come from the geometry it is bending, and
|
|
1011
|
+
there is no way to guess which vertices of somebody's board are its middle.
|
|
1012
|
+
|
|
1013
|
+
| Field | Meaning |
|
|
1014
|
+
| --- | --- |
|
|
1015
|
+
| `skin` | which skin the attachment lives in. Absent = `"default"` |
|
|
1016
|
+
| `slot` | the slot |
|
|
1017
|
+
| `attachment` | the attachment's **placeholder** name inside that skin and slot |
|
|
1018
|
+
|
|
1019
|
+
Per key:
|
|
1020
|
+
|
|
1021
|
+
| Field | Meaning |
|
|
1022
|
+
| --- | --- |
|
|
1023
|
+
| `vertices` | the run: `x, y` offset pairs. **Absent** = back to the setup pose |
|
|
1024
|
+
| `fromVertex` | which VERTEX the run starts at — rigc translates it |
|
|
1025
|
+
| `offset` | the same start as a raw index into the deform array. Never with `fromVertex` |
|
|
1026
|
+
| `ease` / `curve` | one channel, and it eases the **blend**, not a coordinate |
|
|
1027
|
+
|
|
1028
|
+
Four things are worth having straight before you write one.
|
|
1029
|
+
|
|
1030
|
+
**A key is a sparse edit, and a key with no `vertices` is the setup pose.** The
|
|
1031
|
+
parser builds an array as long as the attachment's own, copies your run into it at
|
|
1032
|
+
`offset`, and leaves the rest at zero. So a run only has to cover the vertices that
|
|
1033
|
+
move, and the `{ "t": 0 }` and `{ "t": 1.6666666 }` keys above are how a looping
|
|
1034
|
+
deform starts and ends undeformed. That is the format's own encoding for it, not a
|
|
1035
|
+
convention — which is why rigc refuses a start index on such a key: there would be
|
|
1036
|
+
nothing for it to point at.
|
|
1037
|
+
|
|
1038
|
+
**Offsets, not positions.** The numbers are relative to the setup geometry in both
|
|
1039
|
+
encodings. On an unweighted attachment the parser literally adds the setup vertex
|
|
1040
|
+
back on load; on a weighted one zero *is* "unmoved".
|
|
1041
|
+
|
|
1042
|
+
**The array is indexed by vertex on an unweighted attachment and by bone influence
|
|
1043
|
+
on a weighted one.** Its length is `vertices.length` in the first case and
|
|
1044
|
+
`vertices.length / 3 * 2` in the second, because a weighted attachment stores
|
|
1045
|
+
`x, y, weight` per influence. A vertex with three bones on it therefore occupies
|
|
1046
|
+
**three** pairs, each in that bone's own bind space. This is the whole reason
|
|
1047
|
+
`fromVertex` exists and the whole reason it is sometimes refused:
|
|
1048
|
+
|
|
1049
|
+
- on an **unweighted** attachment `fromVertex` always works — vertex *v* is array
|
|
1050
|
+
index `2v`, exactly;
|
|
1051
|
+
- on a **weighted** one it works while every vertex the run covers has exactly one
|
|
1052
|
+
bone on it, and rigc computes the true start index for you (which is *not*
|
|
1053
|
+
`2v` — earlier multi-bone vertices push it along);
|
|
1054
|
+
- on a **multi-bone** vertex it is a compile error, and deliberately so. One
|
|
1055
|
+
`x, y` for such a vertex is not a thing the array can hold: its world offset is
|
|
1056
|
+
`Σ weightᵦ · Mᵦ · offsetᵦ` over its bones, so a single pair only means what you
|
|
1057
|
+
meant if every influencing bone happens to share one world matrix. rigc will not
|
|
1058
|
+
guess. Either key the control bone instead — which is what a rigc-generated ring
|
|
1059
|
+
or ribbon mesh is *for* — or write the bind-space pairs yourself and start the
|
|
1060
|
+
run with `offset`. The refusal tells you the index that vertex starts at.
|
|
1061
|
+
|
|
1062
|
+
**The curve eases the blend.** A deform timeline has exactly one channel and
|
|
1063
|
+
`readCurve` builds it between **0 and 1** — the fraction of the way from this key's
|
|
1064
|
+
geometry to the next one's. So a named `ease` behaves as it does anywhere, and a
|
|
1065
|
+
raw `curve` is 4 numbers whose value axis runs 0..1, not the range of your vertex
|
|
1066
|
+
offsets.
|
|
1067
|
+
|
|
1068
|
+
rigc refuses six things here, and the first is the quietest defect in the whole
|
|
1069
|
+
animation half of the format:
|
|
1070
|
+
|
|
1071
|
+
| You wrote | You get |
|
|
1072
|
+
| --- | --- |
|
|
1073
|
+
| a run that ends past the array | `the run starts at deform index 4 and is 6 long, which ends at 10; this attachment's deform array is 8 long (4 vertices)` |
|
|
1074
|
+
| an odd `offset` | `offset 3 is odd. The deform array is x, y pairs, so an odd start puts every x of this run on a y` |
|
|
1075
|
+
| an odd number of `vertices` | `"vertices" holds 3 numbers; the deform array is x, y PAIRS` |
|
|
1076
|
+
| `fromVertex` on a multi-bone vertex | `"fromVertex" counts VERTICES, and this attachment is weighted … vertex 2 has 2 of them` |
|
|
1077
|
+
| an attachment that is not there | `slot "flat" in skin "default" has no attachment "flatt" (it has: flat)` |
|
|
1078
|
+
| a deform on a region attachment | `a deform timeline keys the vertices of an attachment, and this one is a "region"` |
|
|
1079
|
+
|
|
1080
|
+
The overrun is the one to fear. `readAnimation` copies with
|
|
1081
|
+
`Utils.arrayCopy(vertices, 0, deform, offset, vertices.length)` into a
|
|
1082
|
+
`Float32Array`, and writing past the end of a typed array is a **no-op in
|
|
1083
|
+
JavaScript** — no throw, no warning, no `NaN`. A run one pair too long loses its
|
|
1084
|
+
tail and deforms the rest of the mesh correctly, which looks nearly right, and
|
|
1085
|
+
"nearly right" is the hardest kind of wrong to find.
|
|
1086
|
+
`A35_DEFORM_KEYS_FIT_THE_ATTACHMENT` checks all of it from the other side, on the
|
|
1087
|
+
emitted file, measuring the array's length from the attachment rather than assuming
|
|
1088
|
+
an encoding.
|
|
1089
|
+
|
|
822
1090
|
---
|
|
823
1091
|
|
|
824
1092
|
## 5. Reading a failure
|
|
@@ -857,6 +1125,14 @@ the frequent ones, verbatim:
|
|
|
857
1125
|
| `vertexCount N wants M unweighted numbers and "vertices" holds K` | fix the count or the array; they decide the encoding between them |
|
|
858
1126
|
| `end names slot "X", which this rig does not declare` | fix the clipping attachment's `end`, or add the slot |
|
|
859
1127
|
| `bone "X" takes its position from …, which needs a cut manifest` | R8 — pass `--manifest`, or write literal `x`/`y` |
|
|
1128
|
+
| `animation "A" keys unknown ik constraint "X"; the rig declares ik constraint(s): …` | §4.9 — fix the name, or declare the constraint in the rig spec |
|
|
1129
|
+
| `animation "A" keys "X" as an ik constraint, but the rig declares it as a "transform" constraint` | §4.9 — a timeline's target resolves by name AND type; put the entry under the right group |
|
|
1130
|
+
| `ik constraint "X": key 0 names "softness" and key 1 (t=…) does not` | §4.9 — every key is read with its own default, so state the field on every key or on none |
|
|
1131
|
+
| `ik constraint "X" (t=…): mix is 1.5, outside 0..1` | §4.9 — an IK mix is a percentage; a transform mix is unbounded |
|
|
1132
|
+
| `deform …: the run starts at deform index 4 and is 6 long, which ends at 10; this attachment's deform array is 8 long` | §4.11 — shorten the run or move its start; the parser would drop the tail in silence |
|
|
1133
|
+
| `deform … (t=…): offset 3 is odd` | §4.11 — the deform array is `x, y` pairs, so a run starts on an even index |
|
|
1134
|
+
| `deform …: "fromVertex" counts VERTICES, and this attachment is weighted … vertex 2 has 2 of them` | §4.11 — key the control bone, or write bind-space pairs and start with `offset` |
|
|
1135
|
+
| `deform …: slot "X" in skin "default" has no attachment "Y" (it has: …)` | §4.11 — fix the placeholder name |
|
|
860
1136
|
|
|
861
1137
|
### 5.2 Assertions — the gate
|
|
862
1138
|
|
|
@@ -917,6 +1193,8 @@ The report prints one line per assertion:
|
|
|
917
1193
|
| `A31_DRAW_ORDER_OFFSETS_RESOLVE` | both | a draw-order key names a slot the skeleton does not have, offsets one slot twice, puts a slot outside the slots array, or lists its offsets out of slot order (§4.7). The only assertion that runs **before** `A00` — the last of those shapes makes the loader spin rather than return, so the round trip is refused instead of attempted |
|
|
918
1194
|
| `A32_EVENT_KEYS_RESOLVE` | both | an event key fires a name the skeleton's `events` block does not declare, sits earlier in time than the key before it, or sets `volume`/`balance` on an event with no `audio` (§4.8). **SKIP** when no animation carries an event timeline |
|
|
919
1195
|
| `A33_VERTEX_ATTACHMENT_GEOMETRY` | both | a bounding box or clipping polygon whose `vertexCount` is missing or disagrees with its vertex array, a weighted run that decodes to the wrong number of vertices or an out-of-range bone index, or a clipping `end` naming a slot the skeleton does not have (§3.4). **SKIP** when the skeleton carries neither type |
|
|
1196
|
+
| `A34_CONSTRAINT_TIMELINE_TARGETS` | both | an `ik` or `transform` timeline names a constraint the skeleton does not declare, names one of the other type, or carries no keys at all (§4.9, §4.10). The last is silent: the parser reads key 0, finds nothing, and skips the timeline. **SKIP** when no animation carries one |
|
|
1197
|
+
| `A35_DEFORM_KEYS_FIT_THE_ATTACHMENT` | both | a deform key's run runs past the end of the attachment's deform array, starts on an odd index, holds an odd count of numbers or a non-finite one, or names a skin/slot/attachment triple that does not resolve (§4.11). The overrun is the quiet one — the parser copies into a `Float32Array` and drops the tail. **SKIP** when no animation carries a deform timeline |
|
|
920
1198
|
|
|
921
1199
|
`both ◑` marks a mixed assertion: its validity half always runs and its policy
|
|
922
1200
|
clauses are gated by profile.
|
|
@@ -947,10 +1225,13 @@ Two more limits that are not errors but will shape what you can attempt:
|
|
|
947
1225
|
region covers its whole page, `pma: false`. To reproduce a skeleton whose art
|
|
948
1226
|
ships as a packed atlas you either supply loose PNGs and let rigc build its own
|
|
949
1227
|
atlas, or hand the packed atlas to `validate`/`bench` alongside the candidate.
|
|
950
|
-
-
|
|
951
|
-
by the validator
|
|
952
|
-
|
|
953
|
-
|
|
1228
|
+
- **`sequence` timelines, `drawOrderFolder` and `slider` / `path` constraint
|
|
1229
|
+
timelines** are walked by the validator (so `A05` checks their curves and `diff`
|
|
1230
|
+
counts their keys) and cannot be *written*: there is no motion-spec property for
|
|
1231
|
+
any of them. The two constraint groups are blocked one level down — rigc emits no
|
|
1232
|
+
`path` or `slider` constraint to key. Everything a motion spec **can** key is
|
|
1233
|
+
§4.4's track table plus the five families that sit beside `tracks`: `drawOrder`
|
|
1234
|
+
(§4.7), `events` (§4.8), `ik` (§4.9), `transform` (§4.10) and `deform` (§4.11).
|
|
954
1235
|
|
|
955
1236
|
---
|
|
956
1237
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-rigc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Rig compiler for Spine — declarative rig specs in, Spine 4.3 skeleton data out, verified by a spine-core round-trip. Built so AI agents can author rigs and check their own work; the output imports into the Spine editor.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|