@ikijs/editor 0.8.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -38,19 +38,19 @@ leaves the document untouched.
38
38
 
39
39
  ## API
40
40
 
41
- | Area | Exports |
42
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
43
- | Document | `EditorDocument`, `EditCommand` |
44
- | Part edits | `AddPart`, `DeletePart`, `SetPartColor`, `SetPartWidth`, `SetPartHeight`, `SetPartOrder`, `SetPartTransform`, `SetPartBindings`, `SetPartMesh`, `SetPartDeformer` |
45
- | Deformer edits | `AddDeformer`, `DeleteDeformer`, `SetDeformerParent`, `SetDeformerTransform`, `SetDeformerBindings`, `SetDeformerPivot` (+ `X`/`Y`), `CaptureGridKeyform` |
46
- | Physics edits | `AddPhysicsRig`, `SetPhysicsRig`, `DeletePhysicsRig` |
47
- | Referential guards | `validateDeformerReparent`, `validateDeformerDelete`, `validatePartAttach` |
48
- | Atlas | `packAtlas`, `uvRectFor`, `ATLAS_PADDING`, `UV_INSET_PX` |
49
- | Grid keyforms | `computeGridOffsets`, `interpolateGridOffsets`, `upsertGridKeyform` |
50
- | Factories | `createDefaultPart`, `createDefaultMatrixDeformer`, `createDefaultWarpDeformer`, `createGridMesh` |
51
- | Pixels | `detectAlphaBbox`, `ALPHA_BBOX_THRESHOLD`, `AlphaBbox` |
52
- | Auto-rig | `generateIkiFromLayerSet`, `parseLayerRoles`, `TurnTargets`, `DEFAULT_TURN_TARGETS`, `TurnSolveReport` |
53
- | Bindings | `captureBindingEndpoint` |
41
+ | Area | Exports |
42
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
43
+ | Document | `EditorDocument`, `EditCommand` |
44
+ | Part edits | `AddPart`, `DeletePart`, `SetPartColor`, `SetPartWidth`, `SetPartHeight`, `SetPartOrder`, `SetPartTransform`, `SetPartBindings`, `SetPartMesh`, `SetPartDeformer` |
45
+ | Deformer edits | `AddDeformer`, `DeleteDeformer`, `SetDeformerParent`, `SetDeformerTransform`, `SetDeformerBindings`, `SetDeformerPivot` (+ `X`/`Y`), `CaptureGridKeyform` |
46
+ | Physics edits | `AddPhysicsRig`, `SetPhysicsRig`, `DeletePhysicsRig` |
47
+ | Referential guards | `validateDeformerReparent`, `validateDeformerDelete`, `validatePartAttach` |
48
+ | Atlas | `packAtlas`, `uvRectFor`, `ATLAS_PADDING`, `UV_INSET_PX` |
49
+ | Grid keyforms | `computeGridOffsets`, `interpolateGridOffsets`, `upsertGridKeyform` |
50
+ | Factories | `createDefaultPart`, `createDefaultMatrixDeformer`, `createDefaultWarpDeformer`, `createGridMesh` |
51
+ | Pixels | `detectAlphaBbox`, `ALPHA_BBOX_THRESHOLD`, `AlphaBbox`, `ALPHA_OPAQUE`, `HEAD_BAND`, `SPECK_CORE_FRACTION`, `denseCoreOf`, `isSpeckCore`, `foregroundSpan`, `headHalfOf` |
52
+ | Auto-rig | `generateIkiFromLayerSet`, `parseLayerRoles`, `createLayerSetMeasurer`, `TurnTargets`, `DEFAULT_TURN_TARGETS`, `TurnSolveReport` |
53
+ | Bindings | `captureBindingEndpoint` |
54
54
 
55
55
  ## Auto-rig
56
56
 
@@ -112,23 +112,32 @@ the iris's centre (`IrisStrand`: the iris's opaque span, and the run's outer
112
112
  and face-side ends). One shape covers a strand outward of a clear iris, a run
113
113
  over the iris centre that clears on the face side, and a fringe spanning the
114
114
  face, whose `runFace` is `null` because it has no face-side end on that side.
115
- `@ikijs/mcp` measures it off the pixels it decodes. It is always validated
116
- against the layers, but like `headEdges` it is only read by the turn solve, so
117
- it has no effect on the rig without a `nose`; absent or `{}`, the rig is exactly
118
- the one built without it.
115
+ `createLayerSetMeasurer` measures it off the RGBA a host decoded. It is always
116
+ validated against the layers, but like `headEdges` it is only read by the turn
117
+ solve, so it has no effect on the rig without a `nose`; absent or `{}`, the rig
118
+ is exactly the one built without it.
119
119
 
120
120
  It takes **already-decoded** layer geometry (`LayerInput`), never pixels, which
121
- is what keeps this package free of any image dependency: the editor app
122
- decodes with canvas, `@ikijs/mcp` decodes with `sharp`, and both feed the same
123
- pure function — including the optional `rowHalfWidths` (one entry per crop row,
124
- half that row's opaque span in canvas px), which `@ikijs/mcp` measures for the
125
- face so the plate turns on a radius that varies by row; absent, it turns on one
126
- constant radius. It also takes the optional `denseCore`, the tight box of a
127
- layer's alpha ≥ 128 pixels in image coords, not grown, which `@ikijs/mcp`
128
- measures for the nose: its centre and width are the nose's turn landmark, so a
129
- shaded nose is fitted by its drawing rather than its soft feather, and its top
130
- edge at its centre x is the bridge top the nose tilts 6° about on the turn, its
131
- tip toward the far side; absent, the crop stands in for both.
121
+ is what keeps this package free of any image dependency: the editor app decodes
122
+ with canvas, `@ikijs/mcp` decodes with `sharp`, and both hand the RGBA they
123
+ decoded to `createLayerSetMeasurer` (below) and feed what it measures to the
124
+ same pure function — including the optional `rowHalfWidths` (one entry per crop
125
+ row, half that row's opaque span in canvas px), measured for the face so the
126
+ plate turns on a radius that varies by row; absent, it turns on one constant
127
+ radius. It also takes the optional `denseCore`, the tight box of a layer's alpha
128
+ ≥ 128 pixels in image coords, not grown, measured for the nose: its centre and
129
+ width are the nose's turn landmark, so a shaded nose is fitted by its drawing
130
+ rather than its soft feather, and its top edge at its centre x is the bridge top
131
+ the nose tilts 6° about on the turn, its tip toward the far side; absent, the
132
+ crop stands in for both.
133
+
134
+ `createLayerSetMeasurer(canvas)` measures all of it — `rowHalfWidths`,
135
+ `denseCore`, `headHalfWidth`, `headEdges` and `strandEdges` — off the RGBA a
136
+ host decoded, one layer at a time: `add` each layer while its pixels are in
137
+ memory (it keeps no reference to them), then `finish` for the `LayerInput`s and
138
+ the `turnOptions` to pass the generator. A caller's own `turnTargets` go
139
+ underneath `turnOptions.turnTargets`: spread the caller's targets first, then
140
+ the measured ones.
132
141
 
133
142
  `*_L` / `*_R` are the **character's** sides — `eye_L` is the character's left
134
143
  eye, which appears on the viewer's right.