spine-parts 2.19.3 → 2.20.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/docs/AUTHORING.md +131 -52
- package/package.json +2 -2
- package/src/boundarycolour.ts +3 -2
- package/src/check.ts +197 -31
- package/src/checkrow.ts +87 -2
- package/src/setuppainting.ts +3 -3
package/docs/AUTHORING.md
CHANGED
|
@@ -7120,6 +7120,40 @@ and `failed`; the bar counts once among the bars measured. Without the block,
|
|
|
7120
7120
|
or with `required: false`, nothing here is read and no exit code, line or byte
|
|
7121
7121
|
moves; the warnings and the body-root bar above are unchanged either way.
|
|
7122
7122
|
|
|
7123
|
+
**Open-cell evidence.** A failing pair gains `open_frames`, one row per animation
|
|
7124
|
+
and failing frame, with `animation`, `index`, `time`, `px`, `cell`, `box`,
|
|
7125
|
+
`classes` and `cells_index`. `classes` holds `figure`, `background` and `other`
|
|
7126
|
+
counts whose sum equals that frame's `gapOpen` px. A cell is `figure` when its
|
|
7127
|
+
`setupTop` slot resolves to a manifest part through its default-skin image,
|
|
7128
|
+
`background` when both setup names are null, and `other` when a nonnull top
|
|
7129
|
+
slot has no witnessed manifest mapping. The bar still holds every class to zero.
|
|
7130
|
+
|
|
7131
|
+
The `required.cells` reference supplies the relative `path` (`seam-cells.json`)
|
|
7132
|
+
and `sha256` of a sidecar beside `check.json`. Its `spec` is
|
|
7133
|
+
`rig-parts-seam-cells/1`; `frames` contains each failing pair-frame exactly once,
|
|
7134
|
+
in pair/animation/frame order. An inline `cells_index` selects its matching
|
|
7135
|
+
sidecar frame. Each sidecar frame retains `pair`, `animation`, `index`, `time`,
|
|
7136
|
+
`px`, `cell`, `box` and `cells`. Cells retain core's world-centre `x`, `y` (y up),
|
|
7137
|
+
`setupTop`, `setupUnder` and the derived `class`. The names describe setup art
|
|
7138
|
+
at that same world cell. Every frame and cell is a registered evidence row with
|
|
7139
|
+
`row_scope`, `row_kind`, `row_subjects`. Frames name the pair; cells name the
|
|
7140
|
+
resolved top part or carry rig scope with empty subjects.
|
|
7141
|
+
|
|
7142
|
+
Only the active render under the required declaration requests `--seam-cells`.
|
|
7143
|
+
Every nonempty `gapOpen` and `gapCovered` hit, including `worst`, must supply
|
|
7144
|
+
`cells.length === px`, finite centres and distinct setup names or null. Covered
|
|
7145
|
+
cells remain in core's raw sidecar. When open cells exist, publication writes
|
|
7146
|
+
the deterministic cell sidecar and its reference together; failure restores
|
|
7147
|
+
both previous files. Clean pairs keep their previous report shape, and a rerun
|
|
7148
|
+
without cell evidence removes a stale sidecar. Counts, tolerances and verdicts
|
|
7149
|
+
are unchanged.
|
|
7150
|
+
|
|
7151
|
+
`readMotionSeamCellSidecar` reads the digest-bound evidence and validates each
|
|
7152
|
+
inline partition and pair-frame reference. A missing file, SHA-256 mismatch,
|
|
7153
|
+
partition mismatch or malformed cell list is `FRAMES_SIDECAR`. The original
|
|
7154
|
+
counted arrays stay in the sidecar so the inline report size grows with failing
|
|
7155
|
+
frames rather than their cell populations.
|
|
7156
|
+
|
|
7123
7157
|
**What it does not read.** Frames are the 12 fps grid: an opening that lives
|
|
7124
7158
|
between two ticks is not seen, and neither is a pair nobody declared — those
|
|
7125
7159
|
are [`figure_openings`](#figure_openings)'s, which still warns. A frame on which
|
|
@@ -7999,12 +8033,37 @@ All six scope/kind combinations occur in the generated CLI fixture. Existing
|
|
|
7999
8033
|
top-level spec/version tag to advance; these fields are additive under its
|
|
8000
8034
|
existing contract. Removing only the three `row_` fields recovers legacy JSON.
|
|
8001
8035
|
|
|
8002
|
-
The
|
|
8003
|
-
|
|
8004
|
-
|
|
8036
|
+
The registered families declare their permitted JSON paths in `src/checkrow.ts`.
|
|
8037
|
+
A TypeScript type walk independently inventories object-array paths in
|
|
8038
|
+
`CheckFigures`, including intersections, the object keyword and alternate sets.
|
|
8039
|
+
New paths require a registered family even when no fixture emits them. Open legacy figure dictionaries
|
|
8040
|
+
have explicit exclusions below and are checked by the recursive output schema; a
|
|
8041
|
+
new unknown-typed field also fails the type inventory.
|
|
8042
|
+
The recursive row schema rejects an unregistered object-array path, missing
|
|
8043
|
+
labels, or a family used at another path. Every registered family and projection
|
|
8044
|
+
has an emitted schema fixture. Scalar arrays and tuples are excluded because
|
|
8045
|
+
they contain no object rows; aggregate records are excluded except for the named
|
|
8046
|
+
`requirements.lines` row dictionary. These exclusions do not exclude nested arrays.
|
|
8047
|
+
|
|
8048
|
+
Selftests preload the schema guard at the check serializer and forward it to
|
|
8049
|
+
Bun descendants, including build stage children. A swallowed schema error still
|
|
8050
|
+
fails the process. Consumer commands do not load this test hook, gain no new
|
|
8051
|
+
failure, and serialize the same fields. The family tag is a symbol: object spreads
|
|
8052
|
+
retain it and JSON does not write it. The omission and path-mismatch plants use
|
|
8053
|
+
the same schema as this guard.
|
|
8054
|
+
|
|
8055
|
+
The table is generated from the registry and recursively discovered producer
|
|
8056
|
+
calls by `bun tools/check_row_reference.ts --write`. Import aliases resolve by
|
|
8057
|
+
TypeScript symbol identity; wrapper forwarding is not the coverage mechanism.
|
|
8058
|
+
The tree suite holds the generated table to its sources. Subjects are explicit
|
|
8005
8059
|
in `row_subjects`; existing part/slot, front/back, a/b and parts fields remain
|
|
8006
8060
|
unchanged. `seam_scope.whole_pairs` copies the `seam_pairs` producer rows without
|
|
8007
|
-
the picture, and `sets.*` reuses the same seam producers.
|
|
8061
|
+
the picture, and `sets.*` reuses the same seam producers. A slot receives part
|
|
8062
|
+
scope only when its default-skin image mapping resolves one actual parts.json
|
|
8063
|
+
piece. A declared set image `<set>_<piece>.png` maps to that same piece;
|
|
8064
|
+
Unrelated mixed images, undeclared prefixes and omitted mappings receive rig scope.
|
|
8065
|
+
No slot-name fallback is used. Motion seam findings use the existing warning predicate on non-roots
|
|
8066
|
+
and the active-reading, banded failure predicate on roots.
|
|
8008
8067
|
|
|
8009
8068
|
Scalar/string arrays (animations, frame indices, bones, constraint names and
|
|
8010
8069
|
formatted chain/lag strings), numeric coordinate tuples, and aggregate blocks
|
|
@@ -8014,57 +8073,77 @@ no-reference-art totals) are fields of their parent reading, not independent
|
|
|
8014
8073
|
row collections; they retain their existing shape. Arrays inside these records
|
|
8015
8074
|
are still labelled (for example the level worst's `through` and posed joints).
|
|
8016
8075
|
Changed drawing identities have rig scope because generated slots need not name a part.
|
|
8076
|
+
A seam row with two `(no art)` entries has zero named subjects and rig scope;
|
|
8077
|
+
a singleton has part scope and two named contributors have pair scope. These
|
|
8078
|
+
raw rows remain evidence, including residuals outside all reference art.
|
|
8017
8079
|
Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
8018
8080
|
`lines` are the one dictionary of individual rows and are also labelled;
|
|
8019
8081
|
`sets` is a dictionary of whole check blocks.
|
|
8020
8082
|
|
|
8021
8083
|
<!-- check-row-table:begin -->
|
|
8022
|
-
| Row family | row_scope | row_kind | row_subjects (producer expression) | Producer |
|
|
8023
|
-
| --- | --- | --- | --- | --- |
|
|
8024
|
-
| `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` |
|
|
8025
|
-
| `ANIMATIONS_DO_NOT_FOLD.folding` |
|
|
8026
|
-
| `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
|
|
8027
|
-
| `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:
|
|
8028
|
-
| `BOUNDARY_COLOUR_STEP.unmeasured` |
|
|
8029
|
-
| `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:
|
|
8030
|
-
| `CUT_JOINT_MATERIAL.rows` | 'part' | finding when r.status === 'FAIL'; otherwise evidence | [r.part] | [cutmaterial.ts:280](../src/cutmaterial.ts#L280) |
|
|
8031
|
-
| `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:
|
|
8032
|
-
| `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:
|
|
8033
|
-
| `LIMB_ONE_BONE.parts` | 'part' | finding when fail; otherwise evidence | [p.name] | [check.ts:
|
|
8034
|
-
| `PART_SUPPORT_REPORT.pairs` | 'pair' | evidence; finding when length > 0; otherwise evidence | [F.name, B.name] | [coincide.ts:114](../src/coincide.ts#L114), [coincide.ts:130](../src/coincide.ts#L130) |
|
|
8035
|
-
| `PART_SUPPORT_REPORT.raw_pairs` | 'pair' | evidence | [F.name, B.name] | [coincide.ts:110](../src/coincide.ts#L110) |
|
|
8036
|
-
| `PART_SUPPORT_REPORT.unowned.regions` | 'rig' | finding | [] | [coincide.ts:145](../src/coincide.ts#L145) |
|
|
8037
|
-
| `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:
|
|
8038
|
-
| `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:
|
|
8039
|
-
| `SEAM_OVER_MOTION.
|
|
8040
|
-
| `SEAM_OVER_MOTION.
|
|
8041
|
-
| `SEAM_OVER_MOTION.rows
|
|
8042
|
-
| `SEAM_OVER_MOTION.rows[].
|
|
8043
|
-
| `SEAM_OVER_MOTION.rows[].
|
|
8044
|
-
| `SEAM_OVER_MOTION.
|
|
8045
|
-
| `
|
|
8046
|
-
| `SEAM_OVER_RANGE.joints
|
|
8047
|
-
| `
|
|
8048
|
-
| `SETUP_MATCHES_PAINTING.regions
|
|
8049
|
-
| `
|
|
8050
|
-
| `STILL_REGIONS_DARK.*.
|
|
8051
|
-
| `
|
|
8052
|
-
| `STRESS_OFF_CHAIN.
|
|
8053
|
-
| `STRESS_OFF_CHAIN.per_part
|
|
8054
|
-
| `STRESS_OFF_CHAIN.per_part[].
|
|
8055
|
-
| `
|
|
8056
|
-
| `
|
|
8057
|
-
| `
|
|
8058
|
-
| `WIND_BAND.pairs
|
|
8059
|
-
| `
|
|
8060
|
-
| `
|
|
8061
|
-
| `
|
|
8062
|
-
| `requirements.lines.* (
|
|
8063
|
-
| `requirements.lines.* (
|
|
8064
|
-
| `
|
|
8065
|
-
| `
|
|
8066
|
-
| `
|
|
8067
|
-
| `seam_scope.
|
|
8068
|
-
| `seam_scope.
|
|
8069
|
-
| `seam_scope.
|
|
8084
|
+
| Row family | Registered JSON paths | row_scope | row_kind | row_subjects (producer expression) | Producer |
|
|
8085
|
+
| --- | --- | --- | --- | --- | --- |
|
|
8086
|
+
| `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for e.slot; otherwise [] | [check.ts:3518](../src/check.ts#L3518) |
|
|
8087
|
+
| `ANIMATIONS_DO_NOT_FOLD.folding` | `ANIMATIONS_DO_NOT_FOLD.folding` | part when the supplied mapping resolves a piece; otherwise rig | finding when entry === undefined; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:3480](../src/check.ts#L3480) |
|
|
8088
|
+
| `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
|
|
8089
|
+
| `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
|
|
8090
|
+
| `BOUNDARY_COLOUR_STEP.unmeasured` | `BOUNDARY_COLOUR_STEP.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for r.slot; otherwise [] | [boundarycolour.ts:222](../src/boundarycolour.ts#L222) |
|
|
8091
|
+
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:5960](../src/check.ts#L5960) |
|
|
8092
|
+
| `CUT_JOINT_MATERIAL.rows` | `CUT_JOINT_MATERIAL.rows` | 'part' | finding when r.status === 'FAIL'; otherwise evidence | [r.part] | [cutmaterial.ts:280](../src/cutmaterial.ts#L280) |
|
|
8093
|
+
| `FEET_STAY_LEVEL.feet` | `FEET_STAY_LEVEL.feet` | 'part' | finding when row.status === 'FAIL'; otherwise evidence | [row.part] | [check.ts:3719](../src/check.ts#L3719) |
|
|
8094
|
+
| `FEET_STAY_LEVEL.feet[].worst.through` | `FEET_STAY_LEVEL.feet[].worst.through` | 'rig' | evidence | [] | [check.ts:3694](../src/check.ts#L3694) |
|
|
8095
|
+
| `LIMB_ONE_BONE.parts` | `LIMB_ONE_BONE.parts` | 'part' | finding when fail; otherwise evidence | [p.name] | [check.ts:4011](../src/check.ts#L4011) |
|
|
8096
|
+
| `PART_SUPPORT_REPORT.pairs` | `PART_SUPPORT_REPORT.pairs` | 'pair' | evidence; finding when length > 0; otherwise evidence | [F.name, B.name] | [coincide.ts:114](../src/coincide.ts#L114), [coincide.ts:130](../src/coincide.ts#L130) |
|
|
8097
|
+
| `PART_SUPPORT_REPORT.raw_pairs` | `PART_SUPPORT_REPORT.raw_pairs` | 'pair' | evidence | [F.name, B.name] | [coincide.ts:110](../src/coincide.ts#L110) |
|
|
8098
|
+
| `PART_SUPPORT_REPORT.unowned.regions` | `PART_SUPPORT_REPORT.unowned.regions` | 'rig' | finding | [] | [coincide.ts:145](../src/coincide.ts#L145) |
|
|
8099
|
+
| `SEAM_OVER_MOTION.pairs` | `SEAM_OVER_MOTION.pairs` | 'pair' | evidence | [p.a, p.b] | [check.ts:5357](../src/check.ts#L5357) |
|
|
8100
|
+
| `SEAM_OVER_MOTION.required.pairs` | `SEAM_OVER_MOTION.required.pairs` | 'pair' | finding when open > 0; otherwise evidence | [p.a, p.b] | [check.ts:4681](../src/check.ts#L4681) |
|
|
8101
|
+
| `SEAM_OVER_MOTION.required.pairs[].open_frames` | `SEAM_OVER_MOTION.required.pairs[].open_frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4673](../src/check.ts#L4673) |
|
|
8102
|
+
| `SEAM_OVER_MOTION.roots.unmeasured` | `SEAM_OVER_MOTION.roots.unmeasured` | 'part' | evidence | [root.part] | [check.ts:5334](../src/check.ts#L5334) |
|
|
8103
|
+
| `SEAM_OVER_MOTION.rows` | `SEAM_OVER_MOTION.rows` | 'pair'; unique ? 'pair' : 'rig' | finding when motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length); otherwise evidence; finding when motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length); otherwise evidence | [want.a, want.b]; unique ? [pair.a, pair.b] : [] | [check.ts:5291](../src/check.ts#L5291), [check.ts:5363](../src/check.ts#L5363) |
|
|
8104
|
+
| `SEAM_OVER_MOTION.rows[].cells` | `SEAM_OVER_MOTION.rows[].cells` | 'pair' | evidence | [want.a, want.b] | [check.ts:5304](../src/check.ts#L5304) |
|
|
8105
|
+
| `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | `SEAM_OVER_MOTION.rows[].joint_contact.reasons` | 'pair' | evidence | [want.a, want.b] | [check.ts:5294](../src/check.ts#L5294) |
|
|
8106
|
+
| `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | `SEAM_OVER_MOTION.rows[].pose_at_worst.joints` | 'rig' | evidence | [] | [motionseampose.ts:53](../src/motionseampose.ts#L53) |
|
|
8107
|
+
| `SEAM_OVER_MOTION.worlds.*.rows` | `SEAM_OVER_MOTION.worlds.*.rows` | 'pair' | evidence | [want.a, want.b] | [check.ts:5288](../src/check.ts#L5288) |
|
|
8108
|
+
| `SEAM_OVER_RANGE.joints` | `SEAM_OVER_RANGE.joints` | 'part' | evidence; finding when poses.some(p => p.status === 'FAIL'); otherwise evidence | [j.part] | [check.ts:4335](../src/check.ts#L4335), [check.ts:4381](../src/check.ts#L4381) |
|
|
8109
|
+
| `SEAM_OVER_RANGE.joints[].poses` | `SEAM_OVER_RANGE.joints[].poses` | 'part' | finding when fail; otherwise evidence | [j.part] | [check.ts:4379](../src/check.ts#L4379) |
|
|
8110
|
+
| `SETUP_MATCHES_PAINTING.regions` | `SETUP_MATCHES_PAINTING.regions` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [setuppainting.ts:174](../src/setuppainting.ts#L174) |
|
|
8111
|
+
| `SETUP_MATCHES_PAINTING.regions[].slots` | `SETUP_MATCHES_PAINTING.regions[].slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for slot; otherwise [] | [setuppainting.ts:175](../src/setuppainting.ts#L175) |
|
|
8112
|
+
| `STILL_REGIONS_DARK.*.crossing` | `STILL_REGIONS_DARK.*.crossing` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for sl.name; otherwise [] | [check.ts:8910](../src/check.ts#L8910) |
|
|
8113
|
+
| `STILL_REGIONS_DARK.*.still_slots` | `STILL_REGIONS_DARK.*.still_slots` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when r.max > tolerance; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:8896](../src/check.ts#L8896), [check.ts:8901](../src/check.ts#L8901) |
|
|
8114
|
+
| `STRESS_OFF_CHAIN.not_read` | `STRESS_OFF_CHAIN.not_read` | 'part' | evidence | [r.part] | [check.ts:3939](../src/check.ts#L3939) |
|
|
8115
|
+
| `STRESS_OFF_CHAIN.per_part` | `STRESS_OFF_CHAIN.per_part` | 'part' | finding when poses.some(p => typeof p.reading === 'number' && p.reading > STRESS_RIGID); otherwise evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8116
|
+
| `STRESS_OFF_CHAIN.per_part[].off_chain` | `STRESS_OFF_CHAIN.per_part[].off_chain` | 'part' | evidence | [r.part] | [check.ts:3927](../src/check.ts#L3927) |
|
|
8117
|
+
| `STRESS_OFF_CHAIN.per_part[].poses` | `STRESS_OFF_CHAIN.per_part[].poses` | 'part' | evidence; finding when shown > STRESS_RIGID; otherwise evidence | [r.part] | [check.ts:3895](../src/check.ts#L3895), [check.ts:3913](../src/check.ts#L3913) |
|
|
8118
|
+
| `TEXTURE_STRETCH.per_mesh` | `TEXTURE_STRETCH.per_mesh` | part when the supplied mapping resolves a piece; otherwise rig | evidence; finding when severity > TEXTURE_STRETCH_CEILING; otherwise evidence | resolved piece for m.slot; otherwise [] | [check.ts:9544](../src/check.ts#L9544), [check.ts:9554](../src/check.ts#L9554) |
|
|
8119
|
+
| `TIP_OVER_ROOT.parts` | `TIP_OVER_ROOT.parts` | 'part' | evidence; finding when !ok && !(!rigid && hanging.onLink && Math.max(c.root, c.tip) < TIP_TRAVEL_FLOOR); otherwise evidence | [p.name] | [check.ts:8325](../src/check.ts#L8325), [check.ts:8330](../src/check.ts#L8330), [check.ts:8351](../src/check.ts#L8351), [check.ts:8362](../src/check.ts#L8362) |
|
|
8120
|
+
| `WIND_BAND.pairs` | `WIND_BAND.pairs` | 'pair' | finding when !holdsAll; otherwise evidence | [p.a, p.b] | [check.ts:6464](../src/check.ts#L6464) |
|
|
8121
|
+
| `WIND_BAND.pairs[].steps` | `WIND_BAND.pairs[].steps` | 'pair' | finding when !s.holds; otherwise evidence | [p.a, p.b] | [check.ts:6475](../src/check.ts#L6475) |
|
|
8122
|
+
| `figure_openings.openings` | `figure_openings.openings` | 'pair' | finding | [ps.under, ps.above] | [check.ts:5781](../src/check.ts#L5781) |
|
|
8123
|
+
| `loop_physics` | `loop_physics` | 'rig' | evidence | [] | [check.ts:7445](../src/check.ts#L7445) |
|
|
8124
|
+
| `requirements.lines.* (bone)` | `requirements.lines.*` | 'rig' | finding when line.status === 'FAIL'; otherwise evidence | [] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8125
|
+
| `requirements.lines.* (seam)` | `requirements.lines.*` | 'pair' | finding when line.status === 'FAIL'; otherwise evidence | [r.part, r.neighbour] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8126
|
+
| `requirements.lines.* (stretch)` | `requirements.lines.*` | part when the supplied mapping resolves a piece; otherwise rig | finding when line.status === 'FAIL'; otherwise evidence | resolved piece for r.slot; otherwise [] | [check.ts:7744](../src/check.ts#L7744) |
|
|
8127
|
+
| `seam_cells.frames` | `frames` | 'pair' | evidence | [p.a, p.b] | [check.ts:4670](../src/check.ts#L4670) |
|
|
8128
|
+
| `seam_cells.frames[].cells` | `frames[].cells` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for cell.setupTop ?? ''; otherwise [] | [check.ts:4630](../src/check.ts#L4630) |
|
|
8129
|
+
| `seam_pairs` | `seam_pairs`; `seam_scope.whole_pairs`; `sets.*.seam_pairs`; `sets.*.seam_scope.whole_pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:2480](../src/check.ts#L2480) |
|
|
8130
|
+
| `seam_scope.changes` | `seam_scope.changes`; `sets.*.seam_scope.changes` | 'rig' | evidence | [] | [check.ts:1958](../src/check.ts#L1958) |
|
|
8131
|
+
| `seam_scope.domain.states` | `seam_scope.domain.states`; `sets.*.seam_scope.domain.states` | 'rig' | evidence | [] | [check.ts:2043](../src/check.ts#L2043) |
|
|
8132
|
+
| `seam_scope.pairs` | `seam_scope.pairs`; `sets.*.seam_scope.pairs` | subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair' | evidence | subjects | [check.ts:7355](../src/check.ts#L7355) |
|
|
8133
|
+
| `seam_scope.population.pairs` | `seam_scope.population.pairs`; `sets.*.seam_scope.population.pairs` | 'pair' | evidence | row.parts | [check.ts:2414](../src/check.ts#L2414) |
|
|
8134
|
+
| `seam_scope.population.single_art` | `seam_scope.population.single_art`; `sets.*.seam_scope.population.single_art` | 'part' | evidence | [row.part] | [check.ts:2415](../src/check.ts#L2415) |
|
|
8135
|
+
|
|
8136
|
+
| Open serialized type path | Reason for schema exclusion |
|
|
8137
|
+
| --- | --- |
|
|
8138
|
+
| `BLINK_NO_HOLE.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8139
|
+
| `BREATH_VISIBLE.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8140
|
+
| `CHAIN_LAG.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8141
|
+
| `RECOMPOSITE_HOLES.*` | Open reported figures; every emitted nested object row is schema checked. |
|
|
8142
|
+
| `SETUP_POSE_VS_SOURCE.*` | Open reported figures; every emitted nested object row is schema checked. |
|
|
8143
|
+
| `STILL_REGIONS_DARK.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8144
|
+
| `STRESS_OFF_CHAIN.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8145
|
+
| `TEXTURE_STRETCH.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8146
|
+
| `TIP_OVER_ROOT.*` | Open judgement figures; every emitted nested object row is schema checked. |
|
|
8147
|
+
| `requirements.lines.*.*` | Open requirement figures; the dictionary rows and nested object arrays are schema checked. |
|
|
8148
|
+
| `sets.*.RECOMPOSITE_HOLES.*` | Open alternate reported figures; every emitted nested object row is schema checked. |
|
|
8070
8149
|
<!-- check-row-table:end -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spine-parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.20.0",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"ag-psd": "^31.0.2",
|
|
71
|
-
"@rig-c/core": "3.
|
|
71
|
+
"@rig-c/core": "3.4.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@esotericsoftware/spine-core": "4.3.13",
|
package/src/boundarycolour.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkRow } from './checkrow.ts';
|
|
1
|
+
import { checkRow, checkSlotRow, checkSlotParts } from './checkrow.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Issue #942: the colour step across part boundaries, against the rig's own pieces.
|
|
4
4
|
*
|
|
@@ -116,6 +116,7 @@ export function measureBoundaryColour(api: Api, input: BoundaryColourInput, decl
|
|
|
116
116
|
const W = input.stage.width, H = input.stage.height;
|
|
117
117
|
const vp = { minX: input.stage.x, minY: input.stage.y, maxX: input.stage.x + W, maxY: input.stage.y + H, scale: 1, width: W, height: H };
|
|
118
118
|
const project = api.projector(vp);
|
|
119
|
+
const slotParts = checkSlotParts(input.rig, input.parts.parts.map(p => p.name), input.parts.alternates?.map(set => set.name) ?? []);
|
|
119
120
|
const records = new Map(input.parts.parts.map((p) => [p.name, p]));
|
|
120
121
|
const sources = new Map<string, Source | string>();
|
|
121
122
|
const unmeasured: BoundaryColourUnmeasured[] = [];
|
|
@@ -218,7 +219,7 @@ export function measureBoundaryColour(api: Api, input: BoundaryColourInput, decl
|
|
|
218
219
|
boundary_pairs: boundaryPairs,
|
|
219
220
|
worst,
|
|
220
221
|
over: over.map(r => ({ ...r, ...checkRow('BOUNDARY_COLOUR_STEP.over', 'pair', true, r.parts) })),
|
|
221
|
-
unmeasured: unmeasured.map(r => ({ ...r, ...
|
|
222
|
+
unmeasured: unmeasured.map(r => ({ ...r, ...checkSlotRow('BOUNDARY_COLOUR_STEP.unmeasured', false, r.slot, slotParts) })),
|
|
222
223
|
alternates: 'not measured',
|
|
223
224
|
};
|
|
224
225
|
}
|
package/src/check.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkRow } from './checkrow.ts';
|
|
1
|
+
import { checkRow, checkSlotRow, checkSlotParts, serializeCheckRows } from './checkrow.ts';
|
|
2
2
|
import { readSetupFigureMask } from './setupfiguremask.ts';
|
|
3
3
|
import { readSetupBackdrop } from './setupbackdrop.ts';
|
|
4
4
|
import { COINCIDE_LINE, type SupportReport } from './coincide.ts';
|
|
@@ -1986,7 +1986,7 @@ export function officialRenderer(): OfficialRenderer {
|
|
|
1986
1986
|
|
|
1987
1987
|
/** Observe the actual setup on the declared stage grid. No frame-zero motion,
|
|
1988
1988
|
* fitted alignment, flat recomposite or duplicate core validation. */
|
|
1989
|
-
export function measureSetupPainting(build: string, stage: StageBox, source: Raster, declared: SetupPainting, problems: Problem[], backdrop?: Raster, figureMask?: Uint8Array): SetupPaintingLine {
|
|
1989
|
+
export function measureSetupPainting(build: string, stage: StageBox, source: Raster, declared: SetupPainting, problems: Problem[], backdrop?: Raster, figureMask?: Uint8Array, slotParts?: ReadonlyMap<string, string>): SetupPaintingLine {
|
|
1990
1990
|
const api = officialRenderer();
|
|
1991
1991
|
const skeleton = join(build, 'skeleton.json'), atlas = join(build, 'skeleton.atlas');
|
|
1992
1992
|
const candidate = api.loadCandidate({ skeletonText: readFileSync(skeleton, 'utf8'), atlasText: readFileSync(atlas, 'utf8'), atlasDir: build, label: 'setup versus painting' }, { skeleton, atlas }, undefined);
|
|
@@ -2010,7 +2010,7 @@ export function measureSetupPainting(build: string, stage: StageBox, source: Ras
|
|
|
2010
2010
|
}
|
|
2011
2011
|
const painting = sourceInRig(whiteSource, W, H);
|
|
2012
2012
|
const setup = api.renderFrame(pose, candidate.pages, vp, [0, 0, 0, 0]);
|
|
2013
|
-
return setupPaintingLine(declared, painting, { width: W, height: H, data: new Uint8ClampedArray(setup.data) }, figureSilhouette(painting).data, owners, pose.pieces.map(p => p.slot), problems, backdrop === undefined ? undefined : sourceInRig(backdrop, W, H), figureMask);
|
|
2013
|
+
return setupPaintingLine(declared, painting, { width: W, height: H, data: new Uint8ClampedArray(setup.data) }, figureSilhouette(painting).data, owners, pose.pieces.map(p => p.slot), problems, backdrop === undefined ? undefined : sourceInRig(backdrop, W, H), figureMask, slotParts);
|
|
2014
2014
|
}
|
|
2015
2015
|
|
|
2016
2016
|
/** One decoder/poser lifetime per state; retain only finite bounds and identities, never atlas pages or rasters. */
|
|
@@ -2475,8 +2475,9 @@ function seamPairRowsFrom(seam: SeamFigures, parts: readonly PlacedAlpha[], rigS
|
|
|
2475
2475
|
// A part over no other art is named first, then SEAM_NO_ART.
|
|
2476
2476
|
const pair: [string, string] = acc.a < 0 ? [name(acc.b), SEAM_NO_ART] : [name(acc.a), name(acc.b)];
|
|
2477
2477
|
const file = `${String(i + 1).padStart(Math.max(2, width), '0')}_${pair.map((n) => (n === SEAM_NO_ART ? 'no-art' : n)).join('_')}.png`;
|
|
2478
|
+
const subjects = pair.filter(p => p !== SEAM_NO_ART);
|
|
2478
2479
|
const cut = acc.a >= 0 && parts[acc.a].from === parts[acc.b].from ? { cut: { from: parts[acc.a].from, differing_copies_px: acc.differing } } : {};
|
|
2479
|
-
return { row: { ...checkRow('seam_pairs',
|
|
2480
|
+
return { row: { ...checkRow('seam_pairs', subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair', false, subjects), parts: pair, px_over_40: acc.over40,
|
|
2480
2481
|
...(acc.outside > 0 ? { outside_authored_px: acc.outside } : {}), px_over_80: acc.over80, frame_box: acc.f, rig_box: acc.r, ...cut, picture: `${SEAM_DIR}/${file}` }, pixels: acc.pixels };
|
|
2481
2482
|
});
|
|
2482
2483
|
}
|
|
@@ -3449,6 +3450,7 @@ export function foldsLine(
|
|
|
3449
3450
|
physicsList: readonly LoopPhysics[] = [],
|
|
3450
3451
|
motion: Record<string, unknown> = {},
|
|
3451
3452
|
context?: WeightStepContext,
|
|
3453
|
+
slotParts?: ReadonlyMap<string, string>,
|
|
3452
3454
|
): FoldsLine {
|
|
3453
3455
|
const toSide = (m: FoldingMesh | undefined): FoldSide | null =>
|
|
3454
3456
|
m === undefined ? null : { frames: m.frames, worst_frame: m.worstFrame, worst_triangles: m.worstTriangles, line: m.line };
|
|
@@ -3475,7 +3477,7 @@ export function foldsLine(
|
|
|
3475
3477
|
const onlyPhysicsOn = on !== undefined && off === undefined;
|
|
3476
3478
|
const constraints = onlyPhysicsOn ? meshPhysicsConstraints(rig, slot, attachment, physicsList) : [];
|
|
3477
3479
|
const row: FoldRow = {
|
|
3478
|
-
...
|
|
3480
|
+
...checkSlotRow('ANIMATIONS_DO_NOT_FOLD.folding', entry === undefined, slot, slotParts),
|
|
3479
3481
|
animation: name,
|
|
3480
3482
|
slot,
|
|
3481
3483
|
attachment,
|
|
@@ -3513,7 +3515,7 @@ export function foldsLine(
|
|
|
3513
3515
|
detail: `rigc render --folds at ${fps} fps${physics}${sideClause}: ${r.line}; ${foldBonesText(rig, motion, r.slot, r.attachment, r.worst_frame, worstOf.get(r) ?? [], context)}; no triangle turned over against the setup pose is required — a fold the art means is declared in the --requirements file's may_fold, { "slot": "${r.slot}", "animation": "${r.animation}", "why": … }`,
|
|
3514
3516
|
});
|
|
3515
3517
|
}
|
|
3516
|
-
const declaredNotFolding = mayFold.filter((e) => !folding.some((r) => r.slot === e.slot && r.animation === e.animation)).map((e) => ({ ...
|
|
3518
|
+
const declaredNotFolding = mayFold.filter((e) => !folding.some((r) => r.slot === e.slot && r.animation === e.animation)).map((e) => ({ ...checkSlotRow('ANIMATIONS_DO_NOT_FOLD.declared_not_folding', true, e.slot, slotParts), slot: e.slot, animation: e.animation }));
|
|
3517
3519
|
for (const e of declaredNotFolding) {
|
|
3518
3520
|
problems.push({
|
|
3519
3521
|
code: `CHECK_${FOLD_LINE}`,
|
|
@@ -4505,7 +4507,36 @@ export interface MotionBackgroundRow {
|
|
|
4505
4507
|
drawn: number;
|
|
4506
4508
|
banded: number;
|
|
4507
4509
|
/** rigc's `gapOpen` hits with a cell: background inside the carried setup-overlap band, alpha 0 in the whole skeleton composite. */
|
|
4508
|
-
hits: Array<MotionSeamHit & { time: number }>;
|
|
4510
|
+
hits: Array<MotionSeamHit & { time: number; cells?: MotionOpenCell[] }>;
|
|
4511
|
+
}
|
|
4512
|
+
|
|
4513
|
+
/** Setup slot names are retained verbatim; classification uses the manifest's witnessed slot mapping. */
|
|
4514
|
+
export interface MotionOpenCell {
|
|
4515
|
+
x: number;
|
|
4516
|
+
y: number;
|
|
4517
|
+
setupTop: string | null;
|
|
4518
|
+
setupUnder: string | null;
|
|
4519
|
+
class: 'figure' | 'background' | 'other';
|
|
4520
|
+
}
|
|
4521
|
+
|
|
4522
|
+
export interface MotionOpenFrame extends MotionSeamHit {
|
|
4523
|
+
animation: string;
|
|
4524
|
+
time: number;
|
|
4525
|
+
classes: { figure: number; background: number; other: number };
|
|
4526
|
+
cells_index: number;
|
|
4527
|
+
}
|
|
4528
|
+
|
|
4529
|
+
export interface MotionCellFrame extends MotionSeamHit {
|
|
4530
|
+
pair: string;
|
|
4531
|
+
animation: string;
|
|
4532
|
+
time: number;
|
|
4533
|
+
cells: MotionOpenCell[];
|
|
4534
|
+
}
|
|
4535
|
+
|
|
4536
|
+
export const MOTION_CELLS_FILE = 'seam-cells.json';
|
|
4537
|
+
export interface MotionCellSidecar {
|
|
4538
|
+
spec: 'rig-parts-seam-cells/1';
|
|
4539
|
+
frames: MotionCellFrame[];
|
|
4509
4540
|
}
|
|
4510
4541
|
|
|
4511
4542
|
/** Issue #941: `SEAM_OVER_MOTION`'s `required` block. The bar is 0 background cells on every frame read; it never SKIPs. */
|
|
@@ -4514,9 +4545,10 @@ export interface MotionSeamRequired {
|
|
|
4514
4545
|
mode: 'gap-open';
|
|
4515
4546
|
bar_px: 0;
|
|
4516
4547
|
/** Every declared pair, its class, and the frames read over every animation. */
|
|
4517
|
-
pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number }>;
|
|
4548
|
+
pairs: Array<{ pair: string; class: MotionSeamClass; frames: number; background_frames: number; max_px: number; open_frames?: MotionOpenFrame[] }>;
|
|
4518
4549
|
/** How many refusals the bar added. */
|
|
4519
4550
|
failed: number;
|
|
4551
|
+
cells?: { path: string; sha256: string };
|
|
4520
4552
|
}
|
|
4521
4553
|
|
|
4522
4554
|
/** A declared pair's class: a proven root first, then a limb joint, otherwise its explicit declaration. */
|
|
@@ -4531,7 +4563,7 @@ export function motionSeamClass(p: MotionSeamPair): MotionSeamClass {
|
|
|
4531
4563
|
* the rate asked (stride 1, written = sampled), a file that is not the animation's or the rate's, a pair out of the
|
|
4532
4564
|
* flag's order, and a `gapOpen` of the wrong shape — unavailable is never a measured zero.
|
|
4533
4565
|
*/
|
|
4534
|
-
export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[]): MotionBackgroundRow[] {
|
|
4566
|
+
export function readMotionSeamBackground(dir: string, animations: readonly string[], fps: number, pairs: readonly MotionSeamPair[], cellSlots?: ReadonlyMap<string, string>): MotionBackgroundRow[] {
|
|
4535
4567
|
const problems: Problem[] = [];
|
|
4536
4568
|
const bad = (object: string, detail: string): void => { problems.push({ code: 'FRAMES_SIDECAR', object, detail }); };
|
|
4537
4569
|
const sidecar = readJson(join(dir, 'frames.json'), problems);
|
|
@@ -4556,10 +4588,19 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4556
4588
|
if (!isRecord(p) || p.a !== want.a || p.b !== want.b) { bad(at, `is ${JSON.stringify(isRecord(p) ? `${String(p.a)}|${String(p.b)}` : p)}; "${want.pair}", the flag's entry ${i}, is required`); return; }
|
|
4557
4589
|
const open = p.gapOpen;
|
|
4558
4590
|
const frames = isRecord(open) && Array.isArray(open.frames) ? open.frames : null;
|
|
4591
|
+
if (cellSlots !== undefined) {
|
|
4592
|
+
for (const kind of ['gapOpen', 'gapCovered'] as const) {
|
|
4593
|
+
const reading = p[kind];
|
|
4594
|
+
if (!isRecord(reading) || !Array.isArray(reading.frames)) { bad(`${at} ${kind}`, 'requires frames when --seam-cells was requested'); continue; }
|
|
4595
|
+
if (kind === 'gapCovered') for (const [index, hit] of reading.frames.entries()) readMotionOpenCells(hit, `${at} ${kind}.frames[${index}]`, cellSlots, bad);
|
|
4596
|
+
if (reading.worst !== null) readMotionOpenCells(reading.worst, `${at} ${kind}.worst`, cellSlots, bad);
|
|
4597
|
+
}
|
|
4598
|
+
}
|
|
4559
4599
|
const hits = frames === null ? [] : frames.flatMap((h) => isRecord(h) && Number.isSafeInteger(h.index) && typeof h.index === 'number' && h.index >= 0 && h.index < (set.sampled as number) &&
|
|
4560
4600
|
Number.isSafeInteger(h.px) && typeof h.px === 'number' && h.px > 0 && typeof h.cell === 'number' && h.cell > 0 && typeof h.time === 'number' && Number.isFinite(h.time) &&
|
|
4561
4601
|
Array.isArray(h.box) && h.box.length === 4 && h.box.every((v) => typeof v === 'number' && Number.isFinite(v))
|
|
4562
|
-
? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number]
|
|
4602
|
+
? [{ index: h.index, px: h.px, cell: h.cell, time: h.time, box: [h.box[0], h.box[1], h.box[2], h.box[3]] as [number, number, number, number],
|
|
4603
|
+
...(cellSlots === undefined ? {} : { cells: readMotionOpenCells(h, `${at} gapOpen frame ${h.index}`, cellSlots, bad) }) }] : []);
|
|
4563
4604
|
if ((p.status !== 'read' && p.status !== 'skip') || typeof p.drawn !== 'number' || typeof p.banded !== 'number' || frames === null || hits.length !== frames.length || new Set(hits.map((h) => h.index)).size !== hits.length) {
|
|
4564
4605
|
bad(`${at} gapOpen`, 'requires { frames: [{ index, time, px > 0, cell, box }…] } on every pair, one hit per frame, as rigc-seam/1 writes it from rig-c 2.69.0 — unavailable is not zero background');
|
|
4565
4606
|
return;
|
|
@@ -4571,6 +4612,27 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4571
4612
|
return rows;
|
|
4572
4613
|
}
|
|
4573
4614
|
|
|
4615
|
+
/** Unavailable cell evidence is refused before any report is emitted. */
|
|
4616
|
+
function readMotionOpenCells(hit: unknown, at: string, slots: ReadonlyMap<string, string>, bad: (object: string, detail: string) => void): MotionOpenCell[] {
|
|
4617
|
+
if (!isRecord(hit) || !Number.isSafeInteger(hit.px) || typeof hit.px !== 'number' || hit.px <= 0 || !Array.isArray(hit.cells) || hit.cells.length !== hit.px) {
|
|
4618
|
+
bad(at, 'requires cells.length === px > 0 when --seam-cells was requested; unavailable is not zero');
|
|
4619
|
+
return [];
|
|
4620
|
+
}
|
|
4621
|
+
const cells: MotionOpenCell[] = [];
|
|
4622
|
+
for (const [index, cell] of hit.cells.entries()) {
|
|
4623
|
+
if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
|
|
4624
|
+
!(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
|
|
4625
|
+
!(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
|
|
4626
|
+
cell.setupTop === null && cell.setupUnder !== null || cell.setupTop !== null && cell.setupTop === cell.setupUnder) {
|
|
4627
|
+
bad(`${at}.cells[${index}]`, `requires finite world-centre x/y and distinct setup slot names or null (a null top requires null under); found ${JSON.stringify(cell)}`);
|
|
4628
|
+
continue;
|
|
4629
|
+
}
|
|
4630
|
+
cells.push({ ...checkSlotRow('seam_cells.frames[].cells', false, cell.setupTop ?? '', slots),
|
|
4631
|
+
x: cell.x, y: cell.y, setupTop: cell.setupTop, setupUnder: cell.setupUnder, class: cell.setupTop === null ? 'background' : slots.has(cell.setupTop) ? 'figure' : 'other' });
|
|
4632
|
+
}
|
|
4633
|
+
return cells;
|
|
4634
|
+
}
|
|
4635
|
+
|
|
4574
4636
|
/**
|
|
4575
4637
|
* Issue #941: the bar `seam_over_motion.required: true` declares — 0 background cells (rigc's `gapOpen`: gap cells
|
|
4576
4638
|
* inside the carried setup-overlap band where the whole skeleton composite has alpha 0) on every frame of every
|
|
@@ -4578,7 +4640,7 @@ export function readMotionSeamBackground(dir: string, animations: readonly strin
|
|
|
4578
4640
|
* that measured nothing is refused too, since a SKIP is never a pass. Problems are pushed, one per pair and
|
|
4579
4641
|
* animation (with its worst frame) and one per pair or line not measured; the block is returned.
|
|
4580
4642
|
*/
|
|
4581
|
-
export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[]): MotionSeamRequired {
|
|
4643
|
+
export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBackgroundRow[], requirements: string, problems: Problem[], cellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] }): MotionSeamRequired {
|
|
4582
4644
|
const before = problems.length;
|
|
4583
4645
|
const why = `${requirements} declares seam_over_motion.required: true, so 0 background px is required on every frame of every declared seam pair`;
|
|
4584
4646
|
const refuse = (object: string, detail: string): void => { problems.push({ code: MOTION_SEAM_REQUIRED_CODE, object, detail }); };
|
|
@@ -4592,6 +4654,7 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
|
|
|
4592
4654
|
let frames = 0;
|
|
4593
4655
|
let open = 0;
|
|
4594
4656
|
let max = 0;
|
|
4657
|
+
const openFrames: MotionOpenFrame[] = [];
|
|
4595
4658
|
if (p.unread !== undefined) refuse(label, `is not read — ${p.unread}; ${why}`);
|
|
4596
4659
|
else for (const animation of line.animations) {
|
|
4597
4660
|
const r = rows.find((x) => x.pair === p.pair && x.animation === animation);
|
|
@@ -4602,15 +4665,102 @@ export function motionSeamRequired(line: MotionSeamLine, rows: readonly MotionBa
|
|
|
4602
4665
|
frames += r.frames;
|
|
4603
4666
|
open += r.hits.length;
|
|
4604
4667
|
if (r.hits.length === 0) continue;
|
|
4668
|
+
for (const hit of r.hits) if (hit.cells !== undefined) {
|
|
4669
|
+
const cellsIndex = cellEvidence.frames.length;
|
|
4670
|
+
cellEvidence.frames.push({ ...checkRow('seam_cells.frames', 'pair', false, [p.a, p.b]), pair: p.pair,
|
|
4671
|
+
animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, cells: hit.cells });
|
|
4672
|
+
const classes = motionCellClasses(hit.cells);
|
|
4673
|
+
openFrames.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs[].open_frames', 'pair', false, [p.a, p.b]),
|
|
4674
|
+
animation, index: hit.index, time: hit.time, px: hit.px, cell: hit.cell, box: hit.box, classes, cells_index: cellsIndex });
|
|
4675
|
+
}
|
|
4605
4676
|
const worst = r.hits.reduce((b, h) => (h.px > b.px || (h.px === b.px && h.index < b.index) ? h : b));
|
|
4606
4677
|
max = Math.max(max, worst.px);
|
|
4607
4678
|
refuse(`${label} in "${animation}" at frame ${worst.index} (t = ${worst.time}s)`,
|
|
4608
4679
|
`background on ${r.hits.length} of ${r.frames} frame(s) read ${frameRuns(r.hits.map((h) => h.index))}: found ${worst.px} px (rigc gapOpen cells of ${worst.cell} world units, world box [${worst.box.join(', ')}]) on the worst frame, 0 required; ${why}`);
|
|
4609
4680
|
}
|
|
4610
|
-
out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max
|
|
4681
|
+
out.push({ ...checkRow('SEAM_OVER_MOTION.required.pairs', 'pair', open > 0, [p.a, p.b]), pair: p.pair, class: cls, frames, background_frames: open, max_px: max,
|
|
4682
|
+
...(openFrames.length === 0 ? {} : { open_frames: openFrames }) });
|
|
4611
4683
|
}
|
|
4612
4684
|
const failed = problems.length - before;
|
|
4613
|
-
return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed
|
|
4685
|
+
return { status: failed === 0 ? 'PASS' : 'FAIL', mode: 'gap-open', bar_px: 0, pairs: out, failed,
|
|
4686
|
+
...(cellEvidence.frames.length === 0 ? {} : { cells: { path: MOTION_CELLS_FILE, sha256: createHash('sha256').update(serializeCheckRows(cellEvidence)).digest('hex') } }) };
|
|
4687
|
+
}
|
|
4688
|
+
|
|
4689
|
+
/** The inline partition counts the same cells as the sidecar, including unresolved setup slots. */
|
|
4690
|
+
function motionCellClasses(cells: readonly MotionOpenCell[]): MotionOpenFrame['classes'] {
|
|
4691
|
+
const counts = { figure: 0, background: 0, other: 0 };
|
|
4692
|
+
for (const cell of cells) counts[cell.class]++;
|
|
4693
|
+
return counts;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
/** Refuse broken evidence links and partitions rather than silently consuming partial evidence. */
|
|
4697
|
+
export function readMotionSeamCellSidecar(dir: string, required: MotionSeamRequired): MotionCellSidecar | null {
|
|
4698
|
+
if (required.cells === undefined) return null;
|
|
4699
|
+
const bad = (object: string, detail: string): never => {
|
|
4700
|
+
refuseIfAny([{ code: 'FRAMES_SIDECAR', object, detail }]);
|
|
4701
|
+
throw new Error('unreachable');
|
|
4702
|
+
};
|
|
4703
|
+
const reference = required.cells;
|
|
4704
|
+
if (reference.path !== MOTION_CELLS_FILE || !/^[a-f0-9]{64}$/.test(reference.sha256)) bad('SEAM_OVER_MOTION.required.cells', 'requires relative seam-cells.json path and a SHA-256 digest');
|
|
4705
|
+
const path = join(dir, reference.path);
|
|
4706
|
+
let bytes: Buffer;
|
|
4707
|
+
try { bytes = readFileSync(path); }
|
|
4708
|
+
catch { return bad(path, 'referenced cell sidecar is missing or unreadable; unavailable is not zero'); }
|
|
4709
|
+
const digest = createHash('sha256').update(bytes).digest('hex');
|
|
4710
|
+
if (digest !== reference.sha256) bad(path, `SHA-256 is ${digest}; required ${reference.sha256}`);
|
|
4711
|
+
let value: unknown;
|
|
4712
|
+
try { value = JSON.parse(bytes.toString('utf8')) as unknown; }
|
|
4713
|
+
catch { return bad(path, 'requires a JSON rig-parts-seam-cells/1 document'); }
|
|
4714
|
+
if (!isRecord(value) || value.spec !== 'rig-parts-seam-cells/1' || !Array.isArray(value.frames)) return bad(path, 'requires rig-parts-seam-cells/1 frames');
|
|
4715
|
+
const seen = new Set<number>();
|
|
4716
|
+
for (const pair of required.pairs) for (const frame of pair.open_frames ?? []) {
|
|
4717
|
+
const at = `${path} frames[${frame.cells_index}]`;
|
|
4718
|
+
const read: unknown = value.frames[frame.cells_index];
|
|
4719
|
+
if (!Number.isSafeInteger(frame.cells_index) || frame.cells_index < 0 || seen.has(frame.cells_index) || !isRecord(read) ||
|
|
4720
|
+
read.pair !== pair.pair || read.animation !== frame.animation || read.index !== frame.index || read.time !== frame.time || read.px !== frame.px || read.cell !== frame.cell ||
|
|
4721
|
+
JSON.stringify(read.box) !== JSON.stringify(frame.box) || !Array.isArray(read.cells) || read.cells.length !== frame.px) {
|
|
4722
|
+
bad(at, 'requires one matching pair-frame with cells.length === gapOpen px; unavailable is not zero');
|
|
4723
|
+
continue;
|
|
4724
|
+
}
|
|
4725
|
+
seen.add(frame.cells_index);
|
|
4726
|
+
const classes = { figure: 0, background: 0, other: 0 };
|
|
4727
|
+
for (const cell of read.cells) {
|
|
4728
|
+
if (!isRecord(cell) || typeof cell.x !== 'number' || !Number.isFinite(cell.x) || typeof cell.y !== 'number' || !Number.isFinite(cell.y) ||
|
|
4729
|
+
!(cell.setupTop === null || typeof cell.setupTop === 'string' && cell.setupTop.length > 0) ||
|
|
4730
|
+
!(cell.setupUnder === null || typeof cell.setupUnder === 'string' && cell.setupUnder.length > 0) ||
|
|
4731
|
+
!['figure', 'background', 'other'].includes(String(cell.class))) bad(at, 'requires finite world centres, setup names and figure/background/other classes');
|
|
4732
|
+
else classes[cell.class as MotionOpenCell['class']]++;
|
|
4733
|
+
}
|
|
4734
|
+
if (!frame.classes || !Object.values(frame.classes).every(n => Number.isSafeInteger(n) && n >= 0) ||
|
|
4735
|
+
frame.classes.figure + frame.classes.background + frame.classes.other !== frame.px ||
|
|
4736
|
+
frame.classes.figure !== classes.figure || frame.classes.background !== classes.background || frame.classes.other !== classes.other) {
|
|
4737
|
+
bad(at, `inline figure/background/other counts ${JSON.stringify(frame.classes)} must sum to gapOpen px ${frame.px} and match sidecar ${JSON.stringify(classes)}`);
|
|
4738
|
+
}
|
|
4739
|
+
}
|
|
4740
|
+
if (seen.size !== value.frames.length) bad(path, `has ${value.frames.length} frame(s); inline rows reference ${seen.size} distinct frame(s)`);
|
|
4741
|
+
// Every cell and its pair/frame identity was checked above after the digest matched.
|
|
4742
|
+
return value as unknown as MotionCellSidecar;
|
|
4743
|
+
}
|
|
4744
|
+
|
|
4745
|
+
/** Publish check.json and its cell evidence together, restoring previous bytes on refusal. */
|
|
4746
|
+
export function publishMotionSeamCells(dir: string, required: MotionSeamRequired | undefined, evidence: MotionCellSidecar, publish: () => void): void {
|
|
4747
|
+
const path = join(dir, MOTION_CELLS_FILE), check = join(dir, 'check.json');
|
|
4748
|
+
const previous = existsSync(path) ? readFileSync(path) : null;
|
|
4749
|
+
const previousCheck = existsSync(check) ? readFileSync(check) : null;
|
|
4750
|
+
try {
|
|
4751
|
+
if (required?.cells !== undefined) {
|
|
4752
|
+
writeFileSync(path, serializeCheckRows(evidence));
|
|
4753
|
+
readMotionSeamCellSidecar(dir, required);
|
|
4754
|
+
}
|
|
4755
|
+
publish();
|
|
4756
|
+
if (required?.cells === undefined) rmSync(path, { force: true });
|
|
4757
|
+
} catch (error) {
|
|
4758
|
+
if (previous === null) rmSync(path, { force: true });
|
|
4759
|
+
else writeFileSync(path, previous);
|
|
4760
|
+
if (previousCheck === null) rmSync(check, { force: true });
|
|
4761
|
+
else writeFileSync(check, previousCheck);
|
|
4762
|
+
throw error;
|
|
4763
|
+
}
|
|
4614
4764
|
}
|
|
4615
4765
|
|
|
4616
4766
|
/** Issue #941: the console line for the required block. */
|
|
@@ -5138,7 +5288,7 @@ function readSeamRows(dir: string, animations: readonly string[], fps: number, p
|
|
|
5138
5288
|
worldRows?.push({ ...checkRow('SEAM_OVER_MOTION.worlds.*.rows', 'pair', false, [want.a, want.b]), pair: want.pair, animation, status: p.status, drawn: p.drawn, banded: p.banded, gap: kinds.gap, ghost: kinds.ghost });
|
|
5139
5289
|
const opens = [...over.keys()].sort((x, y) => x - y);
|
|
5140
5290
|
rows.push({
|
|
5141
|
-
...checkRow('SEAM_OVER_MOTION.rows', 'pair', p.status
|
|
5291
|
+
...checkRow('SEAM_OVER_MOTION.rows', 'pair', motionSeamFinding(want.root !== undefined, p.status, p.banded, opens.length), [want.a, want.b]),
|
|
5142
5292
|
pair: want.pair,
|
|
5143
5293
|
animation,
|
|
5144
5294
|
...(setup ? {} : { joint_contact: contact === undefined ? undefined : { ...contact, reasons: contact.reasons.map(r => ({ ...r, ...checkRow('SEAM_OVER_MOTION.rows[].joint_contact.reasons', 'pair', false, [want.a, want.b]) })) } }),
|
|
@@ -5159,6 +5309,11 @@ function readSeamRows(dir: string, animations: readonly string[], fps: number, p
|
|
|
5159
5309
|
return rows;
|
|
5160
5310
|
}
|
|
5161
5311
|
|
|
5312
|
+
/** Share the existing non-root warning and active root failure predicates. */
|
|
5313
|
+
export function motionSeamFinding(root: boolean, status: string, banded: number, opens: number): boolean {
|
|
5314
|
+
return opens > 0 && (!root || (status === 'read' && banded > 0));
|
|
5315
|
+
}
|
|
5316
|
+
|
|
5162
5317
|
/** Only active proven roots gate gapOpen plus UNDER-owned ghost; existing warnings/floor are unchanged. */
|
|
5163
5318
|
export function motionSeamLine(pairs: MotionSeamPair[], animations: string[], fps: number, rows: MotionSeamRow[], reason?: string, problems: Problem[] = [], unmeasuredRoots: readonly MotionUnmeasuredRoot[] = []): MotionSeamLine {
|
|
5164
5319
|
const roots = pairs.filter(p => p.root !== undefined);
|
|
@@ -5202,7 +5357,11 @@ export function motionSeamLine(pairs: MotionSeamPair[], animations: string[], fp
|
|
|
5202
5357
|
pairs: pairs.map(p => ({ ...p, ...checkRow('SEAM_OVER_MOTION.pairs', 'pair', false, [p.a, p.b]) })),
|
|
5203
5358
|
animations,
|
|
5204
5359
|
warnings,
|
|
5205
|
-
rows: rows.map(r =>
|
|
5360
|
+
rows: rows.map(r => {
|
|
5361
|
+
const pair = pairs.find(p => p.pair === r.pair);
|
|
5362
|
+
const unique = pair !== undefined && pairs.filter(p => p.pair === r.pair).every(p => p.a === pair.a && p.b === pair.b);
|
|
5363
|
+
return { ...r, ...checkRow('SEAM_OVER_MOTION.rows', unique ? 'pair' : 'rig', motionSeamFinding(rootNames.has(r.pair), r.status, r.banded, r.opens.length), unique ? [pair.a, pair.b] : []) };
|
|
5364
|
+
}),
|
|
5206
5365
|
...(rootGate === undefined ? {} : { roots: rootGate }),
|
|
5207
5366
|
};
|
|
5208
5367
|
}
|
|
@@ -6726,7 +6885,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6726
6885
|
const fr = measured(['render', '--candidate', buildDir, '--folds', ...geometry, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--out', foldDir]);
|
|
6727
6886
|
if (fr.status !== 0) refuseIfAny(rigcFailed(`render --folds${geometry.map((g) => ` ${g}`).join('')} --fps ${fps}`, fr, fr.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
6728
6887
|
const readings = filterFolds(readFoldSets(foldDir, animationNames, fps, fr.out));
|
|
6729
|
-
folds = foldsLine(animationNames, fps, 0, readings, mayFoldForRun, reqFile === null ? null : reqFile.path, foldProblems, readings, inp.rig, [], inp.motion, { config, stage: inp.stage });
|
|
6888
|
+
folds = foldsLine(animationNames, fps, 0, readings, mayFoldForRun, reqFile === null ? null : reqFile.path, foldProblems, readings, inp.rig, [], inp.motion, { config, stage: inp.stage }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
6730
6889
|
if (feet.length > 0) {
|
|
6731
6890
|
const sets = readJson(join(foldDir, 'frames.json'), []);
|
|
6732
6891
|
const listed = sets !== null && Array.isArray(sets.sets) ? sets.sets.filter(isRecord) : [];
|
|
@@ -6747,7 +6906,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6747
6906
|
if (frOff.status !== 0) refuseIfAny(rigcFailed(`render --folds${geometry.map((g) => ` ${g}`).join('')} --fps ${fps} (physics constraint(s) left out)`, frOff, frOff.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
6748
6907
|
const readingsOn = filterFolds(readFoldSets(onDir, animationNames, fps, frOn.out));
|
|
6749
6908
|
const readingsOff = filterFolds(readFoldSets(offDir, animationNames, fps, frOff.out));
|
|
6750
|
-
folds = foldsLine(animationNames, fps, stripped.physics.length, readingsOn, mayFoldForRun, reqFile === null ? null : reqFile.path, foldProblems, readingsOff, inp.rig, stripped.physics, inp.motion, { config, stage: inp.stage });
|
|
6909
|
+
folds = foldsLine(animationNames, fps, stripped.physics.length, readingsOn, mayFoldForRun, reqFile === null ? null : reqFile.path, foldProblems, readingsOff, inp.rig, stripped.physics, inp.motion, { config, stage: inp.stage }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
6751
6910
|
if (feet.length > 0) {
|
|
6752
6911
|
const sets = readJson(join(offDir, 'frames.json'), []);
|
|
6753
6912
|
const listed = sets !== null && Array.isArray(sets.sets) ? sets.sets.filter(isRecord) : [];
|
|
@@ -6823,7 +6982,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6823
6982
|
const geometryPath = join(idle.dir, GEOMETRY_FILE);
|
|
6824
6983
|
const geometry = readGeometry(geometryPath, idle.written);
|
|
6825
6984
|
idleGeometry = geometry;
|
|
6826
|
-
stretch = stretchLine(geometry, geometryPath, problems, { ...inp, config });
|
|
6985
|
+
stretch = stretchLine(geometry, geometryPath, problems, { ...inp, config }, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
6827
6986
|
if (full !== null) still = stillLine(full, idle, geometry, geometryPath, problems, notPlanted);
|
|
6828
6987
|
}
|
|
6829
6988
|
|
|
@@ -6937,6 +7096,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6937
7096
|
// Issue #941: under seam_over_motion.required, the same render's gapOpen on every frame of every declared pair.
|
|
6938
7097
|
const seamRequired = seamOverMotionRequired(reqFile);
|
|
6939
7098
|
let backgroundRows: MotionBackgroundRow[] = [];
|
|
7099
|
+
const motionCellEvidence: MotionCellSidecar = { spec: 'rig-parts-seam-cells/1', frames: [] };
|
|
6940
7100
|
{
|
|
6941
7101
|
const fps = IDLE_FPS;
|
|
6942
7102
|
const seamReqs = reqFile === null || seams === null ? [] : reqFile.requirements.flatMap((r) => (r.kind === 'seam' && seams?.has(r.name) === true ? [{ name: r.name, part: r.part, neighbour: r.neighbour }] : []));
|
|
@@ -6996,11 +7156,12 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
6996
7156
|
const activeDest = stripped === null ? seamMotionDir : join(seamMotionDir, env === null ? 'default' : 'active');
|
|
6997
7157
|
const renderedWorlds = new Set<'default' | 'still'>();
|
|
6998
7158
|
const hasRoots = read.some(p => p.root !== undefined);
|
|
6999
|
-
const r = measured(['render', '--candidate', buildDir, '--seam', list, '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7159
|
+
const r = measured(['render', '--candidate', buildDir, '--seam', list, ...(seamRequired ? ['--seam-cells'] : []), '--fps', String(fps), '--max', String(FOLD_RENDER_MAX), '--geometry', '--out', activeDest]);
|
|
7000
7160
|
if (r.status !== 0) refuseIfAny(rigcFailed(`render --seam ${list} --fps ${fps}`, r, r.out.split('\n').filter((l) => l.includes('FAIL') || l.includes('rigc:'))));
|
|
7001
7161
|
const activeWorldRows: MotionSeamWorldRow[] = [];
|
|
7002
7162
|
motionSeam = motionSeamLine(pairs, animationNames, fps, readMotionSeams(activeDest, animationNames, fps, read, {}, stripped !== null && env === null ? activeWorldRows : undefined, hasRoots ? motionRootDrawOrderReader(activeDest) : undefined), undefined, motionRootProblems, unmeasuredRoots);
|
|
7003
|
-
if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read
|
|
7163
|
+
if (seamRequired) backgroundRows = readMotionSeamBackground(activeDest, animationNames, fps, read,
|
|
7164
|
+
checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
7004
7165
|
enrichMotionSeamPoses(activeDest, inp.rig, inp.parts, pairs, motionSeam.rows);
|
|
7005
7166
|
if (stripped !== null) {
|
|
7006
7167
|
const response = environmentResponse(readFileSync(join(buildDir, 'skeleton.json'), 'utf8'));
|
|
@@ -7028,7 +7189,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7028
7189
|
}
|
|
7029
7190
|
}
|
|
7030
7191
|
}
|
|
7031
|
-
if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems);
|
|
7192
|
+
if (seamRequired && reqFile !== null) motionSeam.required = motionSeamRequired(motionSeam, backgroundRows, reqFile.path, motionRootProblems, motionCellEvidence);
|
|
7032
7193
|
const declaredPairKeys = new Set(motionSeam.pairs.map((p) => [p.a, p.b].sort().join('|')));
|
|
7033
7194
|
const figureOpenings: FigureOpeningReading =
|
|
7034
7195
|
inp.parts === null
|
|
@@ -7100,7 +7261,7 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7100
7261
|
if (sr.status !== 0) refuseIfAny(rigcFailed('render (the setup-pose still)', sr, sr.out.split('\n').filter((l) => l.includes('FAIL'))));
|
|
7101
7262
|
const stillSet = readFrameSet(join(stillDir, 'render'));
|
|
7102
7263
|
partSupport = observeSupport(join(stillDir, 'build'), inp, supportSource, supportFigure);
|
|
7103
|
-
if (reqFile?.setup_painting !== undefined && inp.source !== null) setupPainting = measureSetupPainting(join(stillDir, 'build'), inp.stage, inp.source.painting, reqFile.setup_painting, problems, setupBackdrop, setupFigureMask);
|
|
7264
|
+
if (reqFile?.setup_painting !== undefined && inp.source !== null) setupPainting = measureSetupPainting(join(stillDir, 'build'), inp.stage, inp.source.painting, reqFile.setup_painting, problems, setupBackdrop, setupFigureMask, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? []));
|
|
7104
7265
|
if (fixedSkeleton !== undefined) {
|
|
7105
7266
|
const geometryPath = join(stillSet.dir, GEOMETRY_FILE);
|
|
7106
7267
|
const geometry = readGeometry(geometryPath, stillSet.written);
|
|
@@ -7190,7 +7351,8 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7190
7351
|
const affected = pixels.filter(q => effects.mask[q] !== 0).length;
|
|
7191
7352
|
const reasons: Partial<SeamEffects['reasons']> = {};
|
|
7192
7353
|
for (const q of pixels) { const reason = SEAM_EFFECT_REASONS[effects.cellReasons[q]]; reasons[reason] = (reasons[reason] ?? 0) + 1; }
|
|
7193
|
-
|
|
7354
|
+
const subjects = row.parts.filter(p => p !== SEAM_NO_ART);
|
|
7355
|
+
return { ...checkRow('seam_scope.pairs', subjects.length === 0 ? 'rig' : subjects.length === 1 ? 'part' : 'pair', false, subjects), parts: row.parts, whole_px_over_40: row.px_over_40, affected_px_over_40: affected, inherited_px_over_40: row.px_over_40 - affected, reasons };
|
|
7194
7356
|
}),
|
|
7195
7357
|
};
|
|
7196
7358
|
const altMean = round3(altSeam.mean);
|
|
@@ -7358,7 +7520,10 @@ export function runCheck(rigDir: string, outDir: string, rigc: RigcRunner, parts
|
|
|
7358
7520
|
problems.unshift(...barProblems);
|
|
7359
7521
|
problems.push(...cutMaterialProblems, ...foldProblems, ...levelProblems, ...stressProblems, ...limbProblems, ...sweepProblems, ...motionRootProblems, ...reqProblems);
|
|
7360
7522
|
figures.PASS = problems.length === 0;
|
|
7361
|
-
const publishCheck = (): void =>
|
|
7523
|
+
const publishCheck = (): void => {
|
|
7524
|
+
publishMotionSeamCells(out, motionSeam.required, motionCellEvidence, () => write('check.json', serializeCheckRows(figures)));
|
|
7525
|
+
if (motionSeam.required?.cells !== undefined) written.push(MOTION_CELLS_FILE);
|
|
7526
|
+
};
|
|
7362
7527
|
if (motionSeam.worlds === undefined) publishCheck();
|
|
7363
7528
|
else publishMotionSeamWorlds(out, seamMotionDir, motionSeam.worlds, publishCheck);
|
|
7364
7529
|
const extremes = noExtremes ? [] : renderExtremes(buildDir, out, animationNames, idle === null ? extremesFrames : readJson(join(idleDir, 'frames.json'), []), extremesFrames, measured);
|
|
@@ -7576,7 +7741,7 @@ export function measureRequirements(inp: CheckInputs, file: RequirementsFile, bu
|
|
|
7576
7741
|
}
|
|
7577
7742
|
line = { ...followLine(r, d.poses, released.poses, full.poses), released_copy: door ?? 'built as forced: rig-c\'s gate passed it with no further declaration' };
|
|
7578
7743
|
}
|
|
7579
|
-
lines[r.name] = { ...line, ...(r.kind === 'seam' ? checkRow('requirements.lines.* (seam)', 'pair', line.status === 'FAIL', [r.part, r.neighbour]) : r.kind === 'stretch' ?
|
|
7744
|
+
lines[r.name] = { ...line, ...(r.kind === 'seam' ? checkRow('requirements.lines.* (seam)', 'pair', line.status === 'FAIL', [r.part, r.neighbour]) : r.kind === 'stretch' ? checkSlotRow('requirements.lines.* (stretch)', line.status === 'FAIL', r.slot, checkSlotParts(inp.rig, inp.parts?.parts.map(p => p.name) ?? [], inp.parts?.alternates?.map(set => set.name) ?? [])) : checkRow('requirements.lines.* (bone)', 'rig', line.status === 'FAIL', [])) };
|
|
7580
7745
|
const p = requirementProblem(r, line);
|
|
7581
7746
|
if (p !== null) problems.push(p);
|
|
7582
7747
|
}
|
|
@@ -8689,6 +8854,7 @@ interface StillHalf {
|
|
|
8689
8854
|
* bar ({@link crossingOf}). No render grid enters either half.
|
|
8690
8855
|
*/
|
|
8691
8856
|
export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | null, geometryPath: string, problems: Problem[], notPlanted: readonly string[] = []): JudgementLine {
|
|
8857
|
+
const slotParts = checkSlotParts(inp.rig, inp.parts.parts.map(p => p.name), inp.parts.alternates?.map(set => set.name) ?? []);
|
|
8692
8858
|
const face = partsTagged(inp.parts, FACE_TAGS);
|
|
8693
8859
|
const { all: allFeet, held: feet, declared } = plantedFeet(inp.parts, notPlanted);
|
|
8694
8860
|
if (face.length === 0 && allFeet.length === 0) return skip(`no part comes from a See-through ${tagWords([...FACE_TAGS, ...FEET_TAGS])} layer, so there is no still region to read`);
|
|
@@ -8727,12 +8893,12 @@ export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | n
|
|
|
8727
8893
|
const tolerance = stillTolerance(coordMax, entryMax);
|
|
8728
8894
|
for (const { slot, r } of readings) {
|
|
8729
8895
|
if (r.max === null) {
|
|
8730
|
-
rows.push({ ...
|
|
8896
|
+
rows.push({ ...checkSlotRow('STILL_REGIONS_DARK.*.still_slots', false, slot, slotParts), slot, unmeasured: 'no idle frame shows it' });
|
|
8731
8897
|
continue;
|
|
8732
8898
|
}
|
|
8733
8899
|
sumSq += r.sumSq;
|
|
8734
8900
|
weight += r.weight;
|
|
8735
|
-
rows.push({ ...
|
|
8901
|
+
rows.push({ ...checkSlotRow('STILL_REGIONS_DARK.*.still_slots', r.max > tolerance, slot, slotParts), slot, max_rig_px: sig4(r.max), rms_rig_px: sig4(r.weight > 0 ? Math.sqrt(r.sumSq / r.weight) : 0) });
|
|
8736
8902
|
if (worst === null || r.max > worst.max) worst = { slot, max: r.max, frame: frameIndex(r.frame) };
|
|
8737
8903
|
if (r.max > tolerance) over.push({ slot, max: r.max, frame: frameIndex(r.frame) as number });
|
|
8738
8904
|
}
|
|
@@ -8741,7 +8907,7 @@ export function stillLine(inp: FullInputs, idle: FrameSet, geo: IdleGeometry | n
|
|
|
8741
8907
|
if (still.includes(sl.name) || !record.has(sl.name)) continue;
|
|
8742
8908
|
const c = crossingOf(artOf(sl.name), inp.stage, shownOf(sl.name), maps, region);
|
|
8743
8909
|
// Art that only touches the region within the arithmetic's tolerance has not entered it.
|
|
8744
|
-
if (c !== null && c.depth > tolerance) crossing.push({ ...
|
|
8910
|
+
if (c !== null && c.depth > tolerance) crossing.push({ ...checkSlotRow('STILL_REGIONS_DARK.*.crossing', true, sl.name, slotParts), slot: sl.name, depth_rig_px: round3(c.depth), area_rig_px2: round3(c.area), frame: frameIndex(c.frame) });
|
|
8745
8911
|
}
|
|
8746
8912
|
const rms = weight > 0 ? Math.sqrt(sumSq / weight) : 0;
|
|
8747
8913
|
return {
|
|
@@ -9356,7 +9522,7 @@ export function edgeBonesText(rig: Record<string, unknown>, motion: Record<strin
|
|
|
9356
9522
|
* bones its two vertices hang on and their chains ({@link edgeBonesText}, issue
|
|
9357
9523
|
* #314).
|
|
9358
9524
|
*/
|
|
9359
|
-
export function stretchLine(geo: IdleGeometry | null, path: string, problems: Problem[], bound?: Pick<CheckInputs, 'rig' | 'motion'> & WeightStepContext): JudgementLine {
|
|
9525
|
+
export function stretchLine(geo: IdleGeometry | null, path: string, problems: Problem[], bound?: Pick<CheckInputs, 'rig' | 'motion'> & WeightStepContext, slotParts?: ReadonlyMap<string, string>): JudgementLine {
|
|
9360
9526
|
if (geo === null) return skip(`${path} does not exist; \`rigc render --geometry\` (rig-c ${RIGC_GEOMETRY_VERSION} or later) writes it, and the skinned mesh vertices are read from it`);
|
|
9361
9527
|
if (geo.meshes.length === 0) return skip('the rig draws no mesh attachment (every slot is a region), so there is no triangle to stretch');
|
|
9362
9528
|
const figures = stretchFigures(geo.meshes, geo.frames);
|
|
@@ -9375,7 +9541,7 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
9375
9541
|
});
|
|
9376
9542
|
}
|
|
9377
9543
|
if (m.max === null || m.min === null) {
|
|
9378
|
-
rows.push({ ...
|
|
9544
|
+
rows.push({ ...checkSlotRow('TEXTURE_STRETCH.per_mesh', false, m.slot, slotParts), slot: m.slot, triangles: m.triangles, unmeasured: 'no idle frame shows this attachment' });
|
|
9379
9545
|
continue;
|
|
9380
9546
|
}
|
|
9381
9547
|
const sMax = stretchSeverity(m.max.ratio);
|
|
@@ -9385,7 +9551,7 @@ export function stretchLine(geo: IdleGeometry | null, path: string, problems: Pr
|
|
|
9385
9551
|
if (worst === null || severity > worst.severity) worst = { mesh: m, at, severity };
|
|
9386
9552
|
maxAll = maxAll === null ? m.max.ratio : Math.max(maxAll, m.max.ratio);
|
|
9387
9553
|
minAll = minAll === null ? m.min.ratio : Math.min(minAll, m.min.ratio);
|
|
9388
|
-
rows.push({ ...
|
|
9554
|
+
rows.push({ ...checkSlotRow('TEXTURE_STRETCH.per_mesh', severity > TEXTURE_STRETCH_CEILING, m.slot, slotParts), slot: m.slot, triangles: m.triangles, max_ratio: round3(m.max.ratio), max_at: stretchAtText(m.max), min_ratio: round3(m.min.ratio), min_at: stretchAtText(m.min), severity });
|
|
9389
9555
|
if (severity > TEXTURE_STRETCH_CEILING) {
|
|
9390
9556
|
failed = true;
|
|
9391
9557
|
const step = bound === undefined ? '' : weightStepText(bound.rig, m.slot, m.attachment, at.edge, bound);
|
package/src/checkrow.ts
CHANGED
|
@@ -2,15 +2,74 @@
|
|
|
2
2
|
* The family literal anchors the generated reference table; it is not serialized.
|
|
3
3
|
* Finding is the producer's existing bar/warning decision, never a status guess.
|
|
4
4
|
*/
|
|
5
|
+
/** Registered JSON paths, including projections of the same producer rows. */
|
|
6
|
+
export const CHECK_ROW_PATHS = {
|
|
7
|
+
'ANIMATIONS_DO_NOT_FOLD.declared_not_folding': ['ANIMATIONS_DO_NOT_FOLD.declared_not_folding'],
|
|
8
|
+
'ANIMATIONS_DO_NOT_FOLD.folding': ['ANIMATIONS_DO_NOT_FOLD.folding'],
|
|
9
|
+
'ART_JOINT_DISTANCE.joints': ['ART_JOINT_DISTANCE.joints'],
|
|
10
|
+
'BOUNDARY_COLOUR_STEP.over': ['BOUNDARY_COLOUR_STEP.over'],
|
|
11
|
+
'BOUNDARY_COLOUR_STEP.unmeasured': ['BOUNDARY_COLOUR_STEP.unmeasured'],
|
|
12
|
+
'CLOTH_SETTLES.rows': ['CLOTH_SETTLES.rows'],
|
|
13
|
+
'CUT_JOINT_MATERIAL.rows': ['CUT_JOINT_MATERIAL.rows'],
|
|
14
|
+
'FEET_STAY_LEVEL.feet': ['FEET_STAY_LEVEL.feet'],
|
|
15
|
+
'FEET_STAY_LEVEL.feet[].worst.through': ['FEET_STAY_LEVEL.feet[].worst.through'],
|
|
16
|
+
'LIMB_ONE_BONE.parts': ['LIMB_ONE_BONE.parts'],
|
|
17
|
+
'PART_SUPPORT_REPORT.pairs': ['PART_SUPPORT_REPORT.pairs'],
|
|
18
|
+
'PART_SUPPORT_REPORT.raw_pairs': ['PART_SUPPORT_REPORT.raw_pairs'],
|
|
19
|
+
'PART_SUPPORT_REPORT.unowned.regions': ['PART_SUPPORT_REPORT.unowned.regions'],
|
|
20
|
+
'SEAM_OVER_MOTION.pairs': ['SEAM_OVER_MOTION.pairs'],
|
|
21
|
+
'SEAM_OVER_MOTION.required.pairs': ['SEAM_OVER_MOTION.required.pairs'],
|
|
22
|
+
'SEAM_OVER_MOTION.required.pairs[].open_frames': ['SEAM_OVER_MOTION.required.pairs[].open_frames'],
|
|
23
|
+
'seam_cells.frames': ['frames'],
|
|
24
|
+
'seam_cells.frames[].cells': ['frames[].cells'],
|
|
25
|
+
'SEAM_OVER_MOTION.roots.unmeasured': ['SEAM_OVER_MOTION.roots.unmeasured'],
|
|
26
|
+
'SEAM_OVER_MOTION.rows': ['SEAM_OVER_MOTION.rows'],
|
|
27
|
+
'SEAM_OVER_MOTION.rows[].cells': ['SEAM_OVER_MOTION.rows[].cells'],
|
|
28
|
+
'SEAM_OVER_MOTION.rows[].joint_contact.reasons': ['SEAM_OVER_MOTION.rows[].joint_contact.reasons'],
|
|
29
|
+
'SEAM_OVER_MOTION.rows[].pose_at_worst.joints': ['SEAM_OVER_MOTION.rows[].pose_at_worst.joints'],
|
|
30
|
+
'SEAM_OVER_MOTION.worlds.*.rows': ['SEAM_OVER_MOTION.worlds.*.rows'],
|
|
31
|
+
'SEAM_OVER_RANGE.joints': ['SEAM_OVER_RANGE.joints'],
|
|
32
|
+
'SEAM_OVER_RANGE.joints[].poses': ['SEAM_OVER_RANGE.joints[].poses'],
|
|
33
|
+
'SETUP_MATCHES_PAINTING.regions': ['SETUP_MATCHES_PAINTING.regions'],
|
|
34
|
+
'SETUP_MATCHES_PAINTING.regions[].slots': ['SETUP_MATCHES_PAINTING.regions[].slots'],
|
|
35
|
+
'STILL_REGIONS_DARK.*.crossing': ['STILL_REGIONS_DARK.*.crossing'],
|
|
36
|
+
'STILL_REGIONS_DARK.*.still_slots': ['STILL_REGIONS_DARK.*.still_slots'],
|
|
37
|
+
'STRESS_OFF_CHAIN.not_read': ['STRESS_OFF_CHAIN.not_read'],
|
|
38
|
+
'STRESS_OFF_CHAIN.per_part': ['STRESS_OFF_CHAIN.per_part'],
|
|
39
|
+
'STRESS_OFF_CHAIN.per_part[].off_chain': ['STRESS_OFF_CHAIN.per_part[].off_chain'],
|
|
40
|
+
'STRESS_OFF_CHAIN.per_part[].poses': ['STRESS_OFF_CHAIN.per_part[].poses'],
|
|
41
|
+
'TEXTURE_STRETCH.per_mesh': ['TEXTURE_STRETCH.per_mesh'],
|
|
42
|
+
'TIP_OVER_ROOT.parts': ['TIP_OVER_ROOT.parts'],
|
|
43
|
+
'WIND_BAND.pairs': ['WIND_BAND.pairs'],
|
|
44
|
+
'WIND_BAND.pairs[].steps': ['WIND_BAND.pairs[].steps'],
|
|
45
|
+
'figure_openings.openings': ['figure_openings.openings'],
|
|
46
|
+
'loop_physics': ['loop_physics'],
|
|
47
|
+
'requirements.lines.* (bone)': ['requirements.lines.*'],
|
|
48
|
+
'requirements.lines.* (seam)': ['requirements.lines.*'],
|
|
49
|
+
'requirements.lines.* (stretch)': ['requirements.lines.*'],
|
|
50
|
+
'seam_pairs': ['seam_pairs', 'seam_scope.whole_pairs', 'sets.*.seam_pairs', 'sets.*.seam_scope.whole_pairs'],
|
|
51
|
+
'seam_scope.changes': ['seam_scope.changes', 'sets.*.seam_scope.changes'],
|
|
52
|
+
'seam_scope.domain.states': ['seam_scope.domain.states', 'sets.*.seam_scope.domain.states'],
|
|
53
|
+
'seam_scope.pairs': ['seam_scope.pairs', 'sets.*.seam_scope.pairs'],
|
|
54
|
+
'seam_scope.population.pairs': ['seam_scope.population.pairs', 'sets.*.seam_scope.population.pairs'],
|
|
55
|
+
'seam_scope.population.single_art': ['seam_scope.population.single_art', 'sets.*.seam_scope.population.single_art'],
|
|
56
|
+
} as const;
|
|
57
|
+
export type CheckRowFamily = keyof typeof CHECK_ROW_PATHS;
|
|
58
|
+
/** Enumerable so object spread preserves provenance; JSON never serializes symbols. */
|
|
59
|
+
export const CHECK_ROW_FAMILY: unique symbol = Symbol.for('@rig-c/parts/check-row-family');
|
|
60
|
+
/** Test preloads recognize serialized documents even in packed-install copies. */
|
|
61
|
+
export const CHECK_ROW_DOCUMENT: unique symbol = Symbol.for('@rig-c/parts/check-row-document');
|
|
62
|
+
|
|
5
63
|
export type CheckRowScope = 'part' | 'pair' | 'rig';
|
|
6
64
|
export interface CheckRowLabels {
|
|
65
|
+
[CHECK_ROW_FAMILY]: CheckRowFamily;
|
|
7
66
|
row_scope: CheckRowScope;
|
|
8
67
|
row_kind: 'finding' | 'evidence';
|
|
9
68
|
/** Actual named parts only; rig observations have no implied part attribution. */
|
|
10
69
|
row_subjects: string[];
|
|
11
70
|
}
|
|
12
|
-
export function checkRow(
|
|
13
|
-
return { row_scope: scope, row_kind: finding ? 'finding' : 'evidence', row_subjects: [...subjects] };
|
|
71
|
+
export function checkRow(family: CheckRowFamily, scope: CheckRowScope, finding: boolean, subjects: readonly string[]): CheckRowLabels {
|
|
72
|
+
return { [CHECK_ROW_FAMILY]: family, row_scope: scope, row_kind: finding ? 'finding' : 'evidence', row_subjects: [...subjects] };
|
|
14
73
|
}
|
|
15
74
|
|
|
16
75
|
/** Legacy figures for human-readable formatters and compatibility oracles. */
|
|
@@ -21,3 +80,29 @@ export function withoutCheckRows(value: unknown): unknown {
|
|
|
21
80
|
.map(([key, entry]) => [key, withoutCheckRows(entry)]));
|
|
22
81
|
return value;
|
|
23
82
|
}
|
|
83
|
+
|
|
84
|
+
/** A slot alone proves no part identity. The caller supplies a witnessed mapping. */
|
|
85
|
+
export function checkSlotRow(family: CheckRowFamily, finding: boolean, slot: string, pieces?: ReadonlyMap<string, string>): CheckRowLabels {
|
|
86
|
+
const part = pieces?.get(slot);
|
|
87
|
+
return checkRow(family, part === undefined ? 'rig' : 'part', finding, part === undefined ? [] : [part]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Serialization has no production validation side effect; tests guard this boundary. */
|
|
91
|
+
export function serializeCheckRows(value: unknown): string {
|
|
92
|
+
const document = value !== null && typeof value === 'object' && !Array.isArray(value) ? { ...value, [CHECK_ROW_DOCUMENT]: true } : value;
|
|
93
|
+
return `${JSON.stringify(document, null, 1)}\n`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Resolve default-skin drawings only to one manifest piece, including declared set images. */
|
|
97
|
+
export function checkSlotParts(rig: Readonly<Record<string, unknown>>, partNames: readonly string[], alternateSets: readonly string[] = []): ReadonlyMap<string, string> {
|
|
98
|
+
const record = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
99
|
+
const skin = record(rig.skins) && record(rig.skins.default) ? rig.skins.default : {};
|
|
100
|
+
const named = new Set(partNames), mapping = new Map<string, string>();
|
|
101
|
+
for (const [slot, drawings] of Object.entries(skin)) {
|
|
102
|
+
if (!record(drawings)) continue;
|
|
103
|
+
const names = Object.values(drawings).map(d => record(d) && typeof d.image === 'string' && d.sequence === undefined && ['region', 'mesh'].includes(typeof d.type === 'string' ? d.type : 'region') ? d.image.replace(/\.png$/, '') : undefined);
|
|
104
|
+
const candidates = names.length === 0 ? [] : [...named].filter(part => names.every(name => name !== undefined && (name === part || alternateSets.some(set => name === `${set}_${part}`))));
|
|
105
|
+
if (candidates.length === 1) mapping.set(slot, candidates[0]);
|
|
106
|
+
}
|
|
107
|
+
return mapping;
|
|
108
|
+
}
|
package/src/setuppainting.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { checkRow } from './checkrow.ts';
|
|
1
|
+
import { checkRow, checkSlotRow } from './checkrow.ts';
|
|
2
2
|
/** Authored source-painting limits over actual renderer setup pixels (#887). */
|
|
3
3
|
import { refuseIfAny, type Problem } from './errors.ts';
|
|
4
4
|
import type { Raster } from './raster/types.ts';
|
|
@@ -128,7 +128,7 @@ export const UNDECLARED_SETUP_PAINTING_REASON = 'setup_painting is undeclared; s
|
|
|
128
128
|
*/
|
|
129
129
|
export function setupPaintingLine(
|
|
130
130
|
declared: SetupPainting, source: Raster, setup: Raster, figure: Uint8Array,
|
|
131
|
-
owners: Int32Array, slots: readonly string[], problems: Problem[], backdrop?: Raster, figureMask?: Uint8Array,
|
|
131
|
+
owners: Int32Array, slots: readonly string[], problems: Problem[], backdrop?: Raster, figureMask?: Uint8Array, slotParts?: ReadonlyMap<string, string>,
|
|
132
132
|
): SetupPaintingLine {
|
|
133
133
|
refuseIfAny(setupPaintingProblems(declared, 'setup_painting'));
|
|
134
134
|
refuseIfAny(setupPaintingBounds(declared, source.width, source.height));
|
|
@@ -172,7 +172,7 @@ export function setupPaintingLine(
|
|
|
172
172
|
}
|
|
173
173
|
const status = r.max_pixels === undefined ? 'SKIP' : count > r.max_pixels ? 'FAIL' : 'PASS';
|
|
174
174
|
const result: SetupPaintingReading = { ...r, ...checkRow('SETUP_MATCHES_PAINTING.regions', 'rig', status === 'FAIL', []), status, pixel_count: count, limit: r.max_pixels ?? null,
|
|
175
|
-
slots: [...rows].map(([slot, row]) => ({ ...
|
|
175
|
+
slots: [...rows].map(([slot, row]) => ({ ...checkSlotRow('SETUP_MATCHES_PAINTING.regions[].slots', false, slot, slotParts), slot, box: [row.x0, row.y0, row.x1 - row.x0, row.y1 - row.y0], pixel_count: row.pixels })) };
|
|
176
176
|
if (status === 'FAIL') {
|
|
177
177
|
for (const row of result.slots) problems.push({ code: 'CHECK_SETUP_MATCHES_PAINTING', object: `region "${r.name}" slot "${row.slot}"`, detail: `box [${row.box.join(', ')}], pixelcount ${row.pixel_count}; region pixelcount ${count} > declared limit ${r.max_pixels}, RGB tolerance ${declared.rgb_tolerance}; compare the actual setup to the source painting on the declared stage grid` });
|
|
178
178
|
}
|