rig-c 0.0.0-stage → 2.20.4
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/.claude-plugin/marketplace.json +19 -0
- package/.claude-plugin/plugin.json +13 -0
- package/LICENSE +30 -0
- package/NOTICE.md +145 -0
- package/README.md +817 -3
- package/bin/rigc.cjs +83 -0
- package/cli.ts +61 -0
- package/cli_core.ts +46 -0
- package/docs/AUTHORING.md +9923 -0
- package/docs/FACE.md +1948 -0
- package/docs/INGEST.md +1488 -0
- package/docs/MOTION.md +1241 -0
- package/docs/PROMPTING.md +109 -0
- package/docs/RIGGING.md +1441 -0
- package/docs/SPEC_COVERAGE.md +357 -0
- package/package.json +108 -4
- package/skills/rigc/SKILL.md +133 -0
- package/skills/rigc-face/SKILL.md +60 -0
- package/skills/rigc-ingest/SKILL.md +78 -0
- package/skills/rigc-motion/SKILL.md +51 -0
- package/skills/rigc-rigging/SKILL.md +49 -0
- package/src/areaband.ts +159 -0
- package/src/assertions/bodies/a01.ts +23 -0
- package/src/assertions/bodies/a02.ts +21 -0
- package/src/assertions/bodies/a03.ts +27 -0
- package/src/assertions/bodies/a04.ts +40 -0
- package/src/assertions/bodies/a05.ts +56 -0
- package/src/assertions/bodies/a06.ts +245 -0
- package/src/assertions/bodies/a07.ts +68 -0
- package/src/assertions/bodies/a08.ts +76 -0
- package/src/assertions/bodies/a09.ts +82 -0
- package/src/assertions/bodies/a10.ts +116 -0
- package/src/assertions/bodies/a11.ts +15 -0
- package/src/assertions/bodies/a12.ts +30 -0
- package/src/assertions/bodies/a13.ts +51 -0
- package/src/assertions/bodies/a14.ts +35 -0
- package/src/assertions/bodies/a15.ts +97 -0
- package/src/assertions/bodies/a16.ts +24 -0
- package/src/assertions/bodies/a17.ts +26 -0
- package/src/assertions/bodies/a18.ts +62 -0
- package/src/assertions/bodies/a19.ts +404 -0
- package/src/assertions/bodies/a20.ts +122 -0
- package/src/assertions/bodies/a21.ts +190 -0
- package/src/assertions/bodies/a22.ts +39 -0
- package/src/assertions/bodies/a23.ts +305 -0
- package/src/assertions/bodies/a24.ts +68 -0
- package/src/assertions/bodies/a25.ts +39 -0
- package/src/assertions/bodies/a26.ts +61 -0
- package/src/assertions/bodies/a27.ts +33 -0
- package/src/assertions/bodies/a28.ts +70 -0
- package/src/assertions/bodies/a29.ts +34 -0
- package/src/assertions/bodies/a30.ts +50 -0
- package/src/assertions/bodies/a31.ts +61 -0
- package/src/assertions/bodies/a32.ts +44 -0
- package/src/assertions/bodies/a33.ts +110 -0
- package/src/assertions/bodies/a34.ts +133 -0
- package/src/assertions/bodies/a35.ts +160 -0
- package/src/assertions/bodies/a36.ts +81 -0
- package/src/assertions/bodies/a37.ts +77 -0
- package/src/assertions/bodies/a38.ts +73 -0
- package/src/assertions/bodies/a39.ts +303 -0
- package/src/assertions/bodies/a40.ts +128 -0
- package/src/assertions/bodies/a42.ts +97 -0
- package/src/assertions/bodies/a43.ts +181 -0
- package/src/assertions/bodies/a44.ts +23 -0
- package/src/assertions/bodies/a45.ts +172 -0
- package/src/assertions/bodies/a46.ts +224 -0
- package/src/assertions/bodies/a47.ts +126 -0
- package/src/assertions/bodies/a48.ts +83 -0
- package/src/assertions/bodies/a49.ts +81 -0
- package/src/assertions/bodies/a50.ts +97 -0
- package/src/assertions/constraint_words.ts +169 -0
- package/src/assertions/emitted/index.ts +148 -0
- package/src/assertions/facts/animated_bones.ts +30 -0
- package/src/assertions/facts/animation_durations.ts +37 -0
- package/src/assertions/facts/atlas_pages.ts +19 -0
- package/src/assertions/facts/atlas_regions.ts +52 -0
- package/src/assertions/facts/bone_timelines.ts +37 -0
- package/src/assertions/facts/constraint_targets.ts +56 -0
- package/src/assertions/facts/constraints.ts +155 -0
- package/src/assertions/facts/deform_survey.ts +27 -0
- package/src/assertions/facts/event_keys.ts +55 -0
- package/src/assertions/facts/linked_meshes.ts +38 -0
- package/src/assertions/facts/mesh_attachments.ts +100 -0
- package/src/assertions/facts/region_joins.ts +34 -0
- package/src/assertions/facts/sequences.ts +85 -0
- package/src/assertions/facts/skeleton_roster.ts +45 -0
- package/src/assertions/facts/skin_entries.ts +37 -0
- package/src/assertions/facts/skin_members.ts +53 -0
- package/src/assertions/facts/slider_composition.ts +78 -0
- package/src/assertions/facts/slot_colour.ts +43 -0
- package/src/assertions/facts/stage.ts +27 -0
- package/src/assertions/facts/stage_box.ts +65 -0
- package/src/assertions/facts/stepped_poses.ts +74 -0
- package/src/assertions/facts/two_colour.ts +52 -0
- package/src/assertions/facts/vertex_polygons.ts +53 -0
- package/src/assertions/footprints.ts +367 -0
- package/src/assertions/harness.ts +109 -0
- package/src/assertions/inward_advance.ts +58 -0
- package/src/assertions/kinds.ts +105 -0
- package/src/assertions/mesh_kinds.ts +56 -0
- package/src/assertions/model/animated_bones.ts +38 -0
- package/src/assertions/model/animation_durations.ts +57 -0
- package/src/assertions/model/atlas_pages.ts +15 -0
- package/src/assertions/model/atlas_regions.ts +76 -0
- package/src/assertions/model/bone_timelines.ts +58 -0
- package/src/assertions/model/constraint_targets.ts +82 -0
- package/src/assertions/model/constraints.ts +233 -0
- package/src/assertions/model/declared.ts +125 -0
- package/src/assertions/model/deform_survey.ts +24 -0
- package/src/assertions/model/event_keys.ts +45 -0
- package/src/assertions/model/given.ts +45 -0
- package/src/assertions/model/index.ts +398 -0
- package/src/assertions/model/linked_meshes.ts +24 -0
- package/src/assertions/model/mesh_attachments.ts +119 -0
- package/src/assertions/model/parse.ts +146 -0
- package/src/assertions/model/region_joins.ts +67 -0
- package/src/assertions/model/runtime_timelines.ts +78 -0
- package/src/assertions/model/sequences.ts +157 -0
- package/src/assertions/model/skeleton_roster.ts +23 -0
- package/src/assertions/model/skin_entries.ts +69 -0
- package/src/assertions/model/skin_members.ts +64 -0
- package/src/assertions/model/slider_composition.ts +193 -0
- package/src/assertions/model/slot_colour.ts +81 -0
- package/src/assertions/model/stage.ts +28 -0
- package/src/assertions/model/stage_box.ts +51 -0
- package/src/assertions/model/stepped_poses.ts +105 -0
- package/src/assertions/model/two_colour.ts +61 -0
- package/src/assertions/model/vertex_polygons.ts +72 -0
- package/src/assertions/reasons.ts +129 -0
- package/src/assertions/region_lookups.ts +61 -0
- package/src/assertions/report.ts +189 -0
- package/src/assertions/values.ts +39 -0
- package/src/atlas.ts +2870 -0
- package/src/ballot.ts +866 -0
- package/src/bonedist.ts +643 -0
- package/src/chainfit.ts +2752 -0
- package/src/chains.ts +170 -0
- package/src/check.ts +4303 -0
- package/src/checkpics.ts +295 -0
- package/src/cli/core_commands.ts +1627 -0
- package/src/cli/repack.ts +414 -0
- package/src/cli/shared.ts +2776 -0
- package/src/cli/spine_commands.ts +820 -0
- package/src/compile.ts +9414 -0
- package/src/core/additive.ts +458 -0
- package/src/core/animation.ts +1050 -0
- package/src/core/clipping.ts +696 -0
- package/src/core/constraints.ts +1876 -0
- package/src/core/constraints_path.ts +964 -0
- package/src/core/constraints_physics.ts +881 -0
- package/src/core/constraints_slider.ts +635 -0
- package/src/core/deform.ts +613 -0
- package/src/core/draw_order.ts +125 -0
- package/src/core/events.ts +135 -0
- package/src/core/hooks.ts +249 -0
- package/src/core/index.ts +1400 -0
- package/src/core/raw.ts +739 -0
- package/src/core/skins.ts +129 -0
- package/src/core/uvs.ts +469 -0
- package/src/core/vertices.ts +490 -0
- package/src/core/walk.ts +197 -0
- package/src/core/world.ts +289 -0
- package/src/correspondence.ts +15 -0
- package/src/deformbuild.ts +60 -0
- package/src/deformgen.ts +630 -0
- package/src/deformmeasure.ts +732 -0
- package/src/deformreport.ts +373 -0
- package/src/deformstructure.ts +386 -0
- package/src/deformsurvey.ts +2162 -0
- package/src/depth.ts +784 -0
- package/src/diff.ts +2252 -0
- package/src/emit.ts +134 -0
- package/src/emit_spine.ts +854 -0
- package/src/errors.ts +53 -0
- package/src/framing.ts +819 -0
- package/src/generation.ts +139 -0
- package/src/ingest.ts +2293 -0
- package/src/json-position.ts +253 -0
- package/src/keyorder.ts +587 -0
- package/src/keys.ts +486 -0
- package/src/ladder.ts +121 -0
- package/src/mesh.ts +2382 -0
- package/src/meshcompare.ts +1188 -0
- package/src/meshquality.ts +2042 -0
- package/src/meshrasters.ts +944 -0
- package/src/meshreduce.ts +1425 -0
- package/src/model.ts +1245 -0
- package/src/motion.ts +809 -0
- package/src/nonfinite.ts +54 -0
- package/src/package_meta.ts +48 -0
- package/src/png.ts +297 -0
- package/src/pose.ts +2324 -0
- package/src/preview.ts +434 -0
- package/src/region_joins.ts +54 -0
- package/src/render.ts +1013 -0
- package/src/render_core.ts +871 -0
- package/src/render_shared.ts +2958 -0
- package/src/repack.ts +495 -0
- package/src/rig.ts +2941 -0
- package/src/slots.ts +892 -0
- package/src/spine_side.ts +138 -0
- package/src/timelines.ts +837 -0
- package/src/trackgen.ts +364 -0
- package/src/transform.ts +310 -0
- package/src/types.ts +1797 -0
- package/src/validate.ts +3875 -0
- package/tools/contact.ts +126 -0
- package/tools/editor_roundtrip.ts +1641 -0
- package/tools/font5x7.ts +101 -0
- package/tools/measure_contact_depth.ts +105 -0
- package/tools/plate.ts +508 -0
- package/tools/png_probe.mjs +72 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `DEFORM` report block `rigc explain` prints (issue #316), as a function of
|
|
3
|
+
* the deform survey alone (issue #969): moved out of `cli.ts` whole, so that a
|
|
4
|
+
* control can render it off a survey taken through either poser — spine-core
|
|
5
|
+
* over the Spine skeleton, rigc's own core over the model document — and hold
|
|
6
|
+
* the two blocks to each other. `cli.ts`'s `deformReportLines` states why the
|
|
7
|
+
* block is a report and not an assertion, and what it deliberately leaves out.
|
|
8
|
+
*/
|
|
9
|
+
import type { CompileResult } from './types.ts';
|
|
10
|
+
import type { DeformExtreme, DeformKeyMeasure, DeformSpan, DeformSurvey } from './deformsurvey.ts';
|
|
11
|
+
import { unreachableWhy } from './deformsurvey.ts';
|
|
12
|
+
import { float32Step } from './timelines.ts';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* One extreme, as `x0.637306 tri 0`, or an em dash when no triangle on the key
|
|
16
|
+
* could carry the quantity.
|
|
17
|
+
*
|
|
18
|
+
* A dash rather than `x1.000000`: a key over a mesh whose every triangle is a
|
|
19
|
+
* hair has no ratio and no map, and printing the identity there would report a
|
|
20
|
+
* measurement that was never taken — this repository's favourite false green.
|
|
21
|
+
*/
|
|
22
|
+
function deformExtreme(extreme: DeformExtreme | null): string {
|
|
23
|
+
return extreme === null ? '—'.padEnd(9) : `x${extreme.value.toFixed(6)} tri ${extreme.triangle}`;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** `head/head key 1`, which is how A39's own message names a key. */
|
|
27
|
+
function deformKeyName(key: DeformKeyMeasure): string {
|
|
28
|
+
return `${key.slot}/${key.attachment} key ${key.key}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Does this compiled `transform` report belong to this loaded key?
|
|
33
|
+
*
|
|
34
|
+
* ⚠️ The two times are not the same number and cannot be compared with `===`.
|
|
35
|
+
* The report's is the spec's own `t`; the survey's came back through
|
|
36
|
+
* `Float32Array`, because that is what `spine-core` reads a timeline's frames
|
|
37
|
+
* into — a key written `0.62` arrives as `0.6200000047683716`. So the tolerance
|
|
38
|
+
* is one float32 step at this magnitude (`float32Step`): the compiler emits a
|
|
39
|
+
* key time as a float's name — the spec's own time when it names one, the float
|
|
40
|
+
* below it when it does not (issue #716) — so the loaded float is within one
|
|
41
|
+
* step of the spec's `t` either way, which is narrower than any key spacing the
|
|
42
|
+
* format can hold.
|
|
43
|
+
*/
|
|
44
|
+
function sameKeyTime(specTime: number, loaded: number): boolean {
|
|
45
|
+
return Math.abs(specTime - loaded) <= float32Step(loaded);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The block, off `survey` — `cli.ts`'s `deformReportLines` says what each line is and why. */
|
|
49
|
+
export function deformReportBlock(survey: DeformSurvey, deformTransforms: CompileResult['deformTransforms'], exempt: ReadonlySet<string>): string[] {
|
|
50
|
+
if (survey.timelines === 0) return [];
|
|
51
|
+
const out: string[] = ['', 'deform (what each key does to the geometry — figures with names, never a bar; issue #316)'];
|
|
52
|
+
// A survey that fell back from the reader it was meant to use says so where it is read (issue #1019): the
|
|
53
|
+
// figures are the same survey either way, and a fallback nobody can see is a second opinion nobody asked for.
|
|
54
|
+
if (survey.source.why !== null) out.push(` .. read and posed through ${survey.source.used}: ${survey.source.why}`);
|
|
55
|
+
// The legend costs six lines and is worth them exactly once — on a report that
|
|
56
|
+
// has figures in it. A bounding box or a clipping polygon deformed and nothing
|
|
57
|
+
// else gets the reason it has no figures and no essay about them.
|
|
58
|
+
if (survey.keys.length) {
|
|
59
|
+
out.push(
|
|
60
|
+
' .. every key measured at its OWN time against the same pose with the deform CLEARED, so the',
|
|
61
|
+
' .. denominator is 1.000 by definition and a NEGATIVE area ratio IS a reversed triangle',
|
|
62
|
+
' .. the FRAME is on each key line: on a track, or the slider that applies the animation with the',
|
|
63
|
+
' .. dial value its mapping was inverted to — a slider picks the time, so the key\'s time IS it',
|
|
64
|
+
' .. stretch is the two singular values of the map from the cleared triangle to the deformed one —',
|
|
65
|
+
' .. the worst stretch and the worst squash the drawing takes there; their product is |area ratio|',
|
|
66
|
+
' .. coverage is NOT here: it is rasterised from the uvs, which no deform moves, so the figure on',
|
|
67
|
+
' .. the `meshes` line below is already the deformed one',
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (survey.notAMesh.length) {
|
|
71
|
+
out.push(` .. ${survey.notAMesh.join(', ')} deform an attachment with no triangles — nothing to measure`);
|
|
72
|
+
}
|
|
73
|
+
for (const key of survey.keys) {
|
|
74
|
+
const model = deformTransforms.find(
|
|
75
|
+
(g) =>
|
|
76
|
+
g.animation === key.animation &&
|
|
77
|
+
g.skin === key.skin &&
|
|
78
|
+
g.slot === key.slot &&
|
|
79
|
+
g.attachment === key.placeholder &&
|
|
80
|
+
sameKeyTime(g.time, key.time),
|
|
81
|
+
);
|
|
82
|
+
// A stated model is quoted rather than reduced to its results: `yaw
|
|
83
|
+
// radius=170 degrees=12` is what a reviewer checks the ratios against, and an
|
|
84
|
+
// authored table says so instead of saying nothing, because "no model here"
|
|
85
|
+
// is itself the thing a reader of a wrong ratio needs to know.
|
|
86
|
+
const states = model === undefined ? 'authored table' : `transform ${model.kind} ${model.stated}`;
|
|
87
|
+
out.push(
|
|
88
|
+
` DEFORM ${key.animation} ${key.skin}/${key.slot}/${key.placeholder} key ${key.key} ` +
|
|
89
|
+
`t=${key.time.toFixed(6)} ${states}`,
|
|
90
|
+
);
|
|
91
|
+
// 🔒 The frame, on every key, because the derivation is shared with A39 and
|
|
92
|
+
// this block is where a reader finds out which one it was (issue #407). A
|
|
93
|
+
// track frame says so in three words; a slider frame names the dial value
|
|
94
|
+
// its own mapping inverts this time to, which is the number an author sets.
|
|
95
|
+
out.push(
|
|
96
|
+
` frame ${key.reach.label}` +
|
|
97
|
+
(key.dial === null
|
|
98
|
+
? ''
|
|
99
|
+
: `, dial ${key.dial.value.toFixed(6)}` +
|
|
100
|
+
// ⚠️ `reach.drive` names the field when it is NOT the one `property`
|
|
101
|
+
// names, which happens under `local: false` on a rotated parent — a
|
|
102
|
+
// bare figure there would read as a value of the wrong field (#419).
|
|
103
|
+
(key.reach.local || key.dial.driven === key.dial.value
|
|
104
|
+
? ''
|
|
105
|
+
: ` (bone local ${key.reach.drive === null ? '' : `${key.reach.drive} `}${key.dial.driven.toFixed(6)})`) +
|
|
106
|
+
` -> t=${key.dial.applied.toFixed(6)}`),
|
|
107
|
+
);
|
|
108
|
+
// A key at a time no dial selects: the figures below are the frame the
|
|
109
|
+
// runtime DOES land on, which is some other time's geometry, so the line
|
|
110
|
+
// that says so comes before them and the gate reads none of them.
|
|
111
|
+
if (key.dial?.unreachable === true) {
|
|
112
|
+
out.push(
|
|
113
|
+
` unreachable A39 gates nothing here: ${unreachableWhy(key)}. Every figure below is that other ` +
|
|
114
|
+
"frame's, not this key's",
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
// ⚠️ An exemption nobody can see is how a gate comes to look kept while
|
|
118
|
+
// checking nothing (issue #401). A key the gate passed over because the mesh
|
|
119
|
+
// draws no pixels there says so on its own line, in the survey's own words,
|
|
120
|
+
// whether or not it folds.
|
|
121
|
+
if (key.draw.blank !== null) {
|
|
122
|
+
out.push(
|
|
123
|
+
` skipped A39 reads no winding off this key: ${key.draw.blank} — a triangle that draws no ` +
|
|
124
|
+
'pixels cannot draw them backwards',
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
// And when the slot shows something else, the figures below would be a
|
|
128
|
+
// second falsehood rather than a caveat: the runtime applies no deform to a
|
|
129
|
+
// slot that is not showing the mesh (`DeformTimeline.applyToSlot`), so every
|
|
130
|
+
// figure would be the identity and `moved 0` would read as "this key is the
|
|
131
|
+
// setup pose" — which is exactly what the key is NOT.
|
|
132
|
+
if (!key.draw.showsThisMesh) {
|
|
133
|
+
out.push(
|
|
134
|
+
` .. the slot shows ${key.draw.shown === null ? 'no attachment' : `"${key.draw.shown}"`} ` +
|
|
135
|
+
'here, so the runtime applied no deform and there is no posed geometry to measure' +
|
|
136
|
+
(key.draw.blank === null
|
|
137
|
+
? ' — but the mesh IS drawn in another slot this deform reaches (timelineSlots), so nothing here is exempt'
|
|
138
|
+
: ''),
|
|
139
|
+
);
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
// A key that moves nothing gets one line and no figures. `{ "t": 2.2 }` with
|
|
143
|
+
// no run is the format's own way of writing "back to the setup pose" (§4.11),
|
|
144
|
+
// and its geometry is bit-identical to the cleared pose it would be measured
|
|
145
|
+
// against — so `x1.000000` there is the definition and not a measurement, and
|
|
146
|
+
// four lines of it on every loop's opening and closing key is the noise that
|
|
147
|
+
// stops the block being read. It is still counted in the rollup below,
|
|
148
|
+
// because A39 measures it too.
|
|
149
|
+
if (key.moved === 0) {
|
|
150
|
+
out.push(
|
|
151
|
+
` moved 0 of ${key.vertices} vertices — this key IS the setup pose, so every ` +
|
|
152
|
+
`figure is the identity (${key.triangles} triangles, all kept)`,
|
|
153
|
+
);
|
|
154
|
+
continue;
|
|
155
|
+
}
|
|
156
|
+
out.push(
|
|
157
|
+
` moved ${key.moved} of ${key.vertices} vertices, ` +
|
|
158
|
+
`worst ${key.maxDisplacement.toFixed(4)}px at v${key.maxDisplacementVertex}`,
|
|
159
|
+
);
|
|
160
|
+
out.push(
|
|
161
|
+
` area min ${deformExtreme(key.areaRatioMin)} max ${deformExtreme(key.areaRatioMax)} ` +
|
|
162
|
+
`(${key.triangles} triangles, ${key.degenerate} with no area at the cleared pose, band ${key.band.toFixed(6)}px²)`,
|
|
163
|
+
);
|
|
164
|
+
out.push(
|
|
165
|
+
` stretch max ${deformExtreme(key.stretchMax)} min ${deformExtreme(key.stretchMin)}`,
|
|
166
|
+
);
|
|
167
|
+
// The marker has to know about the exemption, or it says the false half of
|
|
168
|
+
// the truth on the one build where it matters: a declared fold IS a fold and
|
|
169
|
+
// A39 does not refuse it — it SKIPs the slot entirely.
|
|
170
|
+
const exempted = exempt.has(key.slot);
|
|
171
|
+
const fold = key.reversed.length
|
|
172
|
+
? key.draw.blank !== null
|
|
173
|
+
? ' <- a fold, and nothing gates it: this key draws no pixels (see above)'
|
|
174
|
+
: exempted
|
|
175
|
+
? ' <- a fold, and A39 does not gate it — see below'
|
|
176
|
+
: ' <- a fold: A39 refuses this key by name'
|
|
177
|
+
: '';
|
|
178
|
+
out.push(
|
|
179
|
+
` winding ${key.triangles - key.reversed.length} of ${key.triangles} kept, ` +
|
|
180
|
+
`${key.collapsed} collapsed${fold}`,
|
|
181
|
+
);
|
|
182
|
+
if (exempted) {
|
|
183
|
+
out.push(
|
|
184
|
+
` .. A39 is exempt on "${key.slot}" (invariants.deformMayFold), so nothing here is gated`,
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
// The folds at times no key lands on (issue #403), printed after the keys they
|
|
189
|
+
// lie between rather than interleaved: they are a different measurement — the
|
|
190
|
+
// closed form named the time and the runtime was posed there — and a reader
|
|
191
|
+
// needs to be able to tell the two apart at a glance.
|
|
192
|
+
for (const span of survey.spans) {
|
|
193
|
+
if (span.fold === null) continue;
|
|
194
|
+
const at = span.fold;
|
|
195
|
+
out.push(
|
|
196
|
+
` BETWEEN ${span.animation}${span.reach.kind === 'slider' ? ` via ${span.reach.slider}` : ''} ` +
|
|
197
|
+
`${span.skin}/${span.slot}/${span.placeholder} key ${span.fromKey} -> ` +
|
|
198
|
+
`${span.toKey} t=${at.time.toFixed(6)} ${span.curve}` +
|
|
199
|
+
(span.curve === 'stepped' ? ' (held, not interpolated)' : ` ${(at.percent * 100).toFixed(1)}% of the way`),
|
|
200
|
+
);
|
|
201
|
+
out.push(
|
|
202
|
+
` winding ${at.measure.triangles - at.measure.reversed.length} of ${at.measure.triangles} kept, ` +
|
|
203
|
+
`${at.measure.collapsed} collapsed <- a fold at a time no key lands on` +
|
|
204
|
+
(at.measure.draw.blank !== null
|
|
205
|
+
? ', and nothing gates it: nothing is drawn there'
|
|
206
|
+
: exempt.has(span.slot)
|
|
207
|
+
? ', and A39 does not gate it (invariants.deformMayFold)'
|
|
208
|
+
: `: A39 refuses this span by name, at alpha ${at.measure.draw.alpha.toFixed(4)}`),
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
// The rollup, per animation: the worst key by each quantity. A timeline's own
|
|
212
|
+
// eight keys are eight blocks above, and "which of them is the one to look at"
|
|
213
|
+
// is the question the sweep in issue #313's landing comment answered by hand.
|
|
214
|
+
//
|
|
215
|
+
// ⚠️ Per animation AND per frame (issue #407). Two sliders applying one
|
|
216
|
+
// animation are two frames and two rollups: merging them would average a fold
|
|
217
|
+
// one dial reaches into a run of keys another one is clean over, which is the
|
|
218
|
+
// hiding the two frames exist to prevent.
|
|
219
|
+
// 🔒 ONE derivation of a rollup's identity, read by every filter below.
|
|
220
|
+
//
|
|
221
|
+
// ⚠️ It was spelled three times and one of them drifted. The two key filters
|
|
222
|
+
// separate animation from slider with a NUL; the span filter used a SPACE, so
|
|
223
|
+
// its `=== id` never matched on any rig and `spans` was always empty — the
|
|
224
|
+
// "N span(s) … scanned" line silently stopped printing everywhere, taking with
|
|
225
|
+
// it the one thing issue #403 added it to say: that the scan RAN and found
|
|
226
|
+
// nothing, as opposed to never having run. A dead branch is the same silence
|
|
227
|
+
// this tool exists to convert into a named failure, and it survived because
|
|
228
|
+
// the identity was a literal at each site rather than a derivation (#440).
|
|
229
|
+
const rollupId = (animation: string, slider: string | null): string => `${animation}\u0000${slider ?? ''}`;
|
|
230
|
+
/**
|
|
231
|
+
* The readings A39 puts on its stats line for the three things this rollup
|
|
232
|
+
* reports — each spelled ONCE here and nowhere else in this file.
|
|
233
|
+
*
|
|
234
|
+
* 🔒 Checked rather than derived, and the difference is forced: `src/validate.ts`
|
|
235
|
+
* sets these on a `Record<string, number | string>`, so there is no type to take
|
|
236
|
+
* a name off and no constant to import. So they are spelled here and a control
|
|
237
|
+
* compiles a rig that triggers each one, then asserts the breadcrumb names a
|
|
238
|
+
* reading A39 really printed — two independent derivations compared, which is
|
|
239
|
+
* the shape `CUR07` uses for the same reason.
|
|
240
|
+
*/
|
|
241
|
+
const A39_COUNTS = {
|
|
242
|
+
notDrawn: 'deformKeysNotDrawn',
|
|
243
|
+
unreachable: 'deformKeysUnreachable',
|
|
244
|
+
dialsDisagreed: 'deformDialsDisagreed',
|
|
245
|
+
dialDisagreed: 'deformDialDisagreed',
|
|
246
|
+
} as const;
|
|
247
|
+
const rollups = new Map<string, { animation: string; label: string }>();
|
|
248
|
+
for (const key of survey.keys) {
|
|
249
|
+
rollups.set(rollupId(key.animation, key.reach.slider), {
|
|
250
|
+
animation: key.animation,
|
|
251
|
+
label: key.reach.kind === 'slider' ? `${key.animation} via ${key.reach.slider}` : key.animation,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
for (const [id, { animation, label }] of rollups) {
|
|
255
|
+
// Only the keys the gate ran on, because the line ends by claiming A39 reads
|
|
256
|
+
// the same two counts and A39 reads none of a key that draws nothing, nor of
|
|
257
|
+
// one at a time no dial selects. The ones it left out get their own line
|
|
258
|
+
// rather than a silence (issues #401, #407).
|
|
259
|
+
const mine = survey.keys.filter((k) => rollupId(k.animation, k.reach.slider) === id);
|
|
260
|
+
const unreachable = mine.filter((k) => k.dial?.unreachable === true);
|
|
261
|
+
const keys = mine.filter((k) => k.dial?.unreachable !== true && k.draw.blank === null);
|
|
262
|
+
const blank = mine.filter((k) => k.dial?.unreachable !== true && k.draw.blank !== null);
|
|
263
|
+
const worst = (
|
|
264
|
+
pick: (key: DeformKeyMeasure) => DeformExtreme | null,
|
|
265
|
+
better: (a: number, b: number) => boolean,
|
|
266
|
+
): string => {
|
|
267
|
+
let best: { key: DeformKeyMeasure; extreme: DeformExtreme } | null = null;
|
|
268
|
+
for (const key of keys) {
|
|
269
|
+
const extreme = pick(key);
|
|
270
|
+
if (extreme === null) continue;
|
|
271
|
+
if (best === null || better(extreme.value, best.extreme.value)) best = { key, extreme };
|
|
272
|
+
}
|
|
273
|
+
return best === null ? '—' : `x${best.extreme.value.toFixed(6)} (${deformKeyName(best.key)} tri ${best.extreme.triangle})`;
|
|
274
|
+
};
|
|
275
|
+
const reversed = keys.reduce((n, k) => n + k.reversed.length, 0);
|
|
276
|
+
const collapsed = keys.reduce((n, k) => n + k.collapsed, 0);
|
|
277
|
+
const samples = keys.reduce((n, k) => n + k.triangles, 0);
|
|
278
|
+
if (keys.length) {
|
|
279
|
+
out.push(
|
|
280
|
+
` WORST ${label} area ${worst((k) => k.areaRatioMin, (a, b) => a < b)} ` +
|
|
281
|
+
`stretch ${worst((k) => k.stretchMax, (a, b) => a > b)} ` +
|
|
282
|
+
`squash ${worst((k) => k.stretchMin, (a, b) => a < b)}`,
|
|
283
|
+
);
|
|
284
|
+
out.push(
|
|
285
|
+
` .. ${''.padEnd(label.length)} reversed ${reversed}, collapsed ${collapsed}, over ` +
|
|
286
|
+
`${keys.length} key(s) and ${samples} triangle sample(s) <- A39 reads the same two counts`,
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
if (blank.length) {
|
|
290
|
+
out.push(
|
|
291
|
+
` .. ${keys.length ? ''.padEnd(label.length) : label} ${blank.length} key(s) draw no pixels ` +
|
|
292
|
+
`at their own time and are read for no winding, carrying ` +
|
|
293
|
+
`${blank.reduce((n, k) => n + k.reversed.length, 0)} reversed triangle(s) nothing gates <- A39 counts ` +
|
|
294
|
+
`them as ${A39_COUNTS.notDrawn}`,
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
if (unreachable.length) {
|
|
298
|
+
out.push(
|
|
299
|
+
` .. ${keys.length || blank.length ? ''.padEnd(label.length) : label} ${unreachable.length} key(s) ` +
|
|
300
|
+
'at a time no dial selects, measured in the frame the runtime lands on instead and read for no winding, ' +
|
|
301
|
+
`carrying ${unreachable.reduce((n, k) => n + k.reversed.length, 0)} reversed triangle(s) nothing gates ` +
|
|
302
|
+
` <- A39 counts them as ${A39_COUNTS.unreachable}`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
// ⚠️ The dial rigc's two halves disagree about (issues #427, #440). It is a
|
|
306
|
+
// property of the SLIDER and not of any one key, so it is placed by the
|
|
307
|
+
// rollup's own identity rather than by a key filter — and it is REPORTED,
|
|
308
|
+
// never gated: A39 refuses nothing for it, because a disagreement can pose
|
|
309
|
+
// every frame correctly. Both readings are named because they differ by one
|
|
310
|
+
// letter, and a breadcrumb that named only one of `deformDialsDisagreed` /
|
|
311
|
+
// `deformDialDisagreed` would send a reader to grep for the other.
|
|
312
|
+
const disputes = survey.dialDisputes.filter((dispute) => rollupId(animation, dispute.slider) === id);
|
|
313
|
+
if (disputes.length) {
|
|
314
|
+
out.push(
|
|
315
|
+
` .. ${keys.length || blank.length || unreachable.length ? ''.padEnd(label.length) : label} ` +
|
|
316
|
+
`${disputes.length} dial(s) the skeleton and the probe disagree about: ` +
|
|
317
|
+
disputes
|
|
318
|
+
.map(
|
|
319
|
+
(dispute) =>
|
|
320
|
+
`the skeleton reads ${dispute.bone}.${dispute.stated} and the probe drives ` +
|
|
321
|
+
`${dispute.bone}.${dispute.drive}, ` +
|
|
322
|
+
(dispute.outside.length === 0
|
|
323
|
+
? 'and both answers pose the same frames'
|
|
324
|
+
: `${dispute.outside.length} key time(s) outside what the skeleton's own field reaches`),
|
|
325
|
+
)
|
|
326
|
+
.join('; ') +
|
|
327
|
+
` <- A39 counts them as ${A39_COUNTS.dialsDisagreed} and spells them out as ${A39_COUNTS.dialDisagreed}`,
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
// ⚠️ Printed on a clean animation too. "The scan ran and found nothing" and
|
|
331
|
+
// "the scan never ran" are the two things a gate must never say the same
|
|
332
|
+
// way, and this line is the only place an author can tell them apart
|
|
333
|
+
// (issue #403).
|
|
334
|
+
const spans = survey.spans.filter((s) => rollupId(s.animation, s.reach.slider) === id);
|
|
335
|
+
if (spans.length) {
|
|
336
|
+
out.push(
|
|
337
|
+
` .. ${keys.length || blank.length || unreachable.length || disputes.length ? ''.padEnd(label.length) : label} ` +
|
|
338
|
+
`${spans.length} span(s) between consecutive keys scanned for a fold no key lands on: ` +
|
|
339
|
+
`${spanTally(spans)} <- A39 reads the same scan`,
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// ⚠️ And the spans that were NOT scanned, once, because a scan that did not
|
|
344
|
+
// run has to be distinguishable from one that ran and found nothing — the same
|
|
345
|
+
// rule the line above keeps, on the other side of it (issue #407).
|
|
346
|
+
if (survey.spansNotScanned) {
|
|
347
|
+
out.push(
|
|
348
|
+
` .. ${survey.spansNotScanned} span(s) NOT scanned: one of the two keys bounding each is at a time no ` +
|
|
349
|
+
'dial selects, so the interpolation between them is between two poses of some other time',
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
return out;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** What the between-keys scan found, in one clause (issue #403). */
|
|
356
|
+
function spanTally(spans: readonly DeformSpan[]): string {
|
|
357
|
+
const folds = spans.filter((s) => s.fold !== null).length;
|
|
358
|
+
const notDrawn = spans.filter((s) => s.notDrawn > 0).length;
|
|
359
|
+
const unconfirmed = spans.filter((s) => s.unconfirmed).length;
|
|
360
|
+
const probes = spans.reduce((n, s) => n + s.probed.length, 0);
|
|
361
|
+
if (folds === 0 && notDrawn === 0 && unconfirmed === 0) {
|
|
362
|
+
return `none folds (the closed form flagged nothing, so no span cost a posed measurement)`;
|
|
363
|
+
}
|
|
364
|
+
return (
|
|
365
|
+
[
|
|
366
|
+
folds ? `${folds} fold(s)` : '',
|
|
367
|
+
notDrawn ? `${notDrawn} folding only where nothing is drawn` : '',
|
|
368
|
+
unconfirmed ? `${unconfirmed} predicted a fold no probe reproduced` : '',
|
|
369
|
+
]
|
|
370
|
+
.filter(Boolean)
|
|
371
|
+
.join(', ') + `, at a cost of ${probes} posed measurement(s)`
|
|
372
|
+
);
|
|
373
|
+
}
|