@ikijs/mcp 0.31.1 → 0.33.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 +21 -20
- package/dist/{chunk-BQVILYRV.mjs → chunk-5D7374FI.mjs} +606 -103
- package/dist/chunk-5D7374FI.mjs.map +1 -0
- package/dist/cli.js +647 -150
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +118 -29
- package/dist/index.d.ts +118 -29
- package/dist/index.js +655 -150
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -1
- package/dist/render-page.global.js +23 -19
- package/package.json +2 -2
- package/dist/chunk-BQVILYRV.mjs.map +0 -1
|
@@ -1782,6 +1782,83 @@ function pop(v) {
|
|
|
1782
1782
|
}
|
|
1783
1783
|
return most / mean;
|
|
1784
1784
|
}
|
|
1785
|
+
var NOD_TURNS = [-30, 0, 30];
|
|
1786
|
+
var NOD_PARTS = [
|
|
1787
|
+
"face",
|
|
1788
|
+
"eye_L",
|
|
1789
|
+
"eye_R",
|
|
1790
|
+
"iris_L",
|
|
1791
|
+
"iris_R",
|
|
1792
|
+
"nose",
|
|
1793
|
+
"lip_upper",
|
|
1794
|
+
"mouth"
|
|
1795
|
+
];
|
|
1796
|
+
var NOD_ENDS = [0, -LADDER_MIN, LADDER_MAX - LADDER_MIN];
|
|
1797
|
+
function checkNod(model) {
|
|
1798
|
+
const face = model.parts.find((p) => p.id === "face");
|
|
1799
|
+
if (!face) return { unavailable: "no face part" };
|
|
1800
|
+
const hasEyes = ["eye_L", "eye_R"].every(
|
|
1801
|
+
(id) => model.parts.some((p) => p.id === id)
|
|
1802
|
+
);
|
|
1803
|
+
if (!hasEyes) return { unavailable: "no eye_L and eye_R parts" };
|
|
1804
|
+
const fw = face.width;
|
|
1805
|
+
const ladders = NOD_TURNS.map(
|
|
1806
|
+
(x) => Array.from(
|
|
1807
|
+
{ length: LADDER_MAX - LADDER_MIN + 1 },
|
|
1808
|
+
(_, i) => landParts(
|
|
1809
|
+
model,
|
|
1810
|
+
{ ParamAngleX: x, ParamAngleY: LADDER_MIN + i },
|
|
1811
|
+
NOD_PARTS
|
|
1812
|
+
)
|
|
1813
|
+
)
|
|
1814
|
+
);
|
|
1815
|
+
const has = (id) => ladders[0][0].has(id);
|
|
1816
|
+
const boxes = (id) => ladders.map((ladder) => ladder.map((l) => box(l.get(id), fw)));
|
|
1817
|
+
const spread = (v) => Math.max(...v) - Math.min(...v);
|
|
1818
|
+
const ranges = (values) => {
|
|
1819
|
+
const [m30, zero, p30] = NOD_TURNS.map(
|
|
1820
|
+
(_, b) => spread(
|
|
1821
|
+
Array.from(
|
|
1822
|
+
{ length: LADDER_MAX - LADDER_MIN + 1 },
|
|
1823
|
+
(_2, i) => values(b, i)
|
|
1824
|
+
)
|
|
1825
|
+
)
|
|
1826
|
+
);
|
|
1827
|
+
return { m30, zero, p30 };
|
|
1828
|
+
};
|
|
1829
|
+
const gap = (l, r) => {
|
|
1830
|
+
const bl = boxes(l);
|
|
1831
|
+
const br = boxes(r);
|
|
1832
|
+
return ranges((b, i) => br[b][i].x - bl[b][i].x);
|
|
1833
|
+
};
|
|
1834
|
+
const nod = [{ id: "eyes", range: gap("eye_L", "eye_R") }];
|
|
1835
|
+
if (has("iris_L") && has("iris_R")) {
|
|
1836
|
+
nod.push({ id: "irises", range: gap("iris_L", "iris_R") });
|
|
1837
|
+
}
|
|
1838
|
+
const mouthId = has("lip_upper") ? "lip_upper" : has("mouth") ? "mouth" : null;
|
|
1839
|
+
if (mouthId) {
|
|
1840
|
+
const bm = boxes(mouthId);
|
|
1841
|
+
nod.push({ id: "mouth", range: ranges((b, i) => bm[b][i].width) });
|
|
1842
|
+
}
|
|
1843
|
+
const corner = ["eye_L", "eye_R", "nose"].filter(has).map((id) => {
|
|
1844
|
+
const b = boxes(id);
|
|
1845
|
+
const at = (t, j) => b[t][NOD_ENDS[j]];
|
|
1846
|
+
const residual = (t, j) => {
|
|
1847
|
+
const r = (axis) => at(t, j)[axis] - at(t, 1)[axis] - at(1, j)[axis] + at(1, 1)[axis];
|
|
1848
|
+
return Math.max(Math.abs(r("x")), Math.abs(r("y")));
|
|
1849
|
+
};
|
|
1850
|
+
return {
|
|
1851
|
+
id,
|
|
1852
|
+
residual: {
|
|
1853
|
+
mm: residual(0, 0),
|
|
1854
|
+
mp: residual(0, 2),
|
|
1855
|
+
pm: residual(2, 0),
|
|
1856
|
+
pp: residual(2, 2)
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
});
|
|
1860
|
+
return { unit: "fw", faceWidth: fw, nod, corner };
|
|
1861
|
+
}
|
|
1785
1862
|
function checkSweep(model) {
|
|
1786
1863
|
const face = model.parts.find((p) => p.id === "face");
|
|
1787
1864
|
if (!face) return { preset: "turn", unavailable: "no face part" };
|
|
@@ -1851,6 +1928,19 @@ function formatSweepReport(report) {
|
|
|
1851
1928
|
`SWEEP turn plate: amplitude ${fw3(report.plateAmplitude)} fw`
|
|
1852
1929
|
];
|
|
1853
1930
|
}
|
|
1931
|
+
function formatNodReport(report) {
|
|
1932
|
+
if ("unavailable" in report) {
|
|
1933
|
+
return [`SWEEP nod: unavailable \u2014 ${report.unavailable}`];
|
|
1934
|
+
}
|
|
1935
|
+
return [
|
|
1936
|
+
...report.nod.map(
|
|
1937
|
+
({ id, range: r }) => `SWEEP nod ${id}: ${id === "mouth" ? "width" : "gap"} range X -30 ${fw3(r.m30)} / 0 ${fw3(r.zero)} / +30 ${fw3(r.p30)} fw`
|
|
1938
|
+
),
|
|
1939
|
+
...report.corner.map(
|
|
1940
|
+
({ id, residual: r }) => `SWEEP corner ${id}: residual (-30,-30) ${fw3(r.mm)} / (-30,+30) ${fw3(r.mp)} / (+30,-30) ${fw3(r.pm)} / (+30,+30) ${fw3(r.pp)} fw`
|
|
1941
|
+
)
|
|
1942
|
+
];
|
|
1943
|
+
}
|
|
1854
1944
|
|
|
1855
1945
|
// src/sweep.ts
|
|
1856
1946
|
import fs3 from "fs";
|
|
@@ -2298,7 +2388,7 @@ var SWEEP_NAME = /^[A-Za-z0-9][A-Za-z0-9_.-]*$/;
|
|
|
2298
2388
|
function bustPadY(width, height) {
|
|
2299
2389
|
return Math.max(0, (BUST_SIZE - BUST_SIZE * height / width) / 2);
|
|
2300
2390
|
}
|
|
2301
|
-
function planRenders(model, requested, sweep) {
|
|
2391
|
+
function planRenders(model, requested, sweep, sweeps) {
|
|
2302
2392
|
const { width: W, height: H } = model.canvas;
|
|
2303
2393
|
const fullBody = H > W;
|
|
2304
2394
|
const canvas = fullBody ? {
|
|
@@ -2353,12 +2443,37 @@ function planRenders(model, requested, sweep) {
|
|
|
2353
2443
|
dh
|
|
2354
2444
|
};
|
|
2355
2445
|
};
|
|
2356
|
-
if (
|
|
2357
|
-
throw new AutoRigInputError(
|
|
2358
|
-
`sweep.name must match ${SWEEP_NAME.source} (it names <outDir>/<name>/): ${JSON.stringify(sweep.name)}`
|
|
2359
|
-
);
|
|
2446
|
+
if (sweeps && sweeps.length === 0) {
|
|
2447
|
+
throw new AutoRigInputError("sweeps is empty");
|
|
2360
2448
|
}
|
|
2361
|
-
const
|
|
2449
|
+
const asked = [
|
|
2450
|
+
...sweep ? [{ label: "sweep", entry: sweep }] : [],
|
|
2451
|
+
...(sweeps ?? []).map((entry, i) => ({ label: `sweeps[${i}]`, entry }))
|
|
2452
|
+
];
|
|
2453
|
+
asked.forEach(({ label, entry }, i) => {
|
|
2454
|
+
if (!SWEEP_NAME.test(entry.name)) {
|
|
2455
|
+
throw new AutoRigInputError(
|
|
2456
|
+
`${label}.name must match ${SWEEP_NAME.source} (it names <outDir>/<name>/): ${JSON.stringify(entry.name)}`
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
const sameName = asked.findIndex(
|
|
2460
|
+
(a) => a.entry.name.toLowerCase() === entry.name.toLowerCase()
|
|
2461
|
+
);
|
|
2462
|
+
if (sameName < i) {
|
|
2463
|
+
throw new AutoRigInputError(
|
|
2464
|
+
`${label}.name ${JSON.stringify(entry.name)} repeats ${asked[sameName].label}.name ${JSON.stringify(asked[sameName].entry.name)} (ignoring case: one directory on a case-insensitive disk)`
|
|
2465
|
+
);
|
|
2466
|
+
}
|
|
2467
|
+
const samePreset = asked.findIndex((a) => a.entry.preset === entry.preset);
|
|
2468
|
+
if (samePreset < i) {
|
|
2469
|
+
throw new AutoRigInputError(
|
|
2470
|
+
`${label}.preset ${JSON.stringify(entry.preset)} repeats ${asked[samePreset].label}.preset (the same frames twice)`
|
|
2471
|
+
);
|
|
2472
|
+
}
|
|
2473
|
+
});
|
|
2474
|
+
const cropOf = (entry, label) => entry.crop ? toRenderCrop(entry.crop, `${label}.crop`) : squareCrop;
|
|
2475
|
+
const sweepCrop = sweep ? cropOf(sweep, "sweep") : void 0;
|
|
2476
|
+
const sweepsCrops = sweeps?.map((entry, i) => cropOf(entry, `sweeps[${i}]`));
|
|
2362
2477
|
if (requested) {
|
|
2363
2478
|
if (requested.length === 0) throw new AutoRigInputError("poses is empty");
|
|
2364
2479
|
const poses2 = requested.map((pose, i) => {
|
|
@@ -2370,7 +2485,7 @@ function planRenders(model, requested, sweep) {
|
|
|
2370
2485
|
crop: toRenderCrop(pose.crop, `poses[${i}].crop`)
|
|
2371
2486
|
};
|
|
2372
2487
|
});
|
|
2373
|
-
return { canvas, view, fullBody, mouth, poses: poses2, sweepCrop };
|
|
2488
|
+
return { canvas, view, fullBody, mouth, poses: poses2, sweepCrop, sweepsCrops };
|
|
2374
2489
|
}
|
|
2375
2490
|
const bodyAngles = Object.fromEntries(
|
|
2376
2491
|
[
|
|
@@ -2478,7 +2593,7 @@ function planRenders(model, requested, sweep) {
|
|
|
2478
2593
|
);
|
|
2479
2594
|
}
|
|
2480
2595
|
}
|
|
2481
|
-
return { canvas, view, fullBody, mouth, poses, sweepCrop };
|
|
2596
|
+
return { canvas, view, fullBody, mouth, poses, sweepCrop, sweepsCrops };
|
|
2482
2597
|
}
|
|
2483
2598
|
function checkRequest(requested, i) {
|
|
2484
2599
|
const { name, values } = requested[i];
|
|
@@ -2518,8 +2633,8 @@ function readPageScript() {
|
|
|
2518
2633
|
);
|
|
2519
2634
|
}
|
|
2520
2635
|
}
|
|
2521
|
-
async function captureSweep(evaluate, model,
|
|
2522
|
-
const spec = sweepSpec(model,
|
|
2636
|
+
async function captureSweep(evaluate, model, requested, crop, dir, report, nod) {
|
|
2637
|
+
const spec = sweepSpec(model, requested.preset, crop);
|
|
2523
2638
|
await evaluate(
|
|
2524
2639
|
`window.__ikiRender.sweepBegin(${JSON.stringify(spec)})`,
|
|
2525
2640
|
CAPTURE_MS
|
|
@@ -2544,12 +2659,12 @@ async function captureSweep(evaluate, model, plan, requested, dir, report) {
|
|
|
2544
2659
|
i: k,
|
|
2545
2660
|
file,
|
|
2546
2661
|
t: k / SWEEP_FPS,
|
|
2547
|
-
theta: spec.thetas[spec.captureEvery * k],
|
|
2548
2662
|
values
|
|
2549
2663
|
});
|
|
2550
2664
|
}
|
|
2551
2665
|
const end = await evaluate("window.__ikiRender.sweepEnd()", CAPTURE_MS);
|
|
2552
2666
|
for (const [what, url] of Object.entries(end)) {
|
|
2667
|
+
if (url === void 0) continue;
|
|
2553
2668
|
if (typeof url !== "string" || !url.startsWith(PNG_PREFIX)) {
|
|
2554
2669
|
throw new Error(
|
|
2555
2670
|
`sweep ${requested.name} ${what}: the page returned no PNG`
|
|
@@ -2557,26 +2672,29 @@ async function captureSweep(evaluate, model, plan, requested, dir, report) {
|
|
|
2557
2672
|
}
|
|
2558
2673
|
}
|
|
2559
2674
|
const sheet = path3.join(dir, "sheet.png");
|
|
2560
|
-
const kymograph = path3.join(dir, "kymograph.png");
|
|
2561
2675
|
writeFileAtomic(
|
|
2562
2676
|
sheet,
|
|
2563
2677
|
Buffer.from(end.sheet.slice(PNG_PREFIX.length), "base64")
|
|
2564
2678
|
);
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2679
|
+
let kymograph;
|
|
2680
|
+
if (end.kymograph !== void 0) {
|
|
2681
|
+
kymograph = path3.join(dir, "kymograph.png");
|
|
2682
|
+
writeFileAtomic(
|
|
2683
|
+
kymograph,
|
|
2684
|
+
Buffer.from(end.kymograph.slice(PNG_PREFIX.length), "base64")
|
|
2685
|
+
);
|
|
2686
|
+
}
|
|
2569
2687
|
const manifest = {
|
|
2570
|
-
version:
|
|
2688
|
+
version: 2,
|
|
2571
2689
|
preset: requested.preset,
|
|
2572
|
-
|
|
2690
|
+
parameters: spec.parameters,
|
|
2573
2691
|
fps: SWEEP_FPS,
|
|
2574
2692
|
clockHz: SWEEP_CLOCK_HZ,
|
|
2575
2693
|
warmupS: SWEEP_WARMUP_S,
|
|
2576
|
-
durationS:
|
|
2694
|
+
durationS: sweepDurationS(requested.preset),
|
|
2577
2695
|
crop: requested.crop ?? null,
|
|
2578
2696
|
frame: spec.frame,
|
|
2579
|
-
kymographRow: { row: spec.kymograph.row, at: spec.kymograph.at },
|
|
2697
|
+
kymographRow: spec.kymograph ? { row: spec.kymograph.row, at: spec.kymograph.at } : null,
|
|
2580
2698
|
sheet: { frames: spec.sheet.frames, cell: spec.sheet.cell },
|
|
2581
2699
|
physicsOutputs: spec.physicsOutputs,
|
|
2582
2700
|
frames
|
|
@@ -2593,9 +2711,10 @@ async function captureSweep(evaluate, model, plan, requested, dir, report) {
|
|
|
2593
2711
|
frames: spec.frames,
|
|
2594
2712
|
manifest: manifestPath,
|
|
2595
2713
|
sheet,
|
|
2596
|
-
kymograph,
|
|
2714
|
+
...kymograph ? { kymograph } : {},
|
|
2597
2715
|
flipbook,
|
|
2598
|
-
report
|
|
2716
|
+
report,
|
|
2717
|
+
nod
|
|
2599
2718
|
};
|
|
2600
2719
|
}
|
|
2601
2720
|
async function renderPoses(input) {
|
|
@@ -2608,7 +2727,7 @@ async function renderPoses(input) {
|
|
|
2608
2727
|
);
|
|
2609
2728
|
const outDir = resolveOutputDir(input.outDir);
|
|
2610
2729
|
const model = loadIkiModel(readFileSync(modelFile, "utf8"));
|
|
2611
|
-
const plan = planRenders(model, input.poses, input.sweep);
|
|
2730
|
+
const plan = planRenders(model, input.poses, input.sweep, input.sweeps);
|
|
2612
2731
|
const browser = findBrowser();
|
|
2613
2732
|
if (!browser) return { ok: false, error: NO_BROWSER_MESSAGE };
|
|
2614
2733
|
const pageScript = readPageScript();
|
|
@@ -2617,9 +2736,16 @@ async function renderPoses(input) {
|
|
|
2617
2736
|
input.poses?.map((p) => p.values)
|
|
2618
2737
|
);
|
|
2619
2738
|
const physics = checkPhysics(model);
|
|
2620
|
-
const sweepDir = input.sweep ? prepareSweepDir(outDir, input.sweep.name) : void 0;
|
|
2621
|
-
const
|
|
2622
|
-
|
|
2739
|
+
const sweepDir = input.sweep ? prepareSweepDir(outDir, input.sweep.name, "sweep") : void 0;
|
|
2740
|
+
const sweepsDirs = input.sweeps?.map(
|
|
2741
|
+
(s, i) => prepareSweepDir(outDir, s.name, `sweeps[${i}]`)
|
|
2742
|
+
);
|
|
2743
|
+
for (const d of [sweepDir, ...sweepsDirs ?? []]) {
|
|
2744
|
+
if (d) clearSweepDir(d);
|
|
2745
|
+
}
|
|
2746
|
+
const sweepReport = input.sweep || input.sweeps ? checkSweep(model) : void 0;
|
|
2747
|
+
const nodReport = input.sweep || input.sweeps ? checkNod(model) : void 0;
|
|
2748
|
+
const { failedTextures, poses, sweep, sweeps } = await withBrowser(
|
|
2623
2749
|
browser,
|
|
2624
2750
|
async (evaluate) => {
|
|
2625
2751
|
await evaluate(pageScript, PAGE_SCRIPT_MS);
|
|
@@ -2643,15 +2769,38 @@ async function renderPoses(input) {
|
|
|
2643
2769
|
);
|
|
2644
2770
|
written.push({ name: pose.name, path: file });
|
|
2645
2771
|
}
|
|
2646
|
-
const sweep2 = input.sweep && sweepDir && sweepReport ? await captureSweep(
|
|
2772
|
+
const sweep2 = input.sweep && sweepDir && sweepReport && nodReport ? await captureSweep(
|
|
2647
2773
|
evaluate,
|
|
2648
2774
|
model,
|
|
2649
|
-
plan,
|
|
2650
2775
|
input.sweep,
|
|
2776
|
+
plan.sweepCrop,
|
|
2651
2777
|
sweepDir,
|
|
2652
|
-
sweepReport
|
|
2778
|
+
sweepReport,
|
|
2779
|
+
nodReport
|
|
2653
2780
|
) : void 0;
|
|
2654
|
-
|
|
2781
|
+
let sweeps2;
|
|
2782
|
+
if (input.sweeps && sweepsDirs && sweepReport && nodReport) {
|
|
2783
|
+
sweeps2 = [];
|
|
2784
|
+
for (const [i, requested] of input.sweeps.entries()) {
|
|
2785
|
+
sweeps2.push(
|
|
2786
|
+
await captureSweep(
|
|
2787
|
+
evaluate,
|
|
2788
|
+
model,
|
|
2789
|
+
requested,
|
|
2790
|
+
plan.sweepsCrops?.[i],
|
|
2791
|
+
sweepsDirs[i],
|
|
2792
|
+
sweepReport,
|
|
2793
|
+
nodReport
|
|
2794
|
+
)
|
|
2795
|
+
);
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
return {
|
|
2799
|
+
failedTextures: loaded.failedTextures,
|
|
2800
|
+
poses: written,
|
|
2801
|
+
sweep: sweep2,
|
|
2802
|
+
sweeps: sweeps2
|
|
2803
|
+
};
|
|
2655
2804
|
}
|
|
2656
2805
|
);
|
|
2657
2806
|
return {
|
|
@@ -2665,7 +2814,8 @@ async function renderPoses(input) {
|
|
|
2665
2814
|
modelCanvas: model.canvas,
|
|
2666
2815
|
folds,
|
|
2667
2816
|
physics,
|
|
2668
|
-
sweep
|
|
2817
|
+
sweep,
|
|
2818
|
+
sweeps
|
|
2669
2819
|
};
|
|
2670
2820
|
} catch (error) {
|
|
2671
2821
|
if (error instanceof AutoRigInputError || error instanceof IkiFormatError) {
|
|
@@ -2679,6 +2829,8 @@ async function renderPoses(input) {
|
|
|
2679
2829
|
var SWEEP_CLOCK_HZ = 60;
|
|
2680
2830
|
var SWEEP_FPS = 30;
|
|
2681
2831
|
var SWEEP_DURATION_S = 3;
|
|
2832
|
+
var BOX_DURATION_S = 6;
|
|
2833
|
+
var SWEEP_PRESETS = ["turn", "turn-nod"];
|
|
2682
2834
|
var SWEEP_WARMUP_S = 0.5;
|
|
2683
2835
|
var SWEEP_FRAME_MS = 1e3 / SWEEP_CLOCK_HZ * (1 + 1e-9);
|
|
2684
2836
|
var SHEET_THETAS = [-30, -20, -10, -5, 0, 5, 10, 20, 30];
|
|
@@ -2686,16 +2838,75 @@ var SHEET_MAX_SIDE = 2e3;
|
|
|
2686
2838
|
var SHEET_MARGIN = 8;
|
|
2687
2839
|
var SHEET_LABEL_BAND = 24;
|
|
2688
2840
|
var KYMOGRAPH_BAND = 3;
|
|
2689
|
-
var SWEEP_PARAMETER = "ParamAngleX";
|
|
2690
|
-
var STEPS = SWEEP_CLOCK_HZ * SWEEP_DURATION_S;
|
|
2691
2841
|
var CAPTURE_EVERY = SWEEP_CLOCK_HZ / SWEEP_FPS;
|
|
2692
|
-
var FRAMES = STEPS / CAPTURE_EVERY;
|
|
2693
2842
|
var LEG_FROM_S = 0.75;
|
|
2694
2843
|
var LEG_TO_S = 2.25;
|
|
2695
2844
|
var AMPLITUDE_DEG = 30;
|
|
2845
|
+
var BOX_CORNERS = [
|
|
2846
|
+
[0, 0],
|
|
2847
|
+
[0, -30],
|
|
2848
|
+
[-30, -30],
|
|
2849
|
+
[-30, 30],
|
|
2850
|
+
[30, 30],
|
|
2851
|
+
[30, -30],
|
|
2852
|
+
[0, -30],
|
|
2853
|
+
[0, 0]
|
|
2854
|
+
];
|
|
2855
|
+
var BOX_SPEED_DEG_S = 50;
|
|
2856
|
+
var BOX_SHEET_STOPS = [
|
|
2857
|
+
[-30, 30],
|
|
2858
|
+
[0, 30],
|
|
2859
|
+
[30, 30],
|
|
2860
|
+
[-30, 0],
|
|
2861
|
+
[0, 0],
|
|
2862
|
+
[30, 0],
|
|
2863
|
+
[-30, -30],
|
|
2864
|
+
[0, -30],
|
|
2865
|
+
[30, -30]
|
|
2866
|
+
];
|
|
2696
2867
|
function turnTheta(t) {
|
|
2697
2868
|
return -AMPLITUDE_DEG * Math.sin(2 * Math.PI * t / SWEEP_DURATION_S);
|
|
2698
2869
|
}
|
|
2870
|
+
function boxAngles(t) {
|
|
2871
|
+
let start = 0;
|
|
2872
|
+
for (let i = 0; i + 1 < BOX_CORNERS.length; i++) {
|
|
2873
|
+
const [fx, fy] = BOX_CORNERS[i];
|
|
2874
|
+
const [tx, ty] = BOX_CORNERS[i + 1];
|
|
2875
|
+
const len = Math.max(Math.abs(tx - fx), Math.abs(ty - fy));
|
|
2876
|
+
const dur = len / BOX_SPEED_DEG_S;
|
|
2877
|
+
if (t < start + dur) {
|
|
2878
|
+
const u = (t - start) / dur;
|
|
2879
|
+
const e = (1 - Math.cos(Math.PI * u)) / 2;
|
|
2880
|
+
return { x: fx + (tx - fx) * e, y: fy + (ty - fy) * e };
|
|
2881
|
+
}
|
|
2882
|
+
start += dur;
|
|
2883
|
+
}
|
|
2884
|
+
return { x: 0, y: 0 };
|
|
2885
|
+
}
|
|
2886
|
+
function sweepDurationS(preset) {
|
|
2887
|
+
return preset === "turn" ? SWEEP_DURATION_S : BOX_DURATION_S;
|
|
2888
|
+
}
|
|
2889
|
+
function schedule(preset) {
|
|
2890
|
+
const durationS = sweepDurationS(preset);
|
|
2891
|
+
const n = SWEEP_CLOCK_HZ * durationS;
|
|
2892
|
+
if (preset === "turn") {
|
|
2893
|
+
return {
|
|
2894
|
+
parameters: ["ParamAngleX"],
|
|
2895
|
+
steps: Array.from({ length: n }, (_, j) => ({
|
|
2896
|
+
ParamAngleX: turnTheta(j / SWEEP_CLOCK_HZ)
|
|
2897
|
+
})),
|
|
2898
|
+
durationS
|
|
2899
|
+
};
|
|
2900
|
+
}
|
|
2901
|
+
return {
|
|
2902
|
+
parameters: ["ParamAngleX", "ParamAngleY"],
|
|
2903
|
+
steps: Array.from({ length: n }, (_, j) => {
|
|
2904
|
+
const { x, y } = boxAngles(j / SWEEP_CLOCK_HZ);
|
|
2905
|
+
return { ParamAngleX: x, ParamAngleY: y };
|
|
2906
|
+
}),
|
|
2907
|
+
durationS
|
|
2908
|
+
};
|
|
2909
|
+
}
|
|
2699
2910
|
function eyeRowModelPx(model) {
|
|
2700
2911
|
const landed = landParts(model, {}, ["eye_L", "eye_R"]);
|
|
2701
2912
|
const l = landed.get("eye_L");
|
|
@@ -2720,35 +2931,44 @@ function physicsOutputIds(model) {
|
|
|
2720
2931
|
}
|
|
2721
2932
|
return [...ids];
|
|
2722
2933
|
}
|
|
2723
|
-
function
|
|
2934
|
+
function turnSheetFrames(steps, frames) {
|
|
2724
2935
|
const onLeg = [];
|
|
2725
|
-
for (let k = 0; k <
|
|
2936
|
+
for (let k = 0; k < frames; k++) {
|
|
2726
2937
|
const t = k / SWEEP_FPS;
|
|
2727
2938
|
if (t >= LEG_FROM_S && t <= LEG_TO_S) onLeg.push(k);
|
|
2728
2939
|
}
|
|
2940
|
+
const x = (k) => steps[CAPTURE_EVERY * k].ParamAngleX;
|
|
2729
2941
|
const picked = [];
|
|
2730
2942
|
for (const target2 of SHEET_THETAS) {
|
|
2731
2943
|
let best = onLeg[0];
|
|
2732
2944
|
for (const k of onLeg) {
|
|
2733
|
-
if (Math.abs(
|
|
2734
|
-
best = k;
|
|
2735
|
-
}
|
|
2945
|
+
if (Math.abs(x(k) - target2) < Math.abs(x(best) - target2)) best = k;
|
|
2736
2946
|
}
|
|
2737
2947
|
if (!picked.includes(best)) picked.push(best);
|
|
2738
2948
|
}
|
|
2739
2949
|
return picked.sort((a, b) => a - b);
|
|
2740
2950
|
}
|
|
2741
|
-
function
|
|
2742
|
-
|
|
2951
|
+
function boxSheetFrames(steps, frames) {
|
|
2952
|
+
return BOX_SHEET_STOPS.map(([sx, sy]) => {
|
|
2953
|
+
const miss = (k) => {
|
|
2954
|
+
const s = steps[CAPTURE_EVERY * k];
|
|
2955
|
+
return Math.abs(s.ParamAngleX - sx) + Math.abs(s.ParamAngleY - sy);
|
|
2956
|
+
};
|
|
2957
|
+
let best = 0;
|
|
2958
|
+
for (let k = 1; k < frames; k++) {
|
|
2959
|
+
if (miss(k) < miss(best)) best = k;
|
|
2960
|
+
}
|
|
2961
|
+
return best;
|
|
2962
|
+
});
|
|
2963
|
+
}
|
|
2964
|
+
function signedDeg(angle) {
|
|
2965
|
+
const rounded = Math.round(angle * 10) / 10 + 0;
|
|
2743
2966
|
const deg = rounded.toFixed(1);
|
|
2744
|
-
|
|
2745
|
-
return `\u03B8 ${signed2}\xB0 t ${t.toFixed(2)} s`;
|
|
2967
|
+
return rounded > 0 ? `+${deg}` : deg.replace("-", "\u2212");
|
|
2746
2968
|
}
|
|
2747
|
-
function sweepSpec(model, crop) {
|
|
2748
|
-
const
|
|
2749
|
-
|
|
2750
|
-
(_, j) => turnTheta(j / SWEEP_CLOCK_HZ)
|
|
2751
|
-
);
|
|
2969
|
+
function sweepSpec(model, preset, crop) {
|
|
2970
|
+
const { parameters, steps, durationS } = schedule(preset);
|
|
2971
|
+
const frameCount = durationS * SWEEP_FPS;
|
|
2752
2972
|
const dw = crop ? crop.dw : BUST_SIZE;
|
|
2753
2973
|
const dh = crop ? crop.dh : BUST_SIZE;
|
|
2754
2974
|
const m = SHEET_MARGIN;
|
|
@@ -2758,29 +2978,38 @@ function sweepSpec(model, crop) {
|
|
|
2758
2978
|
(SHEET_MAX_SIDE - 2 * m) / (3 * dw),
|
|
2759
2979
|
(SHEET_MAX_SIDE - 2 * m - 3 * b) / (3 * dh)
|
|
2760
2980
|
);
|
|
2761
|
-
const frames =
|
|
2981
|
+
const frames = preset === "turn" ? turnSheetFrames(steps, frameCount) : boxSheetFrames(steps, frameCount);
|
|
2982
|
+
const labelOf = (k) => {
|
|
2983
|
+
const s = steps[CAPTURE_EVERY * k];
|
|
2984
|
+
const t = (k / SWEEP_FPS).toFixed(2);
|
|
2985
|
+
return preset === "turn" ? `\u03B8 ${signedDeg(s.ParamAngleX)}\xB0 t ${t} s` : `X ${signedDeg(s.ParamAngleX)}\xB0 Y ${signedDeg(s.ParamAngleY)}\xB0 t ${t} s`;
|
|
2986
|
+
};
|
|
2762
2987
|
const { width: W, height: H } = model.canvas;
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2988
|
+
let kymograph;
|
|
2989
|
+
if (preset === "turn") {
|
|
2990
|
+
const yModel = eyeRowModelPx(model);
|
|
2991
|
+
let row = Math.round(dh / 2);
|
|
2992
|
+
let at = "middle";
|
|
2993
|
+
if (yModel !== void 0) {
|
|
2994
|
+
const y0 = bustPadY(W, H);
|
|
2995
|
+
const s = BUST_SIZE / W;
|
|
2996
|
+
const eyeRow = Math.round(
|
|
2997
|
+
crop ? (y0 + yModel * s - crop.sy) * crop.dh / crop.sh : y0 + yModel * s
|
|
2998
|
+
);
|
|
2999
|
+
if (eyeRow >= 1 && eyeRow <= dh - 2) {
|
|
3000
|
+
row = eyeRow;
|
|
3001
|
+
at = "eye row";
|
|
3002
|
+
}
|
|
2775
3003
|
}
|
|
3004
|
+
kymograph = { row, band: KYMOGRAPH_BAND, at };
|
|
2776
3005
|
}
|
|
2777
3006
|
return {
|
|
2778
|
-
|
|
3007
|
+
parameters,
|
|
2779
3008
|
frameMs: SWEEP_FRAME_MS,
|
|
2780
3009
|
warmup: SWEEP_WARMUP_S * SWEEP_CLOCK_HZ,
|
|
2781
|
-
|
|
3010
|
+
steps,
|
|
2782
3011
|
captureEvery: CAPTURE_EVERY,
|
|
2783
|
-
frames:
|
|
3012
|
+
frames: frameCount,
|
|
2784
3013
|
frame: { width: dw, height: dh },
|
|
2785
3014
|
physicsOutputs: physicsOutputIds(model),
|
|
2786
3015
|
sheet: {
|
|
@@ -2791,11 +3020,9 @@ function sweepSpec(model, crop) {
|
|
|
2791
3020
|
},
|
|
2792
3021
|
margin: m,
|
|
2793
3022
|
labelBand: b,
|
|
2794
|
-
labels: frames.map(
|
|
2795
|
-
(k) => sheetLabel(thetas[CAPTURE_EVERY * k], k / SWEEP_FPS)
|
|
2796
|
-
)
|
|
3023
|
+
labels: frames.map(labelOf)
|
|
2797
3024
|
},
|
|
2798
|
-
kymograph
|
|
3025
|
+
kymograph,
|
|
2799
3026
|
crop
|
|
2800
3027
|
};
|
|
2801
3028
|
}
|
|
@@ -2805,7 +3032,7 @@ function flipbookHtml(manifest) {
|
|
|
2805
3032
|
<html lang="en">
|
|
2806
3033
|
<head>
|
|
2807
3034
|
<meta charset="utf-8">
|
|
2808
|
-
<title
|
|
3035
|
+
<title>${manifest.preset} sweep</title>
|
|
2809
3036
|
<style>
|
|
2810
3037
|
body { font: 14px system-ui, sans-serif; margin: 16px; background: #222; color: #eee; }
|
|
2811
3038
|
.row { display: flex; gap: 16px; align-items: flex-start; }
|
|
@@ -2838,13 +3065,18 @@ img { max-width: 48vw; height: auto; background: #444; }
|
|
|
2838
3065
|
var playing = true;
|
|
2839
3066
|
scrub.max = String(n - 1);
|
|
2840
3067
|
if (b) { bi.style.display = "block"; }
|
|
3068
|
+
function short(id) {
|
|
3069
|
+
return id === "ParamAngleX" ? "X" : id === "ParamAngleY" ? "Y" : id;
|
|
3070
|
+
}
|
|
2841
3071
|
function show(k) {
|
|
2842
3072
|
i = k;
|
|
2843
3073
|
var f = m.frames[k];
|
|
2844
3074
|
a.src = f.file;
|
|
2845
3075
|
if (b) { bi.src = b.replace(/\\/$/, "") + "/" + f.file; }
|
|
2846
3076
|
scrub.value = String(k);
|
|
2847
|
-
readout.textContent = "frame " + k +
|
|
3077
|
+
readout.textContent = "frame " + k + m.parameters.map(function (id) {
|
|
3078
|
+
return " " + short(id) + " " + f.values[id].toFixed(1) + "\\u00b0";
|
|
3079
|
+
}).join("") + " t " + f.t.toFixed(2) + " s";
|
|
2848
3080
|
}
|
|
2849
3081
|
play.addEventListener("click", function () {
|
|
2850
3082
|
playing = !playing;
|
|
@@ -2863,7 +3095,14 @@ img { max-width: 48vw; height: auto; background: #444; }
|
|
|
2863
3095
|
</html>
|
|
2864
3096
|
`;
|
|
2865
3097
|
}
|
|
2866
|
-
|
|
3098
|
+
var STALE_FILE = /^f\d{3}\.png$/;
|
|
3099
|
+
var STALE_NAMES = [
|
|
3100
|
+
"kymograph.png",
|
|
3101
|
+
"sheet.png",
|
|
3102
|
+
"manifest.json",
|
|
3103
|
+
"index.html"
|
|
3104
|
+
];
|
|
3105
|
+
function prepareSweepDir(outDir, name, label) {
|
|
2867
3106
|
const dir = path4.join(outDir, name);
|
|
2868
3107
|
try {
|
|
2869
3108
|
fs3.mkdirSync(dir);
|
|
@@ -2874,13 +3113,19 @@ function prepareSweepDir(outDir, name) {
|
|
|
2874
3113
|
}
|
|
2875
3114
|
const stat = fs3.lstatSync(dir);
|
|
2876
3115
|
if (stat.isSymbolicLink()) {
|
|
2877
|
-
throw new AutoRigInputError(
|
|
3116
|
+
throw new AutoRigInputError(`${label}.name names ${dir}, a symbolic link`);
|
|
2878
3117
|
}
|
|
2879
3118
|
if (!stat.isDirectory()) {
|
|
2880
|
-
throw new AutoRigInputError(
|
|
3119
|
+
throw new AutoRigInputError(`${label}.name names ${dir}, not a directory`);
|
|
3120
|
+
}
|
|
3121
|
+
return confineToWorkingDirectory(process.cwd(), dir, "sweep dir", name);
|
|
3122
|
+
}
|
|
3123
|
+
function clearSweepDir(real) {
|
|
3124
|
+
for (const entry of fs3.readdirSync(real)) {
|
|
3125
|
+
if (STALE_FILE.test(entry) || STALE_NAMES.includes(entry)) {
|
|
3126
|
+
fs3.rmSync(path4.join(real, entry));
|
|
3127
|
+
}
|
|
2881
3128
|
}
|
|
2882
|
-
const real = confineToWorkingDirectory(process.cwd(), dir, "sweep dir", name);
|
|
2883
|
-
return real;
|
|
2884
3129
|
}
|
|
2885
3130
|
|
|
2886
3131
|
// src/tools.ts
|
|
@@ -3906,11 +4151,189 @@ function capWarning(arm, g, body) {
|
|
|
3906
4151
|
return `${arm}: its shoulder cap reaches ${px(overlap)} px under the torso's edge on its pivot row (y=${row}), under half its radius (${px(need)} px) \u2014 a gap opens beside the shoulder once the arm raises. Move layout.${arm}.cx ${Math.ceil(need - overlap)} px toward the body (free).`;
|
|
3907
4152
|
}
|
|
3908
4153
|
|
|
4154
|
+
// src/measure-hair-side.ts
|
|
4155
|
+
import {
|
|
4156
|
+
createLayerSetMeasurer as createLayerSetMeasurer3
|
|
4157
|
+
} from "@ikijs/editor";
|
|
4158
|
+
var LOCK_ROLES = ["hair_side_R", "hair_side_L"];
|
|
4159
|
+
var VISIBLE_MIN_PX = 3;
|
|
4160
|
+
var LEAN_HH = 0.12;
|
|
4161
|
+
var TWO_LOCKS_RUN = 0.25;
|
|
4162
|
+
var TWO_LOCKS_GAP = 0.1;
|
|
4163
|
+
function covers(runs, x) {
|
|
4164
|
+
for (let i = 0; i + 1 < runs.length; i += 2) {
|
|
4165
|
+
if (x >= runs[i] && x < runs[i + 1]) return true;
|
|
4166
|
+
}
|
|
4167
|
+
return false;
|
|
4168
|
+
}
|
|
4169
|
+
function runsAt(layer, y) {
|
|
4170
|
+
return layer?.rowRuns?.[y - layer.bbox.y] ?? [];
|
|
4171
|
+
}
|
|
4172
|
+
function opaqueRows(layer) {
|
|
4173
|
+
const runs = layer.rowRuns ?? [];
|
|
4174
|
+
const top = runs.findIndex((r) => r.length > 0);
|
|
4175
|
+
if (top < 0) return void 0;
|
|
4176
|
+
let bottom = runs.length - 1;
|
|
4177
|
+
while (runs[bottom].length === 0) bottom--;
|
|
4178
|
+
return { top: layer.bbox.y + top, bottom: layer.bbox.y + bottom };
|
|
4179
|
+
}
|
|
4180
|
+
async function hairSideWarnings(absDir, layers) {
|
|
4181
|
+
const present = LOCK_ROLES.filter((r) => layers[r] !== void 0);
|
|
4182
|
+
if (present.length === 0) return [];
|
|
4183
|
+
const warnings = [];
|
|
4184
|
+
if (layers.hair_front === void 0) {
|
|
4185
|
+
for (const role of present) {
|
|
4186
|
+
warnings.push(
|
|
4187
|
+
`${role}: needs hair_front \u2014 the rig refuses a lock without the bangs its root hides under. Remove hair_side.png and recompose (free), or draw hair_front.png. Billed.`
|
|
4188
|
+
);
|
|
4189
|
+
}
|
|
4190
|
+
return warnings;
|
|
4191
|
+
}
|
|
4192
|
+
const ref = layers.hair_front;
|
|
4193
|
+
let mismatched = false;
|
|
4194
|
+
for (const r of [...present, "hair_back", "face"]) {
|
|
4195
|
+
const stats = layers[r];
|
|
4196
|
+
if (stats === void 0) continue;
|
|
4197
|
+
if (stats.canvasW !== ref.canvasW || stats.canvasH !== ref.canvasH) {
|
|
4198
|
+
mismatched = true;
|
|
4199
|
+
warnings.push(
|
|
4200
|
+
`${r}: its canvas ${stats.canvasW}x${stats.canvasH} differs from hair_front's ${ref.canvasW}x${ref.canvasH} \u2014 auto_rig_from_layers refuses layers of different sizes; recompose them together.`
|
|
4201
|
+
);
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
if (mismatched) return warnings;
|
|
4205
|
+
const measurer = createLayerSetMeasurer3({
|
|
4206
|
+
width: ref.canvasW,
|
|
4207
|
+
height: ref.canvasH
|
|
4208
|
+
});
|
|
4209
|
+
const read = (role) => layers[role] === void 0 ? void 0 : measured(measurer, absDir, role);
|
|
4210
|
+
const front = await read("hair_front");
|
|
4211
|
+
const back = await read("hair_back");
|
|
4212
|
+
const face = await read("face");
|
|
4213
|
+
const axisX = face ? face.bbox.x + face.bbox.w / 2 : ref.canvasW / 2;
|
|
4214
|
+
const locks = /* @__PURE__ */ new Map();
|
|
4215
|
+
for (const role of present) {
|
|
4216
|
+
const lock = await measured(measurer, absDir, role);
|
|
4217
|
+
locks.set(role, lock);
|
|
4218
|
+
const side = lock.bbox.x + lock.bbox.w / 2 < axisX ? -1 : 1;
|
|
4219
|
+
const eyeRole = ["eye_L", "eye_R"].find(
|
|
4220
|
+
(r) => layers[r] !== void 0 && (layers[r].bboxCx < axisX ? -1 : 1) === side
|
|
4221
|
+
);
|
|
4222
|
+
const eye = eyeRole === void 0 ? void 0 : layers[eyeRole];
|
|
4223
|
+
const root = rootWarning(role, lock, front);
|
|
4224
|
+
if (root !== void 0) warnings.push(root);
|
|
4225
|
+
if (eyeRole !== void 0 && eye !== void 0) {
|
|
4226
|
+
const w = eyeCornerWarning(role, lock, side, eyeRole, eye);
|
|
4227
|
+
if (w !== void 0) warnings.push(w);
|
|
4228
|
+
}
|
|
4229
|
+
const rowEye = eye ?? layers.eye_L ?? layers.eye_R;
|
|
4230
|
+
if (face !== void 0 && rowEye !== void 0) {
|
|
4231
|
+
const w = leanWarning(role, lock, side, face, back, rowEye);
|
|
4232
|
+
if (w !== void 0) warnings.push(w);
|
|
4233
|
+
}
|
|
4234
|
+
}
|
|
4235
|
+
if (drawsTwoLocks(locks.get("hair_side_R") ?? locks.get(present[0]))) {
|
|
4236
|
+
warnings.push(
|
|
4237
|
+
`hair_side.png draws two locks \u2014 draw ONE lock, the screen-left one; the composer mirrors it into hair_side_L. Billed.`
|
|
4238
|
+
);
|
|
4239
|
+
}
|
|
4240
|
+
return warnings;
|
|
4241
|
+
}
|
|
4242
|
+
function rootWarning(role, lock, front) {
|
|
4243
|
+
const y = opaqueRows(lock)?.top;
|
|
4244
|
+
if (y === void 0) return void 0;
|
|
4245
|
+
const frontRuns = runsAt(front, y);
|
|
4246
|
+
const lockRuns = runsAt(lock, y);
|
|
4247
|
+
let shown = 0;
|
|
4248
|
+
for (let i = 0; i + 1 < lockRuns.length; i += 2) {
|
|
4249
|
+
let stretch = 0;
|
|
4250
|
+
for (let x = lockRuns[i]; x <= lockRuns[i + 1]; x++) {
|
|
4251
|
+
if (x < lockRuns[i + 1] && !covers(frontRuns, x)) {
|
|
4252
|
+
stretch++;
|
|
4253
|
+
continue;
|
|
4254
|
+
}
|
|
4255
|
+
if (stretch >= VISIBLE_MIN_PX) shown += stretch;
|
|
4256
|
+
stretch = 0;
|
|
4257
|
+
}
|
|
4258
|
+
}
|
|
4259
|
+
if (shown === 0) return void 0;
|
|
4260
|
+
return `${role}: its top row (canvas y ${y}) shows past hair_front on ${shown} px \u2014 the root is visible at rest. Move it under the bangs \u2014 up (layout.${role}.cy) or toward the face (layout.${role}.cx) (free), or regenerate hair_side.png with a longer hidden root. Billed.`;
|
|
4261
|
+
}
|
|
4262
|
+
function eyeCornerWarning(role, lock, side, eyeRole, eye) {
|
|
4263
|
+
const row = Math.floor(eye.bboxCy);
|
|
4264
|
+
const corner = side < 0 ? eye.marginLeft : eye.marginLeft + eye.w - 1;
|
|
4265
|
+
const runs = runsAt(lock, row);
|
|
4266
|
+
let overlap = 0;
|
|
4267
|
+
for (let i = 0; i + 1 < runs.length; i += 2) {
|
|
4268
|
+
if (corner < runs[i] || corner >= runs[i + 1]) continue;
|
|
4269
|
+
overlap = side < 0 ? runs[i + 1] - corner : corner - runs[i] + 1;
|
|
4270
|
+
}
|
|
4271
|
+
if (overlap < VISIBLE_MIN_PX) return void 0;
|
|
4272
|
+
return `${role}: covers ${eyeRole}'s outer corner at rest (canvas x ${corner}, y ${row}) by ${overlap} px \u2014 the eye's outer tail may only slide under it on the turn. Move layout.${role}.cx ${overlap} px ${side < 0 ? "left" : "right"}, outward (free), or regenerate it narrower. Billed.`;
|
|
4273
|
+
}
|
|
4274
|
+
function leanWarning(role, lock, side, face, back, eye) {
|
|
4275
|
+
const faceRows = opaqueRows(face);
|
|
4276
|
+
const lockRows = opaqueRows(lock);
|
|
4277
|
+
if (faceRows === void 0 || lockRows === void 0) return void 0;
|
|
4278
|
+
const faceBottom = faceRows.bottom;
|
|
4279
|
+
const lean = Math.round(LEAN_HH * (faceBottom - Math.floor(eye.bboxCy)));
|
|
4280
|
+
if (lean < 1) return void 0;
|
|
4281
|
+
const bare = /* @__PURE__ */ new Set();
|
|
4282
|
+
const rows = /* @__PURE__ */ new Set();
|
|
4283
|
+
for (let y = lockRows.top; y <= Math.min(lockRows.bottom, faceBottom); y++) {
|
|
4284
|
+
const runs = runsAt(lock, y);
|
|
4285
|
+
if (runs.length === 0) continue;
|
|
4286
|
+
const from = side < 0 ? runs[0] : runs[runs.length - 2];
|
|
4287
|
+
const to = side < 0 ? runs[1] : runs[runs.length - 1];
|
|
4288
|
+
const start = side < 0 ? from : Math.max(from, to - lean);
|
|
4289
|
+
const end = side < 0 ? Math.min(to, from + lean) : to;
|
|
4290
|
+
const faceRuns = runsAt(face, y);
|
|
4291
|
+
const backRuns = runsAt(back, y);
|
|
4292
|
+
for (let x = start; x < end; x++) {
|
|
4293
|
+
if (covers(faceRuns, x) || covers(backRuns, x)) continue;
|
|
4294
|
+
bare.add(x);
|
|
4295
|
+
rows.add(y);
|
|
4296
|
+
}
|
|
4297
|
+
}
|
|
4298
|
+
if (bare.size === 0) return void 0;
|
|
4299
|
+
const cols = [...bare].sort((a, b) => a - b);
|
|
4300
|
+
const ys = [...rows].sort((a, b) => a - b);
|
|
4301
|
+
const where = `leaves bare pixels spanning columns ${cols[0]}\u2013${cols[cols.length - 1]}, rows ${ys[0]}\u2013${ys[ys.length - 1]}`;
|
|
4302
|
+
const lead = `${role}: when the head turns away from it the lock leans inward about ${lean} px and ${where}, where`;
|
|
4303
|
+
if (back === void 0) {
|
|
4304
|
+
return `${lead} the face is not painted \u2014 draw hair_back.png behind the locks. Billed.`;
|
|
4305
|
+
}
|
|
4306
|
+
return `${lead} neither hair_back nor the face is painted \u2014 widen hair_back there (layout.hair_back.w) (free), or regenerate it fuller behind the locks. Billed.`;
|
|
4307
|
+
}
|
|
4308
|
+
function drawsTwoLocks(lock) {
|
|
4309
|
+
const w = lock.bbox.w;
|
|
4310
|
+
const col = new Array(w).fill(false);
|
|
4311
|
+
for (const runs of lock.rowRuns ?? []) {
|
|
4312
|
+
for (let i = 0; i + 1 < runs.length; i += 2) {
|
|
4313
|
+
for (let x = runs[i]; x < runs[i + 1]; x++) col[x - lock.bbox.x] = true;
|
|
4314
|
+
}
|
|
4315
|
+
}
|
|
4316
|
+
const big = [];
|
|
4317
|
+
let start = -1;
|
|
4318
|
+
for (let x = 0; x <= w; x++) {
|
|
4319
|
+
if (x < w && col[x]) {
|
|
4320
|
+
if (start < 0) start = x;
|
|
4321
|
+
} else if (start >= 0) {
|
|
4322
|
+
if (x - start >= TWO_LOCKS_RUN * w) big.push([start, x]);
|
|
4323
|
+
start = -1;
|
|
4324
|
+
}
|
|
4325
|
+
}
|
|
4326
|
+
for (let i = 1; i < big.length; i++) {
|
|
4327
|
+
if (big[i][0] - big[i - 1][1] >= TWO_LOCKS_GAP * w) return true;
|
|
4328
|
+
}
|
|
4329
|
+
return false;
|
|
4330
|
+
}
|
|
4331
|
+
|
|
3909
4332
|
// src/measure-forearm-pose.ts
|
|
3910
4333
|
import {
|
|
3911
4334
|
LayerGeometryError as LayerGeometryError3,
|
|
3912
4335
|
armGeometry as armGeometry2,
|
|
3913
|
-
createLayerSetMeasurer as
|
|
4336
|
+
createLayerSetMeasurer as createLayerSetMeasurer4,
|
|
3914
4337
|
forearmPoseGeometry
|
|
3915
4338
|
} from "@ikijs/editor";
|
|
3916
4339
|
var POSE_ROLES = ["forearm_pose_L", "forearm_pose_R"];
|
|
@@ -3946,7 +4369,7 @@ async function forearmPoseWarnings(absDir, layers) {
|
|
|
3946
4369
|
continue;
|
|
3947
4370
|
}
|
|
3948
4371
|
if (layers.body === void 0) continue;
|
|
3949
|
-
const measurer =
|
|
4372
|
+
const measurer = createLayerSetMeasurer4({
|
|
3950
4373
|
width: stats.canvasW,
|
|
3951
4374
|
height: stats.canvasH
|
|
3952
4375
|
});
|
|
@@ -4005,7 +4428,7 @@ import {
|
|
|
4005
4428
|
LIP_ROLES,
|
|
4006
4429
|
LayerGeometryError as LayerGeometryError4,
|
|
4007
4430
|
columnRuns as columnRuns2,
|
|
4008
|
-
createLayerSetMeasurer as
|
|
4431
|
+
createLayerSetMeasurer as createLayerSetMeasurer6,
|
|
4009
4432
|
isLipInsideRole,
|
|
4010
4433
|
mouthOpening as mouthOpening2
|
|
4011
4434
|
} from "@ikijs/editor";
|
|
@@ -4015,7 +4438,7 @@ import sharp2 from "sharp";
|
|
|
4015
4438
|
import {
|
|
4016
4439
|
ALPHA_OPAQUE as ALPHA_OPAQUE3,
|
|
4017
4440
|
columnRuns,
|
|
4018
|
-
createLayerSetMeasurer as
|
|
4441
|
+
createLayerSetMeasurer as createLayerSetMeasurer5,
|
|
4019
4442
|
mouthOpening,
|
|
4020
4443
|
mouthRestShift
|
|
4021
4444
|
} from "@ikijs/editor";
|
|
@@ -4460,7 +4883,7 @@ function enclosedHole(frame, w, h) {
|
|
|
4460
4883
|
return { label, main, box: box2 };
|
|
4461
4884
|
}
|
|
4462
4885
|
function measureLips(layers, w, h) {
|
|
4463
|
-
const measurer =
|
|
4886
|
+
const measurer = createLayerSetMeasurer5({ width: w, height: h });
|
|
4464
4887
|
return new Map(
|
|
4465
4888
|
Object.entries(layers).map(([role, rgba]) => [
|
|
4466
4889
|
role,
|
|
@@ -4740,7 +5163,7 @@ async function lipWarnings(absDir, layers) {
|
|
|
4740
5163
|
);
|
|
4741
5164
|
}
|
|
4742
5165
|
}
|
|
4743
|
-
const measurer =
|
|
5166
|
+
const measurer = createLayerSetMeasurer6({
|
|
4744
5167
|
width: inner.canvasW,
|
|
4745
5168
|
height: inner.canvasH
|
|
4746
5169
|
});
|
|
@@ -5030,6 +5453,7 @@ async function measureDir(absDir, noseSpeck) {
|
|
|
5030
5453
|
warnings.push(...await forearmPoseWarnings(absDir, layers));
|
|
5031
5454
|
const lip = await lipWarnings(absDir, layers);
|
|
5032
5455
|
warnings.push(...lip.warnings);
|
|
5456
|
+
warnings.push(...await hairSideWarnings(absDir, layers));
|
|
5033
5457
|
for (const side of ["L", "R"]) {
|
|
5034
5458
|
const eye = layers[`eye_${side}`];
|
|
5035
5459
|
const iris = layers[`iris_${side}`];
|
|
@@ -5173,14 +5597,14 @@ import sharp3 from "sharp";
|
|
|
5173
5597
|
import {
|
|
5174
5598
|
LayerGeometryError as LayerGeometryError5,
|
|
5175
5599
|
armGeometry as armGeometry3,
|
|
5176
|
-
createLayerSetMeasurer as
|
|
5600
|
+
createLayerSetMeasurer as createLayerSetMeasurer7,
|
|
5177
5601
|
forearmPoseGeometry as forearmPoseGeometry2
|
|
5178
5602
|
} from "@ikijs/editor";
|
|
5179
5603
|
var ARM_WIDTH = 0.4;
|
|
5180
5604
|
var SHOULDER_DROP = 0.12;
|
|
5181
5605
|
async function armPlacement(role, cfg, part, body) {
|
|
5182
5606
|
const { data } = await sharp3(part.buf).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
5183
|
-
const layer =
|
|
5607
|
+
const layer = createLayerSetMeasurer7({ width: part.w, height: part.h }).add({
|
|
5184
5608
|
role,
|
|
5185
5609
|
fileName: "arm.png",
|
|
5186
5610
|
rgba: data
|
|
@@ -5221,7 +5645,7 @@ async function armPlacement(role, cfg, part, body) {
|
|
|
5221
5645
|
}
|
|
5222
5646
|
async function poseGeometryOf(role, png, size, when) {
|
|
5223
5647
|
const { data } = await sharp3(png).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
5224
|
-
const layer =
|
|
5648
|
+
const layer = createLayerSetMeasurer7({
|
|
5225
5649
|
width: size.w,
|
|
5226
5650
|
height: size.h
|
|
5227
5651
|
}).add({ role, fileName: "forearm_pose.png", rgba: data });
|
|
@@ -5347,6 +5771,23 @@ var DEFAULT_LAYOUT = {
|
|
|
5347
5771
|
// prettier-ignore
|
|
5348
5772
|
brow_L: { src: "brow.png", cx: 645, cy: 405, w: 105, mirror: false },
|
|
5349
5773
|
brow_R: { src: "brow.png", cx: 455, cy: 405, w: 105, mirror: true },
|
|
5774
|
+
// The front side locks, one part for both: hair_side_R (screen left) takes
|
|
5775
|
+
// hair_side.png as drawn and hair_side_L mirrors it, like the blush. They
|
|
5776
|
+
// draw over the face, brows and lashes and under the bangs. Mint's tuned
|
|
5777
|
+
// placement (cy 545 at mint's face cy 431, carried to the default face:
|
|
5778
|
+
// 437 + 114 = 551), tuned per character through `layout.hair_side_*`: the
|
|
5779
|
+
// lock's root top lies above the brow row (405) so the bangs' temple hides it
|
|
5780
|
+
// (for a 1:5 lock, whose height follows the image's aspect: w 90 is 450 tall,
|
|
5781
|
+
// so cy 551 puts the top at 326), and the lock runs from the temple over the
|
|
5782
|
+
// front of the ear and down along the cheek's edge, the ear's rim and lobe
|
|
5783
|
+
// showing beside it. Its box overlaps the eye's by about 15 px at the
|
|
5784
|
+
// default face, fine only because a drawn lock's root tapers (the measure's "covers
|
|
5785
|
+
// the eye's outer corner" check catches a lock that does not).
|
|
5786
|
+
// OPTIONAL: a parts dir without it composes.
|
|
5787
|
+
hair_side_L: { src: "hair_side.png", cx: 715, cy: 551, w: 90, optional: true, mirror: true },
|
|
5788
|
+
// prettier-ignore
|
|
5789
|
+
hair_side_R: { src: "hair_side.png", cx: 385, cy: 551, w: 90, optional: true, mirror: false },
|
|
5790
|
+
// prettier-ignore
|
|
5350
5791
|
hair_front: { src: "hair_front.png", cx: 550, cy: 425, w: 660 },
|
|
5351
5792
|
// The pose forearms, one drawing for both: forearm_pose_R (screen left)
|
|
5352
5793
|
// takes forearm_pose.png as drawn and forearm_pose_L mirrors it, like the
|
|
@@ -5385,6 +5826,8 @@ var ORDER = [
|
|
|
5385
5826
|
"lash_R",
|
|
5386
5827
|
"brow_L",
|
|
5387
5828
|
"brow_R",
|
|
5829
|
+
"hair_side_L",
|
|
5830
|
+
"hair_side_R",
|
|
5388
5831
|
"hair_front",
|
|
5389
5832
|
"forearm_pose_L",
|
|
5390
5833
|
"forearm_pose_R"
|
|
@@ -5409,7 +5852,9 @@ var FACE_FEATURES = [
|
|
|
5409
5852
|
"lash_L",
|
|
5410
5853
|
"lash_R",
|
|
5411
5854
|
"brow_L",
|
|
5412
|
-
"brow_R"
|
|
5855
|
+
"brow_R",
|
|
5856
|
+
"hair_side_L",
|
|
5857
|
+
"hair_side_R"
|
|
5413
5858
|
];
|
|
5414
5859
|
function resolveLayout(overrides, canvas) {
|
|
5415
5860
|
const resolved = { ...DEFAULT_LAYOUT };
|
|
@@ -6177,6 +6622,40 @@ async function composeLayersFromParts(input) {
|
|
|
6177
6622
|
}
|
|
6178
6623
|
}
|
|
6179
6624
|
|
|
6625
|
+
// src/hair-side-report.ts
|
|
6626
|
+
function signedPx(px2) {
|
|
6627
|
+
const s = px2.toFixed(1);
|
|
6628
|
+
if (s === "-0.0") return "+0.0";
|
|
6629
|
+
return s.startsWith("-") ? s : `+${s}`;
|
|
6630
|
+
}
|
|
6631
|
+
function formatHairSideReport(hairSide, canvas) {
|
|
6632
|
+
if (hairSide === void 0) return [];
|
|
6633
|
+
return [hairSide.left, hairSide.right].flatMap(
|
|
6634
|
+
(room) => room === void 0 ? [] : roomLines(room, canvas)
|
|
6635
|
+
);
|
|
6636
|
+
}
|
|
6637
|
+
function roomLines(room, canvas) {
|
|
6638
|
+
const { role, cover, tail, unavailable } = room;
|
|
6639
|
+
if (unavailable !== void 0) {
|
|
6640
|
+
return [`HAIRSIDE ${role}: unavailable \u2014 ${unavailable}`];
|
|
6641
|
+
}
|
|
6642
|
+
const lines = [];
|
|
6643
|
+
if (cover !== void 0) {
|
|
6644
|
+
const row = Math.floor(canvas.height / 2 - cover.y);
|
|
6645
|
+
lines.push(
|
|
6646
|
+
`HAIRSIDE cover ${role}: the lock's outer edge ${signedPx(cover.px)} model px outside the head's edge at ParamAngleX=${cover.deg}, ${signedPx(cover.rest)} at rest (least over the rows it covers at rest, at model y ${cover.y.toFixed(1)}, row ${row} model px from the top; negative: the turn bares cheek the lock hides at rest)`
|
|
6647
|
+
);
|
|
6648
|
+
}
|
|
6649
|
+
if (tail !== void 0) {
|
|
6650
|
+
const lash = tail.lashToLock === void 0 ? "" : ` / lash ${signedPx(tail.lashToLock)} model px`;
|
|
6651
|
+
lines.push(
|
|
6652
|
+
`HAIRSIDE tail ${role}: eye ${signedPx(tail.eyeToLock)} model px${lash} from the lock's face-side edge at ParamAngleX=${tail.deg} (negative: under the lock, intended), corner ${signedPx(tail.eyeToPlate)} model px from the head's edge (positive: inside it; negative: past it)`
|
|
6653
|
+
);
|
|
6654
|
+
}
|
|
6655
|
+
if (lines.length === 0) lines.push(`HAIRSIDE ${role}: no cover or tail row`);
|
|
6656
|
+
return lines;
|
|
6657
|
+
}
|
|
6658
|
+
|
|
6180
6659
|
// src/physics-report.ts
|
|
6181
6660
|
function formatPhysicsReport(report) {
|
|
6182
6661
|
if (report.targets.length === 0) return ["PHYSICS: no rigs"];
|
|
@@ -6204,7 +6683,7 @@ function formatPatchReports(reports) {
|
|
|
6204
6683
|
});
|
|
6205
6684
|
}
|
|
6206
6685
|
function createIkiMcpServer() {
|
|
6207
|
-
const server = new McpServer({ name: "iki", version: "0.
|
|
6686
|
+
const server = new McpServer({ name: "iki", version: "0.33.0" });
|
|
6208
6687
|
server.registerTool(
|
|
6209
6688
|
"validate_iki",
|
|
6210
6689
|
{
|
|
@@ -6296,7 +6775,7 @@ function createIkiMcpServer() {
|
|
|
6296
6775
|
server.registerTool(
|
|
6297
6776
|
"auto_rig_from_layers",
|
|
6298
6777
|
{
|
|
6299
|
-
description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, mouth_tongue/mouth_teeth (only with the lip set: drawn under its lips and clipped to mouth_inner), etc. optional; an arm needs the body, a pose forearm needs its arm, and a partial lip set, one mixed with mouth/mouth_open, or mouth_tongue/mouth_teeth without it is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given. The result's `folds` is the written rig's fold report, printed after the path the way render_poses prints it, and report-only: a fold never refuses the rig. The `RIGPLAN:` line (the result's `rigPlan`: `effective`, `clamped`, `overriddenBy`) follows the path and precedes the `PATCH` lines. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output \u2014 a spring's, or each chain segment's \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. `patches` (see its field) adds displacements to existing keyform stops of the freshly generated rig; each op then prints one line between the path and the fold report \u2014 `PATCH <i> <target> at <Param=v \u2026>: <moved> of <of> points (cols a-b, rows c-d), largest move <maxPx> model px`, with `(vertices)` in place of the columns and rows for a mesh part \u2014 and the result's `patches` carries the same reports (`index`, `target`, `at`, `moved`, `of`, `cols`/`rows` for a grid, `maxPx`), present whenever `patches` was passed, `[]` included. An op the input schema accepts but the rig refuses comes back as `INVALID: patches[i]\u2026` and nothing is written; an op with a missing field or a field of the wrong type is the SDK's input validation error.",
|
|
6778
|
+
description: "Auto-rigs role-named PNG layers (face, eye_L/eye_R and either mouth or the lip set (mouth_inner + lip_lower + lip_upper, a mouth that folds open instead of crossfading) required; iris_L/R, brow_L/R, hair_front, body, arm_L/arm_R, forearm_pose_L/forearm_pose_R, hair_side_L/hair_side_R, mouth_tongue/mouth_teeth (only with the lip set: drawn under its lips and clipped to mouth_inner), etc. optional; an arm needs the body, a pose forearm needs its arm, a side lock needs hair_front, and a partial lip set, one mixed with mouth/mouth_open, or mouth_tongue/mouth_teeth without it is refused) into a renderable .iki written to disk. Pass full-canvas PNG file paths; returns the output path + summary (the model is NOT inlined). Filenames map to roles unless `fileName` is given. The result's `folds` is the written rig's fold report, printed after the path the way render_poses prints it, and report-only: a fold never refuses the rig. The `RIGPLAN:` line (the result's `rigPlan`: `effective`, `clamped`, `overriddenBy`) follows the path and precedes the `PATCH` lines. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output \u2014 a spring's, or each chain segment's \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. With side locks and a `nose` (which `turn` needs) the `HAIRSIDE` lines follow the `PHYSICS` lines (the result's `turn.hairSide`), each naming the lock's role, report-only as well. `patches` (see its field) adds displacements to existing keyform stops of the freshly generated rig; each op then prints one line between the path and the fold report \u2014 `PATCH <i> <target> at <Param=v \u2026>: <moved> of <of> points (cols a-b, rows c-d), largest move <maxPx> model px`, with `(vertices)` in place of the columns and rows for a mesh part \u2014 and the result's `patches` carries the same reports (`index`, `target`, `at`, `moved`, `of`, `cols`/`rows` for a grid, `maxPx`), present whenever `patches` was passed, `[]` included. An op the input schema accepts but the rig refuses comes back as `INVALID: patches[i]\u2026` and nothing is written; an op with a missing field or a field of the wrong type is the SDK's input validation error.",
|
|
6300
6779
|
inputSchema: {
|
|
6301
6780
|
layers: z.array(
|
|
6302
6781
|
z.object({
|
|
@@ -6373,7 +6852,8 @@ function createIkiMcpServer() {
|
|
|
6373
6852
|
formatRigPlanReport(r.rigPlan),
|
|
6374
6853
|
...formatPatchReports(r.patches ?? []),
|
|
6375
6854
|
...formatFoldReport(r.folds, r.canvas),
|
|
6376
|
-
...formatPhysicsReport(r.physics)
|
|
6855
|
+
...formatPhysicsReport(r.physics),
|
|
6856
|
+
...formatHairSideReport(r.turn?.hairSide, r.canvas)
|
|
6377
6857
|
].join("\n") : `INVALID: ${r.error}`;
|
|
6378
6858
|
return { content: [{ type: "text", text }], structuredContent: r };
|
|
6379
6859
|
} catch (err) {
|
|
@@ -6389,7 +6869,7 @@ function createIkiMcpServer() {
|
|
|
6389
6869
|
server.registerTool(
|
|
6390
6870
|
"compose_layers_from_parts",
|
|
6391
6871
|
{
|
|
6392
|
-
description: "Composes AI-generated part PNGs into canvas-aligned, role-named PNG layers on disk, ready for auto_rig_from_layers (the eyewhite split, alpha-trim/white-key, and placement pipeline the character-generation skill needs), with the same geometry report measure_layers returns standalone included inline. face, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid, the interior's light paint (luma 100 and over) written as mouth_tongue and mouth_teeth on the same frame, riding the opening's bottom and the upper line and clipped to the cavity (listed in `skipped` when the interior has none); the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default profile, but it has no nose to lead the turn, and `auto_rig_from_layers` fits no turn to the art (`turnTargets` is inert, no `turn` report). One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. A nose whose dense core is a speck \u2014 under a quarter of its trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole, and the inline report warns of it. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
|
|
6872
|
+
description: "Composes AI-generated part PNGs into canvas-aligned, role-named PNG layers on disk, ready for auto_rig_from_layers (the eyewhite split, alpha-trim/white-key, and placement pipeline the character-generation skill needs), with the same geometry report measure_layers returns standalone included inline. face, eyewhite, iris, brow, hair_front are required, with mouth.png \u2014 or the lip set's mouth_keyed.png (the open mouth, its inside painted flat #00FF00) + mouth_interior.png (the cavity, teeth and tongue alone), which the composer keys and splits into mouth_inner / lip_lower / lip_upper on one frame so auto_rig_from_layers folds the mouth open like the eyelid, the interior's light paint (luma 100 and over) written as mouth_tongue and mouth_teeth on the same frame, riding the opening's bottom and the upper line and clipped to the cavity (listed in `skipped` when the interior has none); the two routes cannot be mixed, one keyed file without the other is refused, and a key that fails (no green, green outside the opening, an outline not closed round it, more than one opening, no skin under the opening, an interior that is only lips, or one drawn opaque on a non-white or noisy ground) is refused naming the regeneration; with the lip set neither mouth nor mouth_open is written and preview.png shows the mouth closed, as the rig draws the rest pose. hair_back, body, mouth_open (legacy route only), blush (one blush.png makes the blush_L/blush_R pair), hair_side (one hair_side.png makes the hair_side_L/hair_side_R pair) and nose are optional \u2014 without a nose layer the head still turns on the rig's default profile, but it has no nose to lead the turn, and `auto_rig_from_layers` fits no turn to the art (`turnTargets` is inert, no `turn` report). The hair_side.png is the front side lock on the screen LEFT, hanging beside the ear with its root at the image's top: hair_side_R is as drawn and hair_side_L mirrored, both drawn over the face, brows and lashes and under hair_front, and without the file both are listed in `skipped`. One arm.png \u2014 the arm on the screen LEFT, drawn hanging with its shoulder at the top \u2014 makes both arms of a full body: arm_R takes it as drawn and arm_L mirrored. The arms are opt-in: without arm.png the compose is a bust's and `skipped` never lists them. arm.png needs body.png, and each arm is hung on the body's shoulder by default (see `layout`). One forearm_pose.png \u2014 the arm's forearm raised, on the screen LEFT, standing up from its elbow with the hand at the top \u2014 makes both pose forearms (forearm_pose_R as drawn, forearm_pose_L mirrored): each is scaled so its elbow end is as wide as its arm's elbow run and pinned on that arm's elbow (see `layout`), and it needs arm.png. With one, preview-pose.png shows the switch at 1 as the rig draws it (the hanging forearms hidden below the elbow, the pose forearms over everything) while preview.png stays the rest pose; without one it is removed. The inline report carries the full-body checks too: a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge, and a pose forearm without its arm or off its arm's elbow in pivot, width or length. A nose whose dense core is a speck \u2014 under a quarter of its trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole, and the inline report warns of it. A light mark drawn detached above the eye white, such as a double-eyelid crease, is dropped from the sclera (the iris's clip); dark strokes there stay lash ink. The eyewhite's dark lower lid \u2014 its line and lashes \u2014 becomes lash_lower_L/lash_lower_R, drawn over the iris; a white with none writes none and lists them in `skipped`.",
|
|
6393
6873
|
inputSchema: {
|
|
6394
6874
|
partsDir: z.string().describe(
|
|
6395
6875
|
"Directory of the source part PNGs (resolved against cwd)."
|
|
@@ -6406,10 +6886,10 @@ function createIkiMcpServer() {
|
|
|
6406
6886
|
h: z.number()
|
|
6407
6887
|
}).partial()
|
|
6408
6888
|
).optional().describe(
|
|
6409
|
-
"Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; omit `h` to keep the part's own aspect, set it to stretch. The defaults of the face's features \u2014 blush, nose, mouth, mouth_open, mouth_inner, eyes, irises, lashes, brows \u2014 are proportions of the face: an override of face.cx, face.cy or face.w carries them with it (scaled by the width; face.h stretches the face alone), while a feature's own override names canvas px. The nose is sized and placed by its dense core (its pixels at alpha >= 128, the drawing inside a soft nose's feather), not its whole part: `w`/`h` size the core, `cx` centres it, and a set `cy` centres its rows. A nose whose core is a speck \u2014 under a quarter of the trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole instead, and the report warns of it. Its `cy` defaults to unset, which lands the core's bottom row (the tip) 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. eye_L/lash_L and eye_R/lash_R are cut from one eyewhite into one frame, so each pair must land on the same frame \u2014 a pair set to land apart is rejected. lash_lower_L/lash_lower_R are cut from it too and have no key: they land on their eye's frame. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower, lip_upper, mouth_tongue and mouth_teeth have no key and land on it, so a retune moves them together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
|
|
6889
|
+
"Per-role override merged over the built-in defaults, keyed by role \u2014 hair_back, body, arm_L, arm_R, face, blush_L, blush_R, nose, mouth, mouth_open, mouth_inner, eye_L, eye_R, iris_L, iris_R, lash_L, lash_R, brow_L, brow_R, hair_side_L, hair_side_R, hair_front, forearm_pose_L, forearm_pose_R \u2014 e.g. `{ eye_L: { cx: 660 } }`. `w` is an integer in 1..1100 (the canvas width) and `h` in 1..canvasHeight; omit `h` to keep the part's own aspect, set it to stretch. The defaults of the face's features \u2014 blush, nose, mouth, mouth_open, mouth_inner, eyes, irises, lashes, brows, side locks \u2014 are proportions of the face: an override of face.cx, face.cy or face.w carries them with it (scaled by the width; face.h stretches the face alone), while a feature's own override names canvas px. The nose is sized and placed by its dense core (its pixels at alpha >= 128, the drawing inside a soft nose's feather), not its whole part: `w`/`h` size the core, `cx` centres it, and a set `cy` centres its rows. A nose whose core is a speck \u2014 under a quarter of the trimmed part's width or height, such as a lone nostril mark or highlight \u2014 is sized and placed whole instead, and the report warns of it. Its `cy` defaults to unset, which lands the core's bottom row (the tip) 0.66 of the way from the eye row down to the mouth's, so the nose follows a retuned eye or mouth row. eye_L/lash_L and eye_R/lash_R are cut from one eyewhite into one frame, so each pair must land on the same frame \u2014 a pair set to land apart is rejected. lash_lower_L/lash_lower_R are cut from it too and have no key: they land on their eye's frame. mouth_inner is the lip set's one frame (mouth_open's place by default; lip_lower, lip_upper, mouth_tongue and mouth_teeth have no key and land on it, so a retune moves them together), and with the lip set the nose's tip rule reads layout.mouth_inner.cy. arm_L/arm_R have no cx/cy/w defaults: an unset `w` is 0.4 of the placed body's width, and an unset `cx` or `cy` hangs the arm's shoulder pivot \u2014 the one auto_rig_from_layers turns it about \u2014 on the body box's shoulder corner on that axis: its left edge for arm_R, its right edge for arm_L, 0.12 of its height under its top. A set one centres the arm as for every other role. forearm_pose_L/forearm_pose_R have no cx/cy/w defaults either: an unset `w` scales the forearm so its elbow end (the shoulder rule run from its bottom) is as wide as the placed arm's elbow run, and an unset `cx` or `cy` pins that elbow end's pivot on the arm's elbow \u2014 the one auto_rig_from_layers hangs it from."
|
|
6410
6890
|
),
|
|
6411
6891
|
mirrorParts: z.array(z.string()).optional().describe(
|
|
6412
|
-
"Part files to flip left-right as they are read, e.g. `[\"eyewhite.png\"]`. The composer reads eyewhite.png as the eye on the screen LEFT (lash wing at the image's left end, lash-free tear duct at its right), brow.png as the brow on the screen RIGHT (thick head at the image's left end, tail at its right), blush.png as the blush on the screen LEFT (outer end, toward the face's edge, at the image's left end, inner end at its right), arm.png as the arm on the screen LEFT (the character's right, hanging, its shoulder at the image's top), and forearm_pose.png as the raised forearm on the screen LEFT (standing up from its elbow, the hand at the image's top, the thumb toward the body at the image's right); a part drawn the other way round is fixed here for free. It flips the source, so every role cut from it flips together and an eye's sclera and lash stay in one frame."
|
|
6892
|
+
"Part files to flip left-right as they are read, e.g. `[\"eyewhite.png\"]`. The composer reads eyewhite.png as the eye on the screen LEFT (lash wing at the image's left end, lash-free tear duct at its right), brow.png as the brow on the screen RIGHT (thick head at the image's left end, tail at its right), blush.png as the blush on the screen LEFT (outer end, toward the face's edge, at the image's left end, inner end at its right), hair_side.png as the front side lock on the screen LEFT (hanging, its root at the image's top), arm.png as the arm on the screen LEFT (the character's right, hanging, its shoulder at the image's top), and forearm_pose.png as the raised forearm on the screen LEFT (standing up from its elbow, the hand at the image's top, the thumb toward the body at the image's right); a part drawn the other way round is fixed here for free. It flips the source, so every role cut from it flips together and an eye's sclera and lash stay in one frame."
|
|
6413
6893
|
),
|
|
6414
6894
|
canvasHeight: z.number().optional().describe(
|
|
6415
6895
|
"The canvas's height in px: an even integer in 1100..4096, default 1100 (a square bust canvas; at 1100 every output is byte-identical to leaving it out). The width stays 1100. The canvas grows downward: every default and every override keeps its canvas px from the top-left, so the head lands where it does on a bust and a full body gets room below. An odd height is refused \u2014 model space is centred on the canvas, so it would put the head on a half pixel \u2014 and it is checked before any part decodes."
|
|
@@ -6437,7 +6917,7 @@ function createIkiMcpServer() {
|
|
|
6437
6917
|
server.registerTool(
|
|
6438
6918
|
"measure_layers",
|
|
6439
6919
|
{
|
|
6440
|
-
description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes, and of mouth_tongue/mouth_teeth: one with no lip set, one on another canvas, one whose box leaves mouth_inner's \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
|
|
6920
|
+
description: "Reports read-only geometry checks over an already-composed layers directory \u2014 the same checks compose_layers_from_parts returns inline (iris ratio/offset, eye aspect, cropped/cut edges, a nose whose dense core is a speck of its crop, missing optional roles, a body whose feet a tall canvas's bottom cuts off, an arm without a body, an arm whose shoulder cap does not reach under the torso's edge on its shoulder pivot's row, a pose forearm without its arm or whose elbow end is off its arm's elbow in pivot, width or length, a front side lock without hair_front, one whose top row shows past the bangs at rest, one covering the eye white's outer corner at rest, one whose lean on the turn away from it would bare columns neither hair_back nor the face paints, a hair_side.png drawing two locks, and the lip set: a partial one or one beside mouth/mouth_open, the fold's contract per column of the opening, an opening too narrow or short, a line too thin, green left, an interior with holes, and of mouth_tongue/mouth_teeth: one with no lip set, one on another canvas, one whose box leaves mouth_inner's \u2014 with the opening's size and the MouthOpen below which no slit shows). Every preview*.png is skipped. Use to re-check a layers dir without recomposing. Its nose check reads the composed file against its crop, which is what auto_rig_from_layers acts on. Compose's inline report does the same unless the composer found the source part's core a speck, which it reports instead \u2014 so a speck that resampling erased from the layer shows there and not here.",
|
|
6441
6921
|
inputSchema: {
|
|
6442
6922
|
layersDir: z.string().describe(
|
|
6443
6923
|
"Directory of role-named layer PNGs (resolved against cwd)."
|
|
@@ -6502,7 +6982,7 @@ function createIkiMcpServer() {
|
|
|
6502
6982
|
server.registerTool(
|
|
6503
6983
|
"render_poses",
|
|
6504
6984
|
{
|
|
6505
|
-
description: "Renders a rigged .iki into the character loop's pose PNGs with the real engine, through the installed Chrome, Edge or Chromium run headless (set CHROME_PATH to pick one). The model decides the set: a bust gets 560x560 shots (rest, turns, nod, blinks, gaze, combined \u2014 ParamAngleX/Y/Z all at 30 \u2014 and stress: ParamAngleX/Y/Z all at -30, ParamMouthOpenY 1, both eyes at 0.5, the brows at opposite extremes (ParamBrowLY -1, ParamBrowRY 1, ParamBrowLAngle 1, ParamBrowRAngle -1) and each body angle the model declares at -10); a mouth adds 720x480 mouth crops; a full body (taller than wide) adds the full-canvas body, arm and elbow poses on a 1400-wide canvas, and a model with a pose forearm adds the full-pose-* shots. Given `poses` (see its field), the standard set is not rendered: only those poses are, each crop clamped to the model's canvas. Writes <pose>.png files into outDir, overwriting same-named files in place; returns the written paths one per line, then the model's fold report (the result's `folds`), checked by the engine over its own pose set plus any `poses`, each of which a `FOLD` line names by its settings, not its PNG name: a `FOLD` line per warp deformer or mesh part that flips (ratio <= 0) or collapses (under 0.1) at some pose \u2014 its cell or triangle, the ratio of its area there to at rest, the pose as its parameter settings (`rest` for none) and where it rests, in model space and in model px from the top-left (the layer PNGs' own pixels, not a render's) \u2014 or `FOLDS: none over N poses`, then a `FOLDS expected:` line naming the closures the rig draws on purpose (an eye or the mouth shut), each by part id, ratio and the parameter that shuts it. Report-only: a fold never fails the render. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output of the model's own rigs \u2014 `poses` do not enter it \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. Given `sweep`, also renders an eased turn of the head (see its field) and prints its paths and `SWEEP` lines. Fails with INVALID when no browser is found or an input is refused; a browser that cannot start is a tool error.",
|
|
6985
|
+
description: "Renders a rigged .iki into the character loop's pose PNGs with the real engine, through the installed Chrome, Edge or Chromium run headless (set CHROME_PATH to pick one). The model decides the set: a bust gets 560x560 shots (rest, turns, nod, blinks, gaze, combined \u2014 ParamAngleX/Y/Z all at 30 \u2014 and stress: ParamAngleX/Y/Z all at -30, ParamMouthOpenY 1, both eyes at 0.5, the brows at opposite extremes (ParamBrowLY -1, ParamBrowRY 1, ParamBrowLAngle 1, ParamBrowRAngle -1) and each body angle the model declares at -10); a mouth adds 720x480 mouth crops; a full body (taller than wide) adds the full-canvas body, arm and elbow poses on a 1400-wide canvas, and a model with a pose forearm adds the full-pose-* shots. Given `poses` (see its field), the standard set is not rendered: only those poses are, each crop clamped to the model's canvas. Writes <pose>.png files into outDir, overwriting same-named files in place; returns the written paths one per line, then the model's fold report (the result's `folds`), checked by the engine over its own pose set plus any `poses`, each of which a `FOLD` line names by its settings, not its PNG name: a `FOLD` line per warp deformer or mesh part that flips (ratio <= 0) or collapses (under 0.1) at some pose \u2014 its cell or triangle, the ratio of its area there to at rest, the pose as its parameter settings (`rest` for none) and where it rests, in model space and in model px from the top-left (the layer PNGs' own pixels, not a render's) \u2014 or `FOLDS: none over N poses`, then a `FOLDS expected:` line naming the closures the rig draws on purpose (an eye or the mouth shut), each by part id, ratio and the parameter that shuts it. Report-only: a fold never fails the render. The `PHYSICS` lines follow the fold report (the result's `physics`), one per physics rig output of the model's own rigs \u2014 `poses` do not enter it \u2014 reading ok, frozen or unstable with the step and idle amplitudes, or `PHYSICS: no rigs`; report-only too. Given `sweep`, also renders an eased turn of the head (see its field) and prints its paths and `SWEEP` lines (and, with `sweeps`, the turn-and-nod box). Fails with INVALID when no browser is found or an input is refused; a browser that cannot start is a tool error.",
|
|
6506
6986
|
inputSchema: {
|
|
6507
6987
|
modelPath: z.string().describe(
|
|
6508
6988
|
"Rigged .iki file path (resolved against cwd; must sit under the working directory)."
|
|
@@ -6534,7 +7014,21 @@ function createIkiMcpServer() {
|
|
|
6534
7014
|
h: z.number()
|
|
6535
7015
|
}).optional()
|
|
6536
7016
|
}).optional().describe(
|
|
6537
|
-
"A turn sweep rendered IN ADDITION to the poses, `{ name, preset: \"turn\", crop? }`: an eased `ParamAngleX` turn (0 to -30 to +30 to 0 over 3 s, sinusoidal) at 30 fps on a 60 Hz physics clock, with the hair physics running and the idle off, every other parameter at its default. `crop` is a rectangle in model px as a pose's, fixed for every frame; without one the frames are framed as the standard shots. Written into `<outDir>/<name>/` (created; `name` starts with a letter or digit, then letters, digits, `_`, `.`, `-`): `fNNN.png` (90 frames), `manifest.json` (each frame's time, angle and effective values), `sheet.png` (nine frames of the -30 to +30 leg, labelled with angle and time, at most 2000 px a side), `kymograph.png` (the eye row of every frame stacked over time), `index.html` (a flipbook to open from disk; add `?b=<relative dir of another sweep>` for two side by side). The text then lists the paths and, after the `PHYSICS` lines, a `SWEEP turn` line per landmark (eyes, nose) from the engine's geometry: amplitude in face widths, the kink of x and of the eye width through angle 0, the lead over the local face plate at each end, and the pop \u2014 report-only, like `FOLD` and `PHYSICS`."
|
|
7017
|
+
"A turn sweep rendered IN ADDITION to the poses, `{ name, preset: \"turn\", crop? }`: an eased `ParamAngleX` turn (0 to -30 to +30 to 0 over 3 s, sinusoidal) at 30 fps on a 60 Hz physics clock, with the hair physics running and the idle off, every other parameter at its default. `crop` is a rectangle in model px as a pose's, fixed for every frame; without one the frames are framed as the standard shots. Written into `<outDir>/<name>/` (created; `name` starts with a letter or digit, then letters, digits, `_`, `.`, `-`): `fNNN.png` (90 frames), `manifest.json` (each frame's time, angle and effective values), `sheet.png` (nine frames of the -30 to +30 leg, labelled with angle and time, at most 2000 px a side), `kymograph.png` (the eye row of every frame stacked over time), `index.html` (a flipbook to open from disk; add `?b=<relative dir of another sweep>` for two side by side). The text then lists the paths and, after the `PHYSICS` lines, a `SWEEP turn` line per landmark (eyes, nose) from the engine's geometry: amplitude in face widths, the kink of x and of the eye width through angle 0, the lead over the local face plate at each end, and the pop \u2014 report-only, like `FOLD` and `PHYSICS`. `sweeps` renders more sweeps beside this one. The `SWEEP nod` and `SWEEP corner` lines follow the `SWEEP turn` ones."
|
|
7018
|
+
),
|
|
7019
|
+
sweeps: z.array(
|
|
7020
|
+
z.object({
|
|
7021
|
+
name: z.string(),
|
|
7022
|
+
preset: z.enum(SWEEP_PRESETS),
|
|
7023
|
+
crop: z.object({
|
|
7024
|
+
x: z.number(),
|
|
7025
|
+
y: z.number(),
|
|
7026
|
+
w: z.number(),
|
|
7027
|
+
h: z.number()
|
|
7028
|
+
}).optional()
|
|
7029
|
+
})
|
|
7030
|
+
).optional().describe(
|
|
7031
|
+
"More sweeps rendered after `sweep`, each `{ name, preset, crop? }` into its own `<outDir>/<name>/` (files and `crop` as `sweep`'s). Names are distinct from `sweep`'s and from each other's ignoring case, and presets are distinct (at most one of each). `turn` is `sweep`'s. `turn-nod` is the box (0,0) -> (0,-30) -> (-30,-30) -> (-30,+30) -> (+30,+30) -> (+30,-30) -> (0,-30) -> (0,0) of `ParamAngleX` x `ParamAngleY`, each leg eased, 6 s, 180 frames; its `sheet.png` is a 3 x 3 grid BY ANGLE (columns AngleX -30/0/+30, rows AngleY +30/0/-30, rest in the centre, cells labelled X, Y and t) and it has no kymograph. `manifest.json` is version 2 (`parameters`, and per frame `t` and `values`). A sweep dir's earlier frames, sheet, kymograph, manifest and flipbook are cleared first. An empty list, a repeated name or preset, or a bad crop comes back as `INVALID: sweeps...`. A server before 0.32.0 strips `sweeps` and renders the rest. The `SWEEP nod` lines (the eye-pair and iris-pair gap range and the mouth width range along the nod at each turn, in face widths) and `SWEEP corner` lines (the additivity residual per landmark at the four corners, the rest term included; 0 on an additive rig) print once per call whenever `sweep` or `sweeps` was asked for, report-only like `FOLD` and `PHYSICS`."
|
|
6538
7032
|
)
|
|
6539
7033
|
}
|
|
6540
7034
|
},
|
|
@@ -6543,16 +7037,21 @@ function createIkiMcpServer() {
|
|
|
6543
7037
|
const r = await renderPoses(args);
|
|
6544
7038
|
const text = r.ok ? [
|
|
6545
7039
|
...r.poses.map((p) => p.path),
|
|
6546
|
-
...r.sweep ? [
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
|
|
7040
|
+
...[...r.sweep ? [r.sweep] : [], ...r.sweeps ?? []].flatMap(
|
|
7041
|
+
(w) => [
|
|
7042
|
+
w.dir,
|
|
7043
|
+
w.sheet,
|
|
7044
|
+
...w.kymograph ? [w.kymograph] : [],
|
|
7045
|
+
w.flipbook,
|
|
7046
|
+
w.manifest
|
|
7047
|
+
]
|
|
7048
|
+
),
|
|
6553
7049
|
...formatFoldReport(r.folds, r.modelCanvas),
|
|
6554
7050
|
...formatPhysicsReport(r.physics),
|
|
6555
|
-
...r.sweep
|
|
7051
|
+
...r.sweep ?? r.sweeps?.[0] ? [
|
|
7052
|
+
...formatSweepReport((r.sweep ?? r.sweeps[0]).report),
|
|
7053
|
+
...formatNodReport((r.sweep ?? r.sweeps[0]).nod)
|
|
7054
|
+
] : []
|
|
6556
7055
|
].join("\n") : `INVALID: ${r.error}`;
|
|
6557
7056
|
return { content: [{ type: "text", text }], structuredContent: r };
|
|
6558
7057
|
} catch (err) {
|
|
@@ -6571,8 +7070,11 @@ function createIkiMcpServer() {
|
|
|
6571
7070
|
export {
|
|
6572
7071
|
checkModelFolds,
|
|
6573
7072
|
formatFoldReport,
|
|
7073
|
+
checkNod,
|
|
6574
7074
|
checkSweep,
|
|
6575
7075
|
formatSweepReport,
|
|
7076
|
+
formatNodReport,
|
|
7077
|
+
SWEEP_PRESETS,
|
|
6576
7078
|
renderPoses,
|
|
6577
7079
|
validateIki,
|
|
6578
7080
|
describeIki,
|
|
@@ -6586,7 +7088,8 @@ export {
|
|
|
6586
7088
|
measureLayers,
|
|
6587
7089
|
formatMeasureReport,
|
|
6588
7090
|
composeLayersFromParts,
|
|
7091
|
+
formatHairSideReport,
|
|
6589
7092
|
formatPhysicsReport,
|
|
6590
7093
|
createIkiMcpServer
|
|
6591
7094
|
};
|
|
6592
|
-
//# sourceMappingURL=chunk-
|
|
7095
|
+
//# sourceMappingURL=chunk-5D7374FI.mjs.map
|