@margoengine/rigging 0.1.0 → 1.0.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/LICENSE +201 -201
- package/NOTICE +4 -4
- package/README.md +1444 -969
- package/dist/anatomy-data-ansur2.d.ts +63 -0
- package/dist/anatomy-data-cdc.d.ts +16 -0
- package/dist/anatomy-data-deleva.d.ts +86 -0
- package/dist/anatomy-human.d.ts +67 -0
- package/dist/anatomy-human.js +2229 -0
- package/dist/anatomy.d.ts +638 -0
- package/dist/anatomy.js +1112 -0
- package/dist/autorig.js +137 -134
- package/dist/body-volumes-DTym0RVY.js +56 -0
- package/dist/body-volumes.d.ts +19 -0
- package/dist/contact.d.ts +12 -1
- package/dist/contact.js +197 -190
- package/dist/coupling.d.ts +57 -0
- package/dist/coupling.js +330 -0
- package/dist/face.js +2 -2
- package/dist/ik.d.ts +55 -2
- package/dist/ik.js +369 -166
- package/dist/mtoon.js +4 -4
- package/dist/pose-tracking.js +2 -2
- package/dist/retarget.d.ts +9 -2
- package/dist/retarget.js +53 -29
- package/dist/shared/gltf.d.ts +257 -257
- package/dist/shared/layers.d.ts +16 -16
- package/dist/validate.d.ts +188 -0
- package/dist/validate.js +440 -0
- package/dist/vrm-constraints.js +3 -3
- package/dist/vrm.d.ts +8 -3
- package/dist/vrm.js +2 -2
- package/dist/vrma.js +2 -2
- package/package.json +191 -175
package/dist/mtoon.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// @margo/core-built
|
|
1
|
+
// @margo/core-built 1.0.0
|
|
2
2
|
import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
|
|
3
|
-
const i=(engine,version="
|
|
3
|
+
const i=(engine,version="1.0.0",source=import.meta.url)=>__margoRuntime(engine,version,source);
|
|
4
4
|
import { r as e, t } from "./errors-D8rc8kzg.js";
|
|
5
5
|
import { setMaterialDraw as n } from "@margoengine/gltf/material-draw";
|
|
6
6
|
import { PBRDrawRun as r } from "@margoengine/gltf/pbr-model";
|
|
@@ -486,7 +486,7 @@ function R(e) {
|
|
|
486
486
|
}
|
|
487
487
|
return t;
|
|
488
488
|
}
|
|
489
|
-
var z = class a {coreRequirement=__margoCoreRequirement("
|
|
489
|
+
var z = class a {coreRequirement=__margoCoreRequirement("1.0.0",import.meta.url);
|
|
490
490
|
get materials() {
|
|
491
491
|
return this.definitions;
|
|
492
492
|
}
|
|
@@ -593,7 +593,7 @@ var z = class a {coreRequirement=__margoCoreRequirement("0.1.0",import.meta.url)
|
|
|
593
593
|
for (let e of this.parts) e.primitive.material = e.body;
|
|
594
594
|
this.unsubscribe = r.onDispose(() => this.dispose());
|
|
595
595
|
}
|
|
596
|
-
static attach(e, t = {}) {__margoAssertCore(e,__margoCoreRequirement("
|
|
596
|
+
static attach(e, t = {}) {__margoAssertCore(e,__margoCoreRequirement("1.0.0",import.meta.url));
|
|
597
597
|
let n = new a(e, t);
|
|
598
598
|
try {
|
|
599
599
|
n.scene.use(n);
|
package/dist/pose-tracking.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// @margo/core-built
|
|
1
|
+
// @margo/core-built 1.0.0
|
|
2
2
|
import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
|
|
3
3
|
|
|
4
4
|
import { rotationBetween as e } from "./ik.js";
|
|
@@ -458,7 +458,7 @@ async function E(e, r, i = {}) {
|
|
|
458
458
|
if (i.autoUpdate !== !1) {
|
|
459
459
|
if (i.vrm) b = i.vrm.addPoseSource(S);
|
|
460
460
|
else {
|
|
461
|
-
let e = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("
|
|
461
|
+
let e = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("1.0.0",import.meta.url),
|
|
462
462
|
name: w,
|
|
463
463
|
setup() {},
|
|
464
464
|
onPreUpdate: S,
|
package/dist/retarget.d.ts
CHANGED
|
@@ -41,8 +41,10 @@ export interface PrepareRetargetOptions {
|
|
|
41
41
|
/**
|
|
42
42
|
* Turn the target's reference pose so each mapped limb bone (arms, hands, fingers, legs, feet) points the way its source
|
|
43
43
|
* bone does at rest (default true): a T-pose source then drives an A-pose target into the same T-pose. The trunk, neck
|
|
44
|
-
* and collarbones keep the target's own rest, since their directions are body layout, not pose.
|
|
45
|
-
* target's
|
|
44
|
+
* and collarbones keep the target's own rest, since their directions are body layout, not pose. A source hand with no
|
|
45
|
+
* finger bones below it (a BVH End Site, an ASF or Xsens hand segment) is one rigid segment, so the target's hand and
|
|
46
|
+
* long fingers are laid straight along it, in line with the source forearm when the source has no finger base at all;
|
|
47
|
+
* thumbs keep the target's rest. False keeps the target's whole rest pose.
|
|
46
48
|
*/
|
|
47
49
|
alignRest?: boolean;
|
|
48
50
|
}
|
|
@@ -60,6 +62,11 @@ export interface PreparedRetarget {
|
|
|
60
62
|
readonly to: SkeletonPreset;
|
|
61
63
|
/** Humanoid bones the target has but the source does not (they stay at rest). */
|
|
62
64
|
readonly unmapped: readonly HumanoidBone[];
|
|
65
|
+
/**
|
|
66
|
+
* Unmapped target bone names whose rest the alignment turned (fingers laid along a fingerless source hand). Retarget
|
|
67
|
+
* reads this as its `hold` option and keeps them at the aligned rest, so they do not stay in the target's own pose.
|
|
68
|
+
*/
|
|
69
|
+
readonly hold: readonly string[];
|
|
63
70
|
}
|
|
64
71
|
/**
|
|
65
72
|
* Maps a source skeleton's bones onto a target's by their presets (detected from the names unless given) and, by
|
package/dist/retarget.js
CHANGED
|
@@ -246,18 +246,19 @@ function E(e, t, n = {}) {
|
|
|
246
246
|
let a = C(e.names, r), o = C(t.names, i), s = {}, c = [];
|
|
247
247
|
for (let e of t.names) s[e] = "";
|
|
248
248
|
for (let [n, r] of o) {
|
|
249
|
-
let i = a.get(n);
|
|
250
|
-
|
|
249
|
+
let i = /^(left|right)(Index|Ring|Little)Proximal$/.exec(n)?.[1], o = a.get(n) ?? (i ? a.get(`${i}MiddleProximal`) : void 0);
|
|
250
|
+
o === void 0 ? c.push(n) : s[t.names[r]] = e.names[o];
|
|
251
251
|
}
|
|
252
252
|
if (!Object.values(s).some(Boolean)) throw RangeError(`Retarget maps no bones from ${r} to ${i}; check the presets`);
|
|
253
|
-
let l = o.has("hips") && a.has("hips") ? t.names[o.get("hips")] : void 0;
|
|
253
|
+
let l = o.has("hips") && a.has("hips") ? t.names[o.get("hips")] : void 0, u = /* @__PURE__ */ new Set(), d = n.alignRest === !1 ? t : P(e, t, a, o, u), f = [...u].filter((e) => !s[t.names[e]]).map((e) => t.names[e]);
|
|
254
254
|
return {
|
|
255
|
-
target:
|
|
255
|
+
target: d,
|
|
256
256
|
names: s,
|
|
257
257
|
...l ? { hip: l } : {},
|
|
258
258
|
from: r,
|
|
259
259
|
to: i,
|
|
260
|
-
unmapped: c
|
|
260
|
+
unmapped: c,
|
|
261
|
+
hold: f
|
|
261
262
|
};
|
|
262
263
|
}
|
|
263
264
|
function D(t, n) {
|
|
@@ -307,44 +308,67 @@ function j(e, t, n, a) {
|
|
|
307
308
|
let v = Math.atan2(c(p, s(g, _)), c(g, _));
|
|
308
309
|
return i(r(p, v), t);
|
|
309
310
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
311
|
+
var M = /^(left|right)(Hand|(Index|Middle|Ring|Little)(Proximal|Intermediate))$/;
|
|
312
|
+
function N(e, t, n, r) {
|
|
313
|
+
let i = M.exec(e)?.[1], a = v[e]?.[0];
|
|
314
|
+
if (!i || !a || !n.has(a)) return null;
|
|
315
|
+
let o = t.get(`${i}Hand`), s = t.get(`${i}MiddleProximal`), c = t.get(`${i}LowerArm`);
|
|
316
|
+
if (o === void 0) return null;
|
|
317
|
+
let [l, u] = s === void 0 ? c === void 0 ? [] : [c, o] : [o, s];
|
|
318
|
+
return l === void 0 || u === void 0 ? null : {
|
|
319
|
+
child: n.get(a),
|
|
320
|
+
want: [
|
|
317
321
|
0,
|
|
318
322
|
1,
|
|
319
323
|
2
|
|
320
|
-
].map((e) =>
|
|
324
|
+
].map((e) => r[u][e] - r[l][e])
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
function P(e, t, r, s, c) {
|
|
328
|
+
let l = new Float64Array(t.rest), u = O(e, e.rest), d = _.filter((e) => s.has(e));
|
|
329
|
+
for (let e of d) {
|
|
330
|
+
if (y.has(e)) continue;
|
|
331
|
+
let d = (v[e] ?? []).find((e) => s.has(e) && r.has(e)), f, p;
|
|
332
|
+
if (d && r.has(e)) {
|
|
333
|
+
let t = r.get(e), n = r.get(d);
|
|
334
|
+
f = s.get(d), p = [
|
|
335
|
+
0,
|
|
336
|
+
1,
|
|
337
|
+
2
|
|
338
|
+
].map((e) => u.position[n][e] - u.position[t][e]);
|
|
339
|
+
} else {
|
|
340
|
+
let t = N(e, r, s, u.position);
|
|
341
|
+
if (!t) continue;
|
|
342
|
+
f = t.child, p = t.want;
|
|
343
|
+
}
|
|
344
|
+
let m = s.get(e), h = O(t, l), g = [
|
|
321
345
|
0,
|
|
322
346
|
1,
|
|
323
347
|
2
|
|
324
|
-
].map((e) =>
|
|
325
|
-
if (Math.hypot(...g) < 1e-9 || Math.hypot(...
|
|
326
|
-
let
|
|
327
|
-
if (!
|
|
328
|
-
let
|
|
348
|
+
].map((e) => h.position[f][e] - h.position[m][e]);
|
|
349
|
+
if (Math.hypot(...g) < 1e-9 || Math.hypot(...p) < 1e-9) continue;
|
|
350
|
+
let _ = t.parents[m], b = _ < 0 ? g : k(h.linear, _, g), x = _ < 0 ? p : k(h.linear, _, p);
|
|
351
|
+
if (!b || !x) continue;
|
|
352
|
+
let S = n(b, x);
|
|
329
353
|
if (e === "leftHand" || e === "rightHand") {
|
|
330
|
-
let t = e === "leftHand" ? "left" : "right", n = A(t, s, h.position), i = A(t, r,
|
|
354
|
+
let t = e === "leftHand" ? "left" : "right", n = A(t, s, h.position), i = A(t, r, u.position);
|
|
331
355
|
if (n && i) {
|
|
332
|
-
let e =
|
|
333
|
-
e && t && (
|
|
356
|
+
let e = _ < 0 ? n : k(h.linear, _, n), t = _ < 0 ? i : k(h.linear, _, i);
|
|
357
|
+
e && t && (S = j(o(b, S), S, e, t));
|
|
334
358
|
}
|
|
335
359
|
}
|
|
336
|
-
let
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
])),
|
|
360
|
+
let C = m * 10 + 3;
|
|
361
|
+
l.set(a(i(S, [
|
|
362
|
+
l[C],
|
|
363
|
+
l[C + 1],
|
|
364
|
+
l[C + 2],
|
|
365
|
+
l[C + 3]
|
|
366
|
+
])), C), c.add(m);
|
|
343
367
|
}
|
|
344
368
|
return {
|
|
345
369
|
names: t.names,
|
|
346
370
|
parents: t.parents,
|
|
347
|
-
rest:
|
|
371
|
+
rest: l
|
|
348
372
|
};
|
|
349
373
|
}
|
|
350
374
|
//#endregion
|