@ikijs/editor 0.17.0 → 0.18.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 +13 -13
- package/dist/index.d.mts +64 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.js +268 -266
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +273 -272
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,19 +40,19 @@ leaves the document untouched.
|
|
|
40
40
|
|
|
41
41
|
## API
|
|
42
42
|
|
|
43
|
-
| Area | Exports
|
|
44
|
-
| ------------------ |
|
|
45
|
-
| Document | `EditorDocument`, `EditCommand`
|
|
46
|
-
| Part edits | `AddPart`, `DeletePart`, `SetPartColor`, `SetPartWidth`, `SetPartHeight`, `SetPartOrder`, `SetPartTransform`, `SetPartBindings`, `SetPartMesh`, `SetPartDeformer`
|
|
47
|
-
| Deformer edits | `AddDeformer`, `DeleteDeformer`, `SetDeformerParent`, `SetDeformerTransform`, `SetDeformerBindings`, `SetDeformerPivot` (+ `X`/`Y`), `CaptureGridKeyform`
|
|
48
|
-
| Physics edits | `AddPhysicsRig`, `SetPhysicsRig`, `DeletePhysicsRig`
|
|
49
|
-
| Referential guards | `validateDeformerReparent`, `validateDeformerDelete`, `validatePartAttach`
|
|
50
|
-
| Atlas | `packAtlas`, `uvRectFor`, `ATLAS_PADDING`, `UV_INSET_PX`
|
|
51
|
-
| Grid keyforms | `computeGridOffsets`, `interpolateGridOffsets`, `upsertGridKeyform`
|
|
52
|
-
| Factories | `createDefaultPart`, `createDefaultMatrixDeformer`, `createDefaultWarpDeformer`, `createGridMesh`
|
|
53
|
-
| Pixels | `detectAlphaBbox`, `ALPHA_BBOX_THRESHOLD`, `AlphaBbox`, `ALPHA_OPAQUE`, `HEAD_BAND`, `SPECK_CORE_FRACTION`, `denseCoreOf`, `isSpeckCore`, `foregroundSpan`, `headHalfOf`
|
|
54
|
-
| Auto-rig | `generateIkiFromLayerSet`, `parseLayerRoles`, `partIdsOfRole`, `createLayerSetMeasurer`, `TurnTargets`, `DEFAULT_TURN_TARGETS`, `TurnSolveReport`, `RigStyle`, `LayerGeometryError` |
|
|
55
|
-
| Bindings | `captureBindingEndpoint`
|
|
43
|
+
| Area | Exports |
|
|
44
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
45
|
+
| Document | `EditorDocument`, `EditCommand` |
|
|
46
|
+
| Part edits | `AddPart`, `DeletePart`, `SetPartColor`, `SetPartWidth`, `SetPartHeight`, `SetPartOrder`, `SetPartTransform`, `SetPartBindings`, `SetPartMesh`, `SetPartDeformer` |
|
|
47
|
+
| Deformer edits | `AddDeformer`, `DeleteDeformer`, `SetDeformerParent`, `SetDeformerTransform`, `SetDeformerBindings`, `SetDeformerPivot` (+ `X`/`Y`), `CaptureGridKeyform` |
|
|
48
|
+
| Physics edits | `AddPhysicsRig`, `SetPhysicsRig`, `DeletePhysicsRig` |
|
|
49
|
+
| Referential guards | `validateDeformerReparent`, `validateDeformerDelete`, `validatePartAttach` |
|
|
50
|
+
| Atlas | `packAtlas`, `uvRectFor`, `ATLAS_PADDING`, `UV_INSET_PX` |
|
|
51
|
+
| Grid keyforms | `computeGridOffsets`, `interpolateGridOffsets`, `upsertGridKeyform` |
|
|
52
|
+
| Factories | `createDefaultPart`, `createDefaultMatrixDeformer`, `createDefaultWarpDeformer`, `createGridMesh` |
|
|
53
|
+
| Pixels | `detectAlphaBbox`, `ALPHA_BBOX_THRESHOLD`, `AlphaBbox`, `ALPHA_OPAQUE`, `HEAD_BAND`, `SPECK_CORE_FRACTION`, `denseCoreOf`, `isSpeckCore`, `foregroundSpan`, `headHalfOf` |
|
|
54
|
+
| Auto-rig | `generateIkiFromLayerSet`, `parseLayerRoles`, `partIdsOfRole`, `createLayerSetMeasurer`, `armGeometry`, `ArmGeometry`, `TurnTargets`, `DEFAULT_TURN_TARGETS`, `TurnSolveReport`, `RigStyle`, `LayerGeometryError` |
|
|
55
|
+
| Bindings | `captureBindingEndpoint` |
|
|
56
56
|
|
|
57
57
|
## Auto-rig
|
|
58
58
|
|
package/dist/index.d.mts
CHANGED
|
@@ -855,6 +855,69 @@ interface GenerateOptions {
|
|
|
855
855
|
};
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
+
/**
|
|
859
|
+
* The arms. Each `arm_L` / `arm_R` layer is one drawing of the whole arm,
|
|
860
|
+
* hanging, its shoulder at the top. It becomes two parts on two nested matrix
|
|
861
|
+
* deformers hung from the body warp:
|
|
862
|
+
* - the upper arm (the role's own id) on `armDeformer_X`, which turns about
|
|
863
|
+
* the shoulder, the deltoid cap's centre;
|
|
864
|
+
* - the forearm (`forearm_X`) on `forearmDeformer_X`, a child of the arm's,
|
|
865
|
+
* which turns about the elbow.
|
|
866
|
+
* The shoulder pivot rides an all-weight-1 cell of the body warp (`body.ts`),
|
|
867
|
+
* so the arm breathes and turns with the chest rigidly, never sheared.
|
|
868
|
+
*
|
|
869
|
+
* Both parts are cut from the one crop: they share its box, transform and
|
|
870
|
+
* texture rect, and their meshes meet on the seam, the elbow pivot's row. The
|
|
871
|
+
* upper arm is the band above the seam. The forearm is the band below it plus
|
|
872
|
+
* a half-disc fan above it, centred on the elbow pivot. Iki has no glue
|
|
873
|
+
* between meshes, and two bands hinged at a seam open a wedge as wide as the
|
|
874
|
+
* arm on a bend; the half-disc turns about its own centre, so it rotates into
|
|
875
|
+
* itself and keeps the joint covered at any bend.
|
|
876
|
+
*
|
|
877
|
+
* Draw order: hair_back < body < arm_L, forearm_L, arm_R, forearm_R < face …
|
|
878
|
+
* < hair_front. The forearm draws over the upper arm, so its cap hides the
|
|
879
|
+
* seam.
|
|
880
|
+
*
|
|
881
|
+
* Signs: ParamArmX + raises the arm outward on either side and ParamElbowX +
|
|
882
|
+
* turns the forearm the same way, both in degrees 1:1. A rotation is
|
|
883
|
+
* CCW-positive, so an arm whose shoulder lies right of the body's axis (+x,
|
|
884
|
+
* the character's left) turns CCW for +, and one at −x turns CW.
|
|
885
|
+
*/
|
|
886
|
+
|
|
887
|
+
type Point = {
|
|
888
|
+
x: number;
|
|
889
|
+
y: number;
|
|
890
|
+
};
|
|
891
|
+
interface ArmGeometry {
|
|
892
|
+
/** The shoulder pivot, model space: the deltoid cap's centre. */
|
|
893
|
+
shoulder: Point;
|
|
894
|
+
/** r_u: the upper arm's half-width under the cap, px. */
|
|
895
|
+
shoulderRadius: number;
|
|
896
|
+
/** The elbow pivot, model space. Its y is the seam the two meshes meet on. */
|
|
897
|
+
elbow: Point;
|
|
898
|
+
/** The forearm's half-disc radius, px. */
|
|
899
|
+
capRadius: number;
|
|
900
|
+
/** +1 for a shoulder right of the body's axis (+ turns CCW), −1 left of it
|
|
901
|
+
* (+ turns CW). */
|
|
902
|
+
side: 1 | -1;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* The arm's pivots, read off the widest opaque run of each crop row
|
|
906
|
+
* (`rowRuns`); a row without one, or a layer without runs, reads as the
|
|
907
|
+
* crop:
|
|
908
|
+
* - r_u is half the median width over the `CAP_ROWS` rows;
|
|
909
|
+
* - the shoulder pivot lies r_u under the first painted row's centre, at the
|
|
910
|
+
* run centre of the row it lands in;
|
|
911
|
+
* - the elbow is the centre of the row `ELBOW_AT` of the way from there to
|
|
912
|
+
* the last painted row, at its run centre;
|
|
913
|
+
* - the cap radius is half the elbow's run + 1 px, kept inside the crop.
|
|
914
|
+
* Pivots are on the 0.01 grid, as the written model is. `bodyAxisX` is the
|
|
915
|
+
* body's axis, model x: the shoulder's side of it sets the sign. An arm too
|
|
916
|
+
* short for its width to put the elbow under the shoulder would rig
|
|
917
|
+
* inverted, so it throws `LayerGeometryError`.
|
|
918
|
+
*/
|
|
919
|
+
declare function armGeometry(layer: LayerInput, bodyAxisX: number): ArmGeometry;
|
|
920
|
+
|
|
858
921
|
/** The part ids a `role`'s layer becomes, back to front: every one of them
|
|
859
922
|
* takes its texture from the layer's crop. Throws on an unknown role. */
|
|
860
923
|
declare function partIdsOfRole(role: string): readonly string[];
|
|
@@ -1281,4 +1344,4 @@ declare function createGridMesh(cols: number, rows: number): IkiMesh;
|
|
|
1281
1344
|
*/
|
|
1282
1345
|
declare function createDefaultWarpDeformer(model: IkiModel): IkiWarpDeformer;
|
|
1283
1346
|
|
|
1284
|
-
export { ALPHA_BBOX_THRESHOLD, ALPHA_OPAQUE, ATLAS_PADDING, AddDeformer, AddPart, AddPhysicsRig, type AlphaBbox, type ApplyAtlasInput, type AtlasAssignment, type AtlasLayout, type AtlasPlacement, type AtlasSource, CaptureGridKeyform, DEFAULT_TURN_TARGETS, type DeformerTransformChannel, DeleteDeformer, DeletePart, DeletePhysicsRig, type EditCommand, type EditTransformChannel, EditorDocument, HEAD_BAND, type IrisStrand, LayerGeometryError, type LayerInput, type LayerSetMeasurement, type LayerSetMeasurer, type RgbaLayer, type RigStyle, SPECK_CORE_FRACTION, SetDeformerBindings, SetDeformerParent, SetDeformerPivot, SetDeformerPivotX, SetDeformerPivotY, SetDeformerTransform, SetPartBindings, SetPartColor, SetPartDeformer, SetPartHeight, SetPartMesh, SetPartOrder, SetPartTransform, SetPartWidth, SetPhysicsRig, type StrandOverlap, type TurnDepths, type TurnSolveReport, TurnTargetError, type TurnTargets, UV_INSET_PX, captureBindingEndpoint, computeGridOffsets, createDefaultMatrixDeformer, createDefaultPart, createDefaultWarpDeformer, createGridMesh, createLayerSetMeasurer, denseCoreOf, detectAlphaBbox, foregroundSpan, generateIkiFromLayerSet, headHalfOf, interpolateGridOffsets, isSpeckCore, packAtlas, parseLayerRoles, partIdsOfRole, upsertGridKeyform, uvRectFor, validateDeformerDelete, validateDeformerReparent, validatePartAttach };
|
|
1347
|
+
export { ALPHA_BBOX_THRESHOLD, ALPHA_OPAQUE, ATLAS_PADDING, AddDeformer, AddPart, AddPhysicsRig, type AlphaBbox, type ApplyAtlasInput, type ArmGeometry, type AtlasAssignment, type AtlasLayout, type AtlasPlacement, type AtlasSource, CaptureGridKeyform, DEFAULT_TURN_TARGETS, type DeformerTransformChannel, DeleteDeformer, DeletePart, DeletePhysicsRig, type EditCommand, type EditTransformChannel, EditorDocument, HEAD_BAND, type IrisStrand, LayerGeometryError, type LayerInput, type LayerSetMeasurement, type LayerSetMeasurer, type RgbaLayer, type RigStyle, SPECK_CORE_FRACTION, SetDeformerBindings, SetDeformerParent, SetDeformerPivot, SetDeformerPivotX, SetDeformerPivotY, SetDeformerTransform, SetPartBindings, SetPartColor, SetPartDeformer, SetPartHeight, SetPartMesh, SetPartOrder, SetPartTransform, SetPartWidth, SetPhysicsRig, type StrandOverlap, type TurnDepths, type TurnSolveReport, TurnTargetError, type TurnTargets, UV_INSET_PX, armGeometry, captureBindingEndpoint, computeGridOffsets, createDefaultMatrixDeformer, createDefaultPart, createDefaultWarpDeformer, createGridMesh, createLayerSetMeasurer, denseCoreOf, detectAlphaBbox, foregroundSpan, generateIkiFromLayerSet, headHalfOf, interpolateGridOffsets, isSpeckCore, packAtlas, parseLayerRoles, partIdsOfRole, upsertGridKeyform, uvRectFor, validateDeformerDelete, validateDeformerReparent, validatePartAttach };
|
package/dist/index.d.ts
CHANGED
|
@@ -855,6 +855,69 @@ interface GenerateOptions {
|
|
|
855
855
|
};
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
+
/**
|
|
859
|
+
* The arms. Each `arm_L` / `arm_R` layer is one drawing of the whole arm,
|
|
860
|
+
* hanging, its shoulder at the top. It becomes two parts on two nested matrix
|
|
861
|
+
* deformers hung from the body warp:
|
|
862
|
+
* - the upper arm (the role's own id) on `armDeformer_X`, which turns about
|
|
863
|
+
* the shoulder, the deltoid cap's centre;
|
|
864
|
+
* - the forearm (`forearm_X`) on `forearmDeformer_X`, a child of the arm's,
|
|
865
|
+
* which turns about the elbow.
|
|
866
|
+
* The shoulder pivot rides an all-weight-1 cell of the body warp (`body.ts`),
|
|
867
|
+
* so the arm breathes and turns with the chest rigidly, never sheared.
|
|
868
|
+
*
|
|
869
|
+
* Both parts are cut from the one crop: they share its box, transform and
|
|
870
|
+
* texture rect, and their meshes meet on the seam, the elbow pivot's row. The
|
|
871
|
+
* upper arm is the band above the seam. The forearm is the band below it plus
|
|
872
|
+
* a half-disc fan above it, centred on the elbow pivot. Iki has no glue
|
|
873
|
+
* between meshes, and two bands hinged at a seam open a wedge as wide as the
|
|
874
|
+
* arm on a bend; the half-disc turns about its own centre, so it rotates into
|
|
875
|
+
* itself and keeps the joint covered at any bend.
|
|
876
|
+
*
|
|
877
|
+
* Draw order: hair_back < body < arm_L, forearm_L, arm_R, forearm_R < face …
|
|
878
|
+
* < hair_front. The forearm draws over the upper arm, so its cap hides the
|
|
879
|
+
* seam.
|
|
880
|
+
*
|
|
881
|
+
* Signs: ParamArmX + raises the arm outward on either side and ParamElbowX +
|
|
882
|
+
* turns the forearm the same way, both in degrees 1:1. A rotation is
|
|
883
|
+
* CCW-positive, so an arm whose shoulder lies right of the body's axis (+x,
|
|
884
|
+
* the character's left) turns CCW for +, and one at −x turns CW.
|
|
885
|
+
*/
|
|
886
|
+
|
|
887
|
+
type Point = {
|
|
888
|
+
x: number;
|
|
889
|
+
y: number;
|
|
890
|
+
};
|
|
891
|
+
interface ArmGeometry {
|
|
892
|
+
/** The shoulder pivot, model space: the deltoid cap's centre. */
|
|
893
|
+
shoulder: Point;
|
|
894
|
+
/** r_u: the upper arm's half-width under the cap, px. */
|
|
895
|
+
shoulderRadius: number;
|
|
896
|
+
/** The elbow pivot, model space. Its y is the seam the two meshes meet on. */
|
|
897
|
+
elbow: Point;
|
|
898
|
+
/** The forearm's half-disc radius, px. */
|
|
899
|
+
capRadius: number;
|
|
900
|
+
/** +1 for a shoulder right of the body's axis (+ turns CCW), −1 left of it
|
|
901
|
+
* (+ turns CW). */
|
|
902
|
+
side: 1 | -1;
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* The arm's pivots, read off the widest opaque run of each crop row
|
|
906
|
+
* (`rowRuns`); a row without one, or a layer without runs, reads as the
|
|
907
|
+
* crop:
|
|
908
|
+
* - r_u is half the median width over the `CAP_ROWS` rows;
|
|
909
|
+
* - the shoulder pivot lies r_u under the first painted row's centre, at the
|
|
910
|
+
* run centre of the row it lands in;
|
|
911
|
+
* - the elbow is the centre of the row `ELBOW_AT` of the way from there to
|
|
912
|
+
* the last painted row, at its run centre;
|
|
913
|
+
* - the cap radius is half the elbow's run + 1 px, kept inside the crop.
|
|
914
|
+
* Pivots are on the 0.01 grid, as the written model is. `bodyAxisX` is the
|
|
915
|
+
* body's axis, model x: the shoulder's side of it sets the sign. An arm too
|
|
916
|
+
* short for its width to put the elbow under the shoulder would rig
|
|
917
|
+
* inverted, so it throws `LayerGeometryError`.
|
|
918
|
+
*/
|
|
919
|
+
declare function armGeometry(layer: LayerInput, bodyAxisX: number): ArmGeometry;
|
|
920
|
+
|
|
858
921
|
/** The part ids a `role`'s layer becomes, back to front: every one of them
|
|
859
922
|
* takes its texture from the layer's crop. Throws on an unknown role. */
|
|
860
923
|
declare function partIdsOfRole(role: string): readonly string[];
|
|
@@ -1281,4 +1344,4 @@ declare function createGridMesh(cols: number, rows: number): IkiMesh;
|
|
|
1281
1344
|
*/
|
|
1282
1345
|
declare function createDefaultWarpDeformer(model: IkiModel): IkiWarpDeformer;
|
|
1283
1346
|
|
|
1284
|
-
export { ALPHA_BBOX_THRESHOLD, ALPHA_OPAQUE, ATLAS_PADDING, AddDeformer, AddPart, AddPhysicsRig, type AlphaBbox, type ApplyAtlasInput, type AtlasAssignment, type AtlasLayout, type AtlasPlacement, type AtlasSource, CaptureGridKeyform, DEFAULT_TURN_TARGETS, type DeformerTransformChannel, DeleteDeformer, DeletePart, DeletePhysicsRig, type EditCommand, type EditTransformChannel, EditorDocument, HEAD_BAND, type IrisStrand, LayerGeometryError, type LayerInput, type LayerSetMeasurement, type LayerSetMeasurer, type RgbaLayer, type RigStyle, SPECK_CORE_FRACTION, SetDeformerBindings, SetDeformerParent, SetDeformerPivot, SetDeformerPivotX, SetDeformerPivotY, SetDeformerTransform, SetPartBindings, SetPartColor, SetPartDeformer, SetPartHeight, SetPartMesh, SetPartOrder, SetPartTransform, SetPartWidth, SetPhysicsRig, type StrandOverlap, type TurnDepths, type TurnSolveReport, TurnTargetError, type TurnTargets, UV_INSET_PX, captureBindingEndpoint, computeGridOffsets, createDefaultMatrixDeformer, createDefaultPart, createDefaultWarpDeformer, createGridMesh, createLayerSetMeasurer, denseCoreOf, detectAlphaBbox, foregroundSpan, generateIkiFromLayerSet, headHalfOf, interpolateGridOffsets, isSpeckCore, packAtlas, parseLayerRoles, partIdsOfRole, upsertGridKeyform, uvRectFor, validateDeformerDelete, validateDeformerReparent, validatePartAttach };
|
|
1347
|
+
export { ALPHA_BBOX_THRESHOLD, ALPHA_OPAQUE, ATLAS_PADDING, AddDeformer, AddPart, AddPhysicsRig, type AlphaBbox, type ApplyAtlasInput, type ArmGeometry, type AtlasAssignment, type AtlasLayout, type AtlasPlacement, type AtlasSource, CaptureGridKeyform, DEFAULT_TURN_TARGETS, type DeformerTransformChannel, DeleteDeformer, DeletePart, DeletePhysicsRig, type EditCommand, type EditTransformChannel, EditorDocument, HEAD_BAND, type IrisStrand, LayerGeometryError, type LayerInput, type LayerSetMeasurement, type LayerSetMeasurer, type RgbaLayer, type RigStyle, SPECK_CORE_FRACTION, SetDeformerBindings, SetDeformerParent, SetDeformerPivot, SetDeformerPivotX, SetDeformerPivotY, SetDeformerTransform, SetPartBindings, SetPartColor, SetPartDeformer, SetPartHeight, SetPartMesh, SetPartOrder, SetPartTransform, SetPartWidth, SetPhysicsRig, type StrandOverlap, type TurnDepths, type TurnSolveReport, TurnTargetError, type TurnTargets, UV_INSET_PX, armGeometry, captureBindingEndpoint, computeGridOffsets, createDefaultMatrixDeformer, createDefaultPart, createDefaultWarpDeformer, createGridMesh, createLayerSetMeasurer, denseCoreOf, detectAlphaBbox, foregroundSpan, generateIkiFromLayerSet, headHalfOf, interpolateGridOffsets, isSpeckCore, packAtlas, parseLayerRoles, partIdsOfRole, upsertGridKeyform, uvRectFor, validateDeformerDelete, validateDeformerReparent, validatePartAttach };
|