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,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which Spine data generation a skeleton's own version string names.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this is one function and not a regex per caller
|
|
5
|
+
*
|
|
6
|
+
* Spine data is locked to the generation that exported it, and a mismatch fails
|
|
7
|
+
* **silently**: 4.3 takes constraints from the top-level `constraints` array
|
|
8
|
+
* alone, so a 4.0–4.2 file parses clean with none of them — measured across
|
|
9
|
+
* 1,302 shipped skeletons that loaded 0 of 8,672 constraints
|
|
10
|
+
* ([#706](https://github.com/firejune/rigc/issues/706) row 1). rigc is where
|
|
11
|
+
* that knowledge lives for the tools around it (#706 *Ownership*), and living
|
|
12
|
+
* in one place means one reader of `skeleton.spine`:
|
|
13
|
+
* `A16_SKELETON_VERSION_4_3` asks this function for its verdict, and `ingest`
|
|
14
|
+
* asks it before it reads a field of the file.
|
|
15
|
+
*
|
|
16
|
+
* ## What is here, and what is deliberately not
|
|
17
|
+
*
|
|
18
|
+
* This is #706's item **1**, and nothing else. Item **2** — the per-generation
|
|
19
|
+
* table of key renames, array shapes and `getValue(map, key, default)` defaults,
|
|
20
|
+
* extracted by machine from each runtime branch's `SkeletonJson` — is not here,
|
|
21
|
+
* and neither is item **4**'s conversion utility. So this module reads a string
|
|
22
|
+
* and names a generation. It does not read a file, apply another generation's
|
|
23
|
+
* defaults, or convert anything, and a caller that meets data from another
|
|
24
|
+
* generation has to say so out loud rather than read it anyway.
|
|
25
|
+
*
|
|
26
|
+
* ## The grammar, and the two rules in it
|
|
27
|
+
*
|
|
28
|
+
* A version string is `MAJOR.MINOR`, an optional chain of `-from-MAJOR.MINOR`,
|
|
29
|
+
* then an optional `.PATCH` and an optional `-SUFFIX` after that. The shipped
|
|
30
|
+
* strings #706 lists are `3.8.99`, `4.0.33`, `4.0-from-4.1.24`,
|
|
31
|
+
* `4.0-from-4.1-from-4.2.29`, `4.1-from-4.2.33`, `4.2.09-beta`, `4.2.43`,
|
|
32
|
+
* `4.3.26` and `4.3.75-beta`.
|
|
33
|
+
*
|
|
34
|
+
* 1. **The leading token is the generation.** `4.0-from-4.1.24` is 4.0 data
|
|
35
|
+
* written by a 4.1 editor — a *down-export* — and all 418 such-or-plain 4.0
|
|
36
|
+
* files and 101 4.1 files in #706's corpus load and render on the 4.0 / 4.1
|
|
37
|
+
* runtimes with 0 failures. Reading the trailing token would hand them the
|
|
38
|
+
* wrong runtime, which is row 7's defect with extra steps.
|
|
39
|
+
* 2. **Every token has to be a generation this module knows, and the chain has
|
|
40
|
+
* to ascend.** A down-export comes *from* a newer editor, so `4.0-from-4.1`
|
|
41
|
+
* is a down-export and `4.3-from-4.2` is not a version string this reader
|
|
42
|
+
* can account for. Both rules answer `null`, which is rule 3.
|
|
43
|
+
* 3. **Unknown is `null`, never the nearest.** A catalog builder gave 19
|
|
44
|
+
* skeletons labelled `3.8.99` the nearest runtime it had; they loaded, and
|
|
45
|
+
* posed 238 of 248 bones as NaN (#706 row 7). `null` is what a caller has to
|
|
46
|
+
* act on, and it is why this returns a union rather than a number to compare.
|
|
47
|
+
*
|
|
48
|
+
* ⭐ Rules 2 and 3 together are also what keeps `A16`'s accepted set **exactly**
|
|
49
|
+
* what its own regex accepted before this module existed: 4.3 is the highest
|
|
50
|
+
* generation here, nothing can ascend above it, so no `-from-` string is ever
|
|
51
|
+
* read as 4.3 and `A16` still accepts `4.3`, `4.3.<patch>` and
|
|
52
|
+
* `4.3.<patch>-<suffix>` and those alone. The cost is stated rather than hidden:
|
|
53
|
+
* a future editor down-exporting as `4.3-from-4.4.1` reads as `null` here and is
|
|
54
|
+
* refused by name until that generation is added — which is #706 policy 1's own
|
|
55
|
+
* answer ("an unknown generation gets no runtime") rather than a gap in this one.
|
|
56
|
+
*
|
|
57
|
+
* ## Purity
|
|
58
|
+
*
|
|
59
|
+
* No clock, no randomness, no filesystem, no network, no `spine-core`. It reads
|
|
60
|
+
* strings and small plain objects and nothing else.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/** A generation of Spine data — the `MAJOR.MINOR` pair a runtime is locked to. */
|
|
64
|
+
export type SpineGeneration = '3.8' | '4.0' | '4.1' | '4.2' | '4.3';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Every generation this module knows, oldest first.
|
|
68
|
+
*
|
|
69
|
+
* The order is load-bearing twice: a down-export chain has to ascend through it,
|
|
70
|
+
* and a caller listing "the generations rigc knows" reads it here rather than
|
|
71
|
+
* typing five strings next to a sixth.
|
|
72
|
+
*/
|
|
73
|
+
export const SPINE_GENERATIONS: readonly SpineGeneration[] = ['3.8', '4.0', '4.1', '4.2', '4.3'];
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* `MAJOR.MINOR`, then the `-from-` chain, then the patch and its suffix.
|
|
77
|
+
*
|
|
78
|
+
* Anchored at both ends on purpose: `4.30` and `4.3.1.2` are not version strings
|
|
79
|
+
* and a partial match would read them as 4.3. The suffix shape is the one the
|
|
80
|
+
* editor writes for a pre-release (`4.3.75-beta`, which every one of the twelve
|
|
81
|
+
* official example exports declares) and is the same one `A16`'s own regex
|
|
82
|
+
* carried, character for character, before this module took it over.
|
|
83
|
+
*/
|
|
84
|
+
const VERSION_STRING = /^(\d+\.\d+)((?:-from-\d+\.\d+)*)(?:\.\d+(?:-[0-9A-Za-z][0-9A-Za-z.+-]*)?)?$/;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The generation a `skeleton.spine` string names, or `null` for one this module
|
|
88
|
+
* cannot account for.
|
|
89
|
+
*
|
|
90
|
+
* `null` is never the nearest generation and never a guess — see rule 3 above.
|
|
91
|
+
*/
|
|
92
|
+
export function spineGeneration(version: string): SpineGeneration | null {
|
|
93
|
+
const match = VERSION_STRING.exec(version);
|
|
94
|
+
if (match === null) return null;
|
|
95
|
+
const chain = match[2] === '' ? [] : match[2].split('-from-').slice(1);
|
|
96
|
+
const known = SPINE_GENERATIONS as readonly string[];
|
|
97
|
+
const steps = [match[1], ...chain].map((token) => known.indexOf(token));
|
|
98
|
+
if (steps.some((at) => at < 0)) return null;
|
|
99
|
+
for (let i = 1; i < steps.length; i++) if (steps[i] <= steps[i - 1]) return null;
|
|
100
|
+
return SPINE_GENERATIONS[steps[0]];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The constraint kinds a skeleton can carry as a **top-level array**, which 4.3
|
|
105
|
+
* folded into one `constraints` array with a `type` on each entry.
|
|
106
|
+
*
|
|
107
|
+
* 4.3 reads `constraints` and nothing else, so an array under any of these names
|
|
108
|
+
* loads without an error and the constraints in it are simply not there — #706
|
|
109
|
+
* row 1, and what `A01_NO_LEGACY_TOPLEVEL_CONSTRAINT_ARRAYS` refuses in emitted
|
|
110
|
+
* data. `slider` never had a top-level form (sliders are 4.3's own), and it is
|
|
111
|
+
* on this list for the same reason as the other four: a constraint parked
|
|
112
|
+
* outside `constraints` vanishes whatever its kind, and a list with a hole in it
|
|
113
|
+
* is a rule with a hole in it.
|
|
114
|
+
*/
|
|
115
|
+
export const TOPLEVEL_CONSTRAINT_ARRAYS: readonly string[] = ['ik', 'transform', 'path', 'physics', 'slider'];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The bone key 4.0 and 4.1 spelled `transform`, renamed `inherit` in 4.2 and
|
|
119
|
+
* spelled that way by 4.3.
|
|
120
|
+
*
|
|
121
|
+
* The old key does not throw and does not warn — it is an unknown field, so the
|
|
122
|
+
* bone falls back to Normal inheritance (#706 row 6, and
|
|
123
|
+
* `A02_NO_BONE_TRANSFORM_KEY`).
|
|
124
|
+
*/
|
|
125
|
+
export const LEGACY_BONE_INHERIT_KEY = 'transform';
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* The physics-constraint fields whose **omitted default** is not the same number
|
|
129
|
+
* in 4.2 as in 4.3.
|
|
130
|
+
*
|
|
131
|
+
* JSON omits a field equal to the parser's default, so the same file means two
|
|
132
|
+
* different constraints under two readers: `inertia` and `damping` both default
|
|
133
|
+
* to 1 in 4.2's `SkeletonJson` and to 0.5 and 0.85 in 4.3's (#706 row 4, which
|
|
134
|
+
* also counts 111 shipped constraints omitting `inertia`). The numbers are not
|
|
135
|
+
* repeated here deliberately — a hand-copied table is what #706 policy 3 exists
|
|
136
|
+
* to refuse, and item 2's generated table is where they belong. What a caller
|
|
137
|
+
* needs from this list is which fields to *count*, and that is what it is.
|
|
138
|
+
*/
|
|
139
|
+
export const PHYSICS_FIELDS_WHOSE_DEFAULT_MOVED: readonly string[] = ['inertia', 'damping'];
|