@ikijs/mcp 0.27.0 → 0.29.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 +2 -2
- package/dist/{chunk-7POOGY7U.mjs → chunk-IG2FZKTW.mjs} +108 -34
- package/dist/chunk-IG2FZKTW.mjs.map +1 -0
- package/dist/cli.js +162 -92
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +162 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/render-page.global.js +10 -3
- package/package.json +4 -4
- package/dist/chunk-7POOGY7U.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -81,7 +81,10 @@ interface PhysicsTarget {
|
|
|
81
81
|
id: string;
|
|
82
82
|
segment: number;
|
|
83
83
|
};
|
|
84
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The spring's inputs, in rig order; for a chain, every parameter that turns
|
|
86
|
+
* its anchor.
|
|
87
|
+
*/
|
|
85
88
|
input: string[];
|
|
86
89
|
/** The driven parameter. */
|
|
87
90
|
output: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,10 @@ interface PhysicsTarget {
|
|
|
81
81
|
id: string;
|
|
82
82
|
segment: number;
|
|
83
83
|
};
|
|
84
|
-
/**
|
|
84
|
+
/**
|
|
85
|
+
* The spring's inputs, in rig order; for a chain, every parameter that turns
|
|
86
|
+
* its anchor.
|
|
87
|
+
*/
|
|
85
88
|
input: string[];
|
|
86
89
|
/** The driven parameter. */
|
|
87
90
|
output: string;
|
package/dist/index.js
CHANGED
|
@@ -55,7 +55,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
55
55
|
// src/tools.ts
|
|
56
56
|
var import_node_fs4 = require("fs");
|
|
57
57
|
var import_node_path4 = __toESM(require("path"));
|
|
58
|
-
var
|
|
58
|
+
var import_format9 = require("@ikijs/format");
|
|
59
59
|
var import_editor3 = require("@ikijs/editor");
|
|
60
60
|
|
|
61
61
|
// ../engine/src/math.ts
|
|
@@ -487,6 +487,14 @@ var FixedStepClock = class {
|
|
|
487
487
|
get isSeedFrame() {
|
|
488
488
|
return this.prevNowMs === void 0;
|
|
489
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* Time carried in the accumulator, in seconds: how far the frame's timestamp is
|
|
492
|
+
* past the last whole sub-step. Drivers extrapolate their state by it so what
|
|
493
|
+
* they emit is the state at the frame's time, not at the last sub-step.
|
|
494
|
+
*/
|
|
495
|
+
get remainderS() {
|
|
496
|
+
return this.accumulatorS;
|
|
497
|
+
}
|
|
490
498
|
/**
|
|
491
499
|
* Fold `nowMs` into the accumulator and return how many {@link FIXED_DT_S}
|
|
492
500
|
* sub-steps to run this frame. On the seed frame it only records the
|
|
@@ -530,6 +538,10 @@ var SWAY_Y_AMP_DEG = 1.6;
|
|
|
530
538
|
var SWAY_Y_PERIOD_MS = 7300;
|
|
531
539
|
var SWAY_Z_AMP_DEG = 1.1;
|
|
532
540
|
var SWAY_Z_PERIOD_MS = 11300;
|
|
541
|
+
var AMBIENT_AMP_A = 0.6;
|
|
542
|
+
var AMBIENT_PERIOD_A_MS = 2900;
|
|
543
|
+
var AMBIENT_AMP_B = 0.4;
|
|
544
|
+
var AMBIENT_PERIOD_B_MS = 4300;
|
|
533
545
|
function blinkEnvelope(phase) {
|
|
534
546
|
const ms = phase * BLINK_DURATION_MS;
|
|
535
547
|
if (ms <= 0) return 1;
|
|
@@ -561,7 +573,8 @@ var IdleMotion = class {
|
|
|
561
573
|
import_format.StandardParameter.EyeballY,
|
|
562
574
|
import_format.StandardParameter.AngleX,
|
|
563
575
|
import_format.StandardParameter.AngleY,
|
|
564
|
-
import_format.StandardParameter.AngleZ
|
|
576
|
+
import_format.StandardParameter.AngleZ,
|
|
577
|
+
import_format.StandardParameter.AmbientSway
|
|
565
578
|
];
|
|
566
579
|
sink;
|
|
567
580
|
rng;
|
|
@@ -625,6 +638,7 @@ var IdleMotion = class {
|
|
|
625
638
|
this.sink(import_format.StandardParameter.AngleX, this.swayX());
|
|
626
639
|
this.sink(import_format.StandardParameter.AngleY, this.swayY());
|
|
627
640
|
this.sink(import_format.StandardParameter.AngleZ, this.swayZ());
|
|
641
|
+
this.sink(import_format.StandardParameter.AmbientSway, this.ambientSway());
|
|
628
642
|
}
|
|
629
643
|
// ---------------------------------------------------------------------------
|
|
630
644
|
// Private helpers
|
|
@@ -638,6 +652,7 @@ var IdleMotion = class {
|
|
|
638
652
|
this.sink(import_format.StandardParameter.AngleX, 0);
|
|
639
653
|
this.sink(import_format.StandardParameter.AngleY, 0);
|
|
640
654
|
this.sink(import_format.StandardParameter.AngleZ, 0);
|
|
655
|
+
this.sink(import_format.StandardParameter.AmbientSway, 0);
|
|
641
656
|
}
|
|
642
657
|
/** Returns the current eye-open value (0..1) and advances blink state. */
|
|
643
658
|
advanceBlink() {
|
|
@@ -673,6 +688,11 @@ var IdleMotion = class {
|
|
|
673
688
|
swayZ() {
|
|
674
689
|
return SWAY_Z_AMP_DEG * Math.sin(2 * Math.PI * this.clockMs / SWAY_Z_PERIOD_MS);
|
|
675
690
|
}
|
|
691
|
+
/** Ambient sway (-1..1), pure function of the internal clock. */
|
|
692
|
+
ambientSway() {
|
|
693
|
+
const t = 2 * Math.PI * this.clockMs;
|
|
694
|
+
return AMBIENT_AMP_A * Math.sin(t / AMBIENT_PERIOD_A_MS) + AMBIENT_AMP_B * Math.sin(t / AMBIENT_PERIOD_B_MS);
|
|
695
|
+
}
|
|
676
696
|
/** Ease gaze current toward target; pick a new target on the internal clock. */
|
|
677
697
|
advanceGaze(dt) {
|
|
678
698
|
if (this.clockMs >= this.nextGazeRetargetMs) {
|
|
@@ -688,6 +708,7 @@ var IdleMotion = class {
|
|
|
688
708
|
};
|
|
689
709
|
|
|
690
710
|
// ../engine/src/physics-motion.ts
|
|
711
|
+
var import_format2 = require("@ikijs/format");
|
|
691
712
|
function signedNormalized(value, param) {
|
|
692
713
|
const rest = clamp(param.default, param.min, param.max);
|
|
693
714
|
const den = Math.max(Math.abs(param.max - rest), Math.abs(rest - param.min));
|
|
@@ -705,6 +726,7 @@ var PhysicsMotion = class {
|
|
|
705
726
|
resets;
|
|
706
727
|
resetCounts;
|
|
707
728
|
rigs;
|
|
729
|
+
inputs;
|
|
708
730
|
read;
|
|
709
731
|
sink;
|
|
710
732
|
params;
|
|
@@ -713,10 +735,17 @@ var PhysicsMotion = class {
|
|
|
713
735
|
clock = new FixedStepClock();
|
|
714
736
|
constructor(rigs, params, read, sink) {
|
|
715
737
|
this.rigs = rigs;
|
|
738
|
+
this.inputs = rigs.map(
|
|
739
|
+
(rig) => (0, import_format2.physicsInputs)(rig).map(({ parameter, weight, mode }) => ({
|
|
740
|
+
parameter,
|
|
741
|
+
weight,
|
|
742
|
+
lag: mode === "lag"
|
|
743
|
+
}))
|
|
744
|
+
);
|
|
716
745
|
this.read = read;
|
|
717
746
|
this.sink = sink;
|
|
718
747
|
this.params = new Map(params.map((p) => [p.id, p]));
|
|
719
|
-
this.state = rigs.map(() => ({ x: 0, v: 0 }));
|
|
748
|
+
this.state = rigs.map(() => ({ x: 0, v: 0, lag: 0 }));
|
|
720
749
|
this.drivenParameterIds = rigs.map((rig) => rig.output.parameter);
|
|
721
750
|
this.resetCounts = rigs.map(() => 0);
|
|
722
751
|
this.resets = this.resetCounts;
|
|
@@ -725,8 +754,12 @@ var PhysicsMotion = class {
|
|
|
725
754
|
* Advance every rig to the given wall-clock timestamp (milliseconds).
|
|
726
755
|
*
|
|
727
756
|
* First call: seed each spring to rest AT its current target (so a model
|
|
728
|
-
* loaded with a nonzero input does not kick
|
|
729
|
-
* return without integrating —
|
|
757
|
+
* loaded with a nonzero input does not kick: a lag input emits rest, a follow
|
|
758
|
+
* input its value), emit that output, and return without integrating —
|
|
759
|
+
* mirroring IdleMotion's first-frame behavior.
|
|
760
|
+
*
|
|
761
|
+
* A non-finite `nowMs` after that is a dropped frame: every rig re-emits its
|
|
762
|
+
* last output from its stored state without reading its inputs.
|
|
730
763
|
*
|
|
731
764
|
* Subsequent calls: {@link FixedStepClock} folds the clamped frame delta into
|
|
732
765
|
* its accumulator and returns how many {@link FIXED_DT_S} sub-steps are due;
|
|
@@ -739,35 +772,52 @@ var PhysicsMotion = class {
|
|
|
739
772
|
this.clock.advance(nowMs);
|
|
740
773
|
for (let i = 0; i < this.rigs.length; i++) {
|
|
741
774
|
const st = this.state[i];
|
|
742
|
-
|
|
775
|
+
const { target: target2, lag } = this.targetFor(i);
|
|
776
|
+
st.x = target2;
|
|
743
777
|
st.v = 0;
|
|
778
|
+
st.lag = lag;
|
|
744
779
|
this.emit(i, st);
|
|
745
780
|
}
|
|
746
781
|
return;
|
|
747
782
|
}
|
|
783
|
+
if (!Number.isFinite(nowMs)) {
|
|
784
|
+
for (let i = 0; i < this.rigs.length; i++) this.emit(i, this.state[i]);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
748
787
|
const steps = this.clock.advance(nowMs);
|
|
749
|
-
const targets = this.rigs.map((
|
|
788
|
+
const targets = this.rigs.map((_, i) => this.targetFor(i));
|
|
750
789
|
for (let s = 0; s < steps; s++) {
|
|
751
790
|
for (let i = 0; i < this.rigs.length; i++) {
|
|
752
|
-
this.step(this.rigs[i], this.state[i], targets[i]);
|
|
791
|
+
this.step(this.rigs[i], this.state[i], targets[i].target);
|
|
753
792
|
}
|
|
754
793
|
}
|
|
755
794
|
for (let i = 0; i < this.rigs.length; i++) {
|
|
756
795
|
const st = this.state[i];
|
|
796
|
+
const { target: target2, lag } = targets[i];
|
|
757
797
|
if (!Number.isFinite(st.x) || !Number.isFinite(st.v)) {
|
|
758
|
-
st.x = Number.isFinite(
|
|
798
|
+
st.x = Number.isFinite(target2) ? target2 : 0;
|
|
759
799
|
st.v = 0;
|
|
760
800
|
this.resetCounts[i]++;
|
|
761
801
|
}
|
|
802
|
+
st.lag = lag;
|
|
762
803
|
this.emit(i, st);
|
|
763
804
|
}
|
|
764
805
|
}
|
|
765
|
-
/**
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
806
|
+
/**
|
|
807
|
+
* Rig `index`'s spring target `T` = Σ signed-normalized input value × weight,
|
|
808
|
+
* and `L`, the lag inputs' share of it. Reads each input once.
|
|
809
|
+
*/
|
|
810
|
+
targetFor(index) {
|
|
811
|
+
let target2 = 0;
|
|
812
|
+
let lag = 0;
|
|
813
|
+
for (const input of this.inputs[index]) {
|
|
814
|
+
const param = this.params.get(input.parameter);
|
|
815
|
+
const value = this.read(input.parameter);
|
|
816
|
+
const share = (param ? signedNormalized(value, param) : 0) * input.weight;
|
|
817
|
+
target2 += share;
|
|
818
|
+
if (input.lag) lag += share;
|
|
819
|
+
}
|
|
820
|
+
return { target: target2, lag };
|
|
771
821
|
}
|
|
772
822
|
/** One semi-implicit (symplectic) Euler sub-step of FIXED_DT_S seconds. */
|
|
773
823
|
step(rig, st, target2) {
|
|
@@ -775,12 +825,13 @@ var PhysicsMotion = class {
|
|
|
775
825
|
st.v += accel * FIXED_DT_S;
|
|
776
826
|
st.x += st.v * FIXED_DT_S;
|
|
777
827
|
}
|
|
778
|
-
/** Write outputDefault + x * scale onto the output param via the sink. */
|
|
828
|
+
/** Write outputDefault + (x − L) * scale onto the output param via the sink. */
|
|
779
829
|
emit(index, st) {
|
|
780
830
|
const rig = this.rigs[index];
|
|
781
831
|
const outParam = this.params.get(rig.output.parameter);
|
|
782
832
|
const outDefault = outParam ? clamp(outParam.default, outParam.min, outParam.max) : 0;
|
|
783
|
-
const
|
|
833
|
+
const x = st.x + st.v * this.clock.remainderS;
|
|
834
|
+
const value = outDefault + (x - st.lag) * rig.output.scale;
|
|
784
835
|
const finite = Number.isFinite(value);
|
|
785
836
|
if (!finite) this.resetCounts[index]++;
|
|
786
837
|
this.sink(rig.output.parameter, finite ? value : outDefault);
|
|
@@ -942,25 +993,25 @@ var HairChainMotion = class {
|
|
|
942
993
|
};
|
|
943
994
|
|
|
944
995
|
// ../engine/src/iki-motion.ts
|
|
945
|
-
var
|
|
996
|
+
var import_format5 = require("@ikijs/format");
|
|
946
997
|
|
|
947
998
|
// ../engine/src/clip-player.ts
|
|
948
|
-
var
|
|
999
|
+
var import_format3 = require("@ikijs/format");
|
|
949
1000
|
|
|
950
1001
|
// ../engine/src/expression-player.ts
|
|
951
|
-
var
|
|
1002
|
+
var import_format4 = require("@ikijs/format");
|
|
952
1003
|
|
|
953
1004
|
// ../engine/src/iki-motion.ts
|
|
954
1005
|
var HEAD_AND_GAZE = /* @__PURE__ */ new Set([
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
1006
|
+
import_format5.StandardParameter.AngleX,
|
|
1007
|
+
import_format5.StandardParameter.AngleY,
|
|
1008
|
+
import_format5.StandardParameter.AngleZ,
|
|
1009
|
+
import_format5.StandardParameter.EyeballX,
|
|
1010
|
+
import_format5.StandardParameter.EyeballY
|
|
960
1011
|
]);
|
|
961
1012
|
|
|
962
1013
|
// ../engine/src/folds.ts
|
|
963
|
-
var
|
|
1014
|
+
var import_format6 = require("@ikijs/format");
|
|
964
1015
|
|
|
965
1016
|
// ../engine/src/land.ts
|
|
966
1017
|
function staticDeformers(model) {
|
|
@@ -1020,19 +1071,19 @@ function landPart(landing, store, { worlds, grids }) {
|
|
|
1020
1071
|
var FLIP = 0;
|
|
1021
1072
|
var COLLAPSE = 0.1;
|
|
1022
1073
|
var ANGLES = [
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1074
|
+
import_format6.StandardParameter.AngleX,
|
|
1075
|
+
import_format6.StandardParameter.AngleY,
|
|
1076
|
+
import_format6.StandardParameter.AngleZ,
|
|
1077
|
+
import_format6.StandardParameter.BodyAngleX,
|
|
1078
|
+
import_format6.StandardParameter.BodyAngleY,
|
|
1079
|
+
import_format6.StandardParameter.BodyAngleZ
|
|
1029
1080
|
];
|
|
1030
1081
|
var CROSSES = [
|
|
1031
|
-
[
|
|
1032
|
-
[
|
|
1033
|
-
[
|
|
1034
|
-
[
|
|
1035
|
-
[
|
|
1082
|
+
[import_format6.StandardParameter.EyeOpenLeft],
|
|
1083
|
+
[import_format6.StandardParameter.EyeOpenRight],
|
|
1084
|
+
[import_format6.StandardParameter.MouthOpen],
|
|
1085
|
+
[import_format6.StandardParameter.ArmLeft, import_format6.StandardParameter.ArmRight],
|
|
1086
|
+
[import_format6.StandardParameter.ElbowLeft, import_format6.StandardParameter.ElbowRight]
|
|
1036
1087
|
];
|
|
1037
1088
|
function foldPoses(model) {
|
|
1038
1089
|
const byId = new Map(
|
|
@@ -1249,6 +1300,9 @@ function classify(worst) {
|
|
|
1249
1300
|
return "ok";
|
|
1250
1301
|
}
|
|
1251
1302
|
|
|
1303
|
+
// ../engine/src/physics-check.ts
|
|
1304
|
+
var import_format7 = require("@ikijs/format");
|
|
1305
|
+
|
|
1252
1306
|
// ../engine/src/physics-runs.ts
|
|
1253
1307
|
var FRAME_MS = FIXED_DT_S * 1e3 * (1 + 1e-9);
|
|
1254
1308
|
var STEP_FRAMES = 300;
|
|
@@ -1427,26 +1481,34 @@ function checkPhysics(model) {
|
|
|
1427
1481
|
};
|
|
1428
1482
|
const param = (id) => model.parameters.find((p) => p.id === id);
|
|
1429
1483
|
const springs = (model.physics ?? []).map((rig) => {
|
|
1430
|
-
const
|
|
1484
|
+
const inputs = (0, import_format7.physicsInputs)(rig).map((i) => param(i.parameter));
|
|
1485
|
+
const ids = inputs.map((p) => p.id);
|
|
1431
1486
|
const output = param(rig.output.parameter);
|
|
1432
|
-
const
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
values
|
|
1440
|
-
|
|
1487
|
+
const ranged = inputs.flatMap((input) => {
|
|
1488
|
+
const far = farEnd(input);
|
|
1489
|
+
return far === void 0 ? [] : [{ [input.id]: far }];
|
|
1490
|
+
});
|
|
1491
|
+
const settings = ranged.length === 0 ? [{}] : ranged;
|
|
1492
|
+
const steps = settings.map((values) => {
|
|
1493
|
+
const reading = stepRun(model, [rig], [], values).get(output.id);
|
|
1494
|
+
const setting = inputs.length === 1 ? [] : Object.entries(values).map(([id, v]) => `${id}=${v}`);
|
|
1495
|
+
return {
|
|
1496
|
+
name: ["the step", ...setting].join(" "),
|
|
1497
|
+
reading,
|
|
1498
|
+
displacementPx: displace(output, reading.values),
|
|
1499
|
+
values
|
|
1500
|
+
};
|
|
1501
|
+
});
|
|
1441
1502
|
const atIdle = idleExcitation(output);
|
|
1503
|
+
const clean = steps.filter((s) => !unstableWhy(output, [s]));
|
|
1442
1504
|
return target(model, {
|
|
1443
1505
|
rig: { kind: "spring", id: rig.id },
|
|
1444
|
-
input:
|
|
1506
|
+
input: ids,
|
|
1445
1507
|
output,
|
|
1446
|
-
step,
|
|
1508
|
+
step: mostMoving(clean.length > 0 ? clean : steps),
|
|
1447
1509
|
idle: atIdle,
|
|
1448
|
-
unstable: springWhy(rig) ?? unstableWhy(output, [
|
|
1449
|
-
inert:
|
|
1510
|
+
unstable: springWhy(rig) ?? unstableWhy(output, [...steps, atIdle]),
|
|
1511
|
+
inert: ranged.length === 0 ? `${ids.join(", ")} ${ids.length === 1 ? "has" : "have"} no range` : void 0
|
|
1450
1512
|
});
|
|
1451
1513
|
});
|
|
1452
1514
|
const chains = (model.physicsChains ?? []).flatMap((chain) => {
|
|
@@ -1694,7 +1756,7 @@ function ratioText(ratio) {
|
|
|
1694
1756
|
// src/render-poses.ts
|
|
1695
1757
|
var import_node_fs3 = require("fs");
|
|
1696
1758
|
var import_node_path3 = __toESM(require("path"));
|
|
1697
|
-
var
|
|
1759
|
+
var import_format8 = require("@ikijs/format");
|
|
1698
1760
|
|
|
1699
1761
|
// src/limits.ts
|
|
1700
1762
|
var import_node_fs = __toESM(require("fs"));
|
|
@@ -2195,9 +2257,9 @@ function planRenders(model, requested) {
|
|
|
2195
2257
|
}
|
|
2196
2258
|
const bodyAngles = Object.fromEntries(
|
|
2197
2259
|
[
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2260
|
+
import_format8.StandardParameter.BodyAngleX,
|
|
2261
|
+
import_format8.StandardParameter.BodyAngleY,
|
|
2262
|
+
import_format8.StandardParameter.BodyAngleZ
|
|
2201
2263
|
].filter((id) => model.parameters.some((p) => p.id === id)).map((id) => [id, -10])
|
|
2202
2264
|
);
|
|
2203
2265
|
const poses = [
|
|
@@ -2283,7 +2345,7 @@ function planRenders(model, requested) {
|
|
|
2283
2345
|
whole("full-elbow-r-45", { ParamElbowR: 45 }),
|
|
2284
2346
|
whole("full-elbow-r-90", { ParamElbowR: 90 })
|
|
2285
2347
|
);
|
|
2286
|
-
if (model.parameters.some((p) => p.id ===
|
|
2348
|
+
if (model.parameters.some((p) => p.id === import_format8.StandardParameter.ArmPoseRight)) {
|
|
2287
2349
|
poses.push(
|
|
2288
2350
|
whole("full-pose-l", { ParamArmPoseL: 1 }),
|
|
2289
2351
|
whole("full-pose-r", { ParamArmPoseR: 1 }),
|
|
@@ -2348,7 +2410,7 @@ async function renderPoses(input) {
|
|
|
2348
2410
|
input.modelPath
|
|
2349
2411
|
);
|
|
2350
2412
|
const outDir = resolveOutputDir(input.outDir);
|
|
2351
|
-
const model = (0,
|
|
2413
|
+
const model = (0, import_format8.loadIkiModel)((0, import_node_fs3.readFileSync)(modelFile, "utf8"));
|
|
2352
2414
|
const plan = planRenders(model, input.poses);
|
|
2353
2415
|
const browser = findBrowser();
|
|
2354
2416
|
if (!browser) return { ok: false, error: NO_BROWSER_MESSAGE };
|
|
@@ -2398,7 +2460,7 @@ async function renderPoses(input) {
|
|
|
2398
2460
|
physics
|
|
2399
2461
|
};
|
|
2400
2462
|
} catch (error) {
|
|
2401
|
-
if (error instanceof AutoRigInputError || error instanceof
|
|
2463
|
+
if (error instanceof AutoRigInputError || error instanceof import_format8.IkiFormatError) {
|
|
2402
2464
|
return { ok: false, error: error.message };
|
|
2403
2465
|
}
|
|
2404
2466
|
throw error;
|
|
@@ -2475,10 +2537,10 @@ async function renderAtlasToDataUri(crops, layout, quantizeColors) {
|
|
|
2475
2537
|
// src/tools.ts
|
|
2476
2538
|
function coerceModel(model) {
|
|
2477
2539
|
try {
|
|
2478
|
-
const parsed = typeof model === "string" ? (0,
|
|
2540
|
+
const parsed = typeof model === "string" ? (0, import_format9.loadIkiModel)(model) : (0, import_format9.parseIkiModel)(model);
|
|
2479
2541
|
return { ok: true, model: parsed };
|
|
2480
2542
|
} catch (e) {
|
|
2481
|
-
if (e instanceof
|
|
2543
|
+
if (e instanceof import_format9.IkiFormatError) return { ok: false, error: e.message };
|
|
2482
2544
|
throw e;
|
|
2483
2545
|
}
|
|
2484
2546
|
}
|
|
@@ -2595,115 +2657,123 @@ function describeIkiAt(modelPath) {
|
|
|
2595
2657
|
}
|
|
2596
2658
|
var STANDARD_PARAMETER_INFO = [
|
|
2597
2659
|
{
|
|
2598
|
-
id:
|
|
2660
|
+
id: import_format9.StandardParameter.MouthOpen,
|
|
2599
2661
|
description: "Mouth open amount for lip-sync (0 closed .. 1 open)."
|
|
2600
2662
|
},
|
|
2601
2663
|
{
|
|
2602
|
-
id:
|
|
2664
|
+
id: import_format9.StandardParameter.MouthForm,
|
|
2603
2665
|
description: "Mouth form / smile (-1 .. 1)."
|
|
2604
2666
|
},
|
|
2605
2667
|
{
|
|
2606
|
-
id:
|
|
2668
|
+
id: import_format9.StandardParameter.EyeOpenLeft,
|
|
2607
2669
|
description: "Left eye open (0 closed .. 1 open). Drive with the right eye for a blink."
|
|
2608
2670
|
},
|
|
2609
2671
|
{
|
|
2610
|
-
id:
|
|
2672
|
+
id: import_format9.StandardParameter.EyeOpenRight,
|
|
2611
2673
|
description: "Right eye open (0 closed .. 1 open)."
|
|
2612
2674
|
},
|
|
2613
2675
|
{
|
|
2614
|
-
id:
|
|
2676
|
+
id: import_format9.StandardParameter.EyeballX,
|
|
2615
2677
|
description: "Eyeball gaze, horizontal (-1 .. 1)."
|
|
2616
2678
|
},
|
|
2617
2679
|
{
|
|
2618
|
-
id:
|
|
2680
|
+
id: import_format9.StandardParameter.EyeballY,
|
|
2619
2681
|
description: "Eyeball gaze, vertical (-1 .. 1)."
|
|
2620
2682
|
},
|
|
2621
2683
|
{
|
|
2622
|
-
id:
|
|
2684
|
+
id: import_format9.StandardParameter.AngleX,
|
|
2623
2685
|
description: "Head angle, horizontal degrees."
|
|
2624
2686
|
},
|
|
2625
2687
|
{
|
|
2626
|
-
id:
|
|
2688
|
+
id: import_format9.StandardParameter.AngleY,
|
|
2627
2689
|
description: "Head angle, vertical degrees."
|
|
2628
2690
|
},
|
|
2629
2691
|
{
|
|
2630
|
-
id:
|
|
2692
|
+
id: import_format9.StandardParameter.AngleZ,
|
|
2631
2693
|
description: "Head tilt / roll degrees; positive tilts the top of the head toward the viewer's right (clockwise), as in Live2D."
|
|
2632
2694
|
},
|
|
2633
2695
|
{
|
|
2634
|
-
id:
|
|
2696
|
+
id: import_format9.StandardParameter.BodyAngleX,
|
|
2635
2697
|
description: "Body turn, degrees (-10 .. 10); positive turns the body toward the viewer's right, as AngleX does the head."
|
|
2636
2698
|
},
|
|
2637
2699
|
{
|
|
2638
|
-
id:
|
|
2700
|
+
id: import_format9.StandardParameter.BodyAngleY,
|
|
2639
2701
|
description: "Body lean, degrees (-10 .. 10); positive moves the upper body up, negative bows."
|
|
2640
2702
|
},
|
|
2641
2703
|
{
|
|
2642
|
-
id:
|
|
2704
|
+
id: import_format9.StandardParameter.BodyAngleZ,
|
|
2643
2705
|
description: "Body tilt, degrees (-10 .. 10); positive tilts the top toward the viewer's right (clockwise), as AngleZ does the head."
|
|
2644
2706
|
},
|
|
2645
2707
|
{
|
|
2646
|
-
id:
|
|
2708
|
+
id: import_format9.StandardParameter.Breath,
|
|
2647
2709
|
description: "Idle breath (0 .. 1), cycled by the host."
|
|
2648
2710
|
},
|
|
2649
2711
|
{
|
|
2650
|
-
id:
|
|
2712
|
+
id: import_format9.StandardParameter.AmbientSway,
|
|
2713
|
+
description: "Ambient sway (-1 .. 1): a slow zero-mean drift the idle writes for physics rigs to follow (the auto-rig's hair in idle). Not a wind: no bias. Stays procedural under a declared Idle group, as Breath does."
|
|
2714
|
+
},
|
|
2715
|
+
{
|
|
2716
|
+
id: import_format9.StandardParameter.BrowLeftY,
|
|
2651
2717
|
description: "Left brow raise/lower (-1 .. 1)."
|
|
2652
2718
|
},
|
|
2653
2719
|
{
|
|
2654
|
-
id:
|
|
2720
|
+
id: import_format9.StandardParameter.BrowRightY,
|
|
2655
2721
|
description: "Right brow raise/lower (-1 .. 1)."
|
|
2656
2722
|
},
|
|
2657
2723
|
{
|
|
2658
|
-
id:
|
|
2724
|
+
id: import_format9.StandardParameter.BrowLeftAngle,
|
|
2659
2725
|
description: "Left brow tilt/angle (-1 .. 1)."
|
|
2660
2726
|
},
|
|
2661
2727
|
{
|
|
2662
|
-
id:
|
|
2728
|
+
id: import_format9.StandardParameter.BrowRightAngle,
|
|
2663
2729
|
description: "Right brow tilt/angle (-1 .. 1)."
|
|
2664
2730
|
},
|
|
2665
2731
|
{
|
|
2666
|
-
id:
|
|
2732
|
+
id: import_format9.StandardParameter.Cheek,
|
|
2667
2733
|
description: "Cheek blush strength (0 .. 1), raised by an expression."
|
|
2668
2734
|
},
|
|
2669
2735
|
{
|
|
2670
|
-
id:
|
|
2671
|
-
description: "
|
|
2736
|
+
id: import_format9.StandardParameter.HairSwayX,
|
|
2737
|
+
description: "Front hair's horizontal sway driver. Physics OUTPUT \u2014 driven by the spring, hosts should not set it directly."
|
|
2738
|
+
},
|
|
2739
|
+
{
|
|
2740
|
+
id: import_format9.StandardParameter.HairSwayZ,
|
|
2741
|
+
description: "Front hair's sway driver behind a head tilt. Physics OUTPUT \u2014 driven by the spring, hosts should not set it directly."
|
|
2672
2742
|
},
|
|
2673
2743
|
{
|
|
2674
|
-
id:
|
|
2675
|
-
description: "
|
|
2744
|
+
id: import_format9.StandardParameter.HairBackSway,
|
|
2745
|
+
description: "Back hair's sway driver behind the head turn, tilt and ambient drift, one spring slower than the front hair's so the two swing out of phase. Physics OUTPUT \u2014 driven by the spring, hosts should not set it directly."
|
|
2676
2746
|
},
|
|
2677
2747
|
{
|
|
2678
|
-
id:
|
|
2748
|
+
id: import_format9.StandardParameter.ArmLeft,
|
|
2679
2749
|
description: "Left shoulder, degrees; positive raises the arm outward (mirrored on the right)."
|
|
2680
2750
|
},
|
|
2681
2751
|
{
|
|
2682
|
-
id:
|
|
2752
|
+
id: import_format9.StandardParameter.ArmRight,
|
|
2683
2753
|
description: "Right shoulder, degrees; positive raises the arm outward (mirrored on the left)."
|
|
2684
2754
|
},
|
|
2685
2755
|
{
|
|
2686
|
-
id:
|
|
2756
|
+
id: import_format9.StandardParameter.ElbowLeft,
|
|
2687
2757
|
description: "Left elbow, degrees; positive bends the forearm toward the body (the flexion of a hanging arm), negative a little outward (mirrored on the right)."
|
|
2688
2758
|
},
|
|
2689
2759
|
{
|
|
2690
|
-
id:
|
|
2760
|
+
id: import_format9.StandardParameter.ElbowRight,
|
|
2691
2761
|
description: "Right elbow, degrees; positive bends the forearm toward the body (the flexion of a hanging arm), negative a little outward (mirrored on the left)."
|
|
2692
2762
|
},
|
|
2693
2763
|
{
|
|
2694
|
-
id:
|
|
2764
|
+
id: import_format9.StandardParameter.ArmPoseLeft,
|
|
2695
2765
|
description: "Left pose-forearm switch, 0..1; 0 the hanging forearm, 1 the drawn pose forearm, between them a crossfade of the two. Declared by auto-rigged models with a pose forearm."
|
|
2696
2766
|
},
|
|
2697
2767
|
{
|
|
2698
|
-
id:
|
|
2768
|
+
id: import_format9.StandardParameter.ArmPoseRight,
|
|
2699
2769
|
description: "Right pose-forearm switch, 0..1; 0 the hanging forearm, 1 the drawn pose forearm, between them a crossfade of the two. Declared by auto-rigged models with a pose forearm."
|
|
2700
2770
|
},
|
|
2701
2771
|
{
|
|
2702
|
-
id:
|
|
2772
|
+
id: import_format9.StandardParameter.ArmPoseAngleLeft,
|
|
2703
2773
|
description: "Left pose forearm's own small rotation about the elbow, degrees; positive tips the raised hand outward, away from the body (mirrored on the right)."
|
|
2704
2774
|
},
|
|
2705
2775
|
{
|
|
2706
|
-
id:
|
|
2776
|
+
id: import_format9.StandardParameter.ArmPoseAngleRight,
|
|
2707
2777
|
description: "Right pose forearm's own small rotation about the elbow, degrees; positive tips the raised hand outward, away from the body (mirrored on the left)."
|
|
2708
2778
|
}
|
|
2709
2779
|
];
|
|
@@ -2903,7 +2973,7 @@ async function autoRigFromLayers(input) {
|
|
|
2903
2973
|
patched.parts.find((p) => p.id === partId).texture.index = 1;
|
|
2904
2974
|
}
|
|
2905
2975
|
}
|
|
2906
|
-
const finalModel = (0,
|
|
2976
|
+
const finalModel = (0, import_format9.parseIkiModel)(patched);
|
|
2907
2977
|
writeFileAtomic(outPath, JSON.stringify(finalModel));
|
|
2908
2978
|
const folds = checkModelFolds(finalModel);
|
|
2909
2979
|
const physics = checkPhysics(finalModel);
|
|
@@ -5624,7 +5694,7 @@ function formatPatchReports(reports) {
|
|
|
5624
5694
|
});
|
|
5625
5695
|
}
|
|
5626
5696
|
function createIkiMcpServer() {
|
|
5627
|
-
const server = new import_mcp.McpServer({ name: "iki", version: "0.
|
|
5697
|
+
const server = new import_mcp.McpServer({ name: "iki", version: "0.29.0" });
|
|
5628
5698
|
server.registerTool(
|
|
5629
5699
|
"validate_iki",
|
|
5630
5700
|
{
|