@lovelace_lol/loom3 1.0.13 → 1.0.15
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/dist/index.cjs +73 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -39
- package/dist/index.d.ts +6 -39
- package/dist/index.js +74 -73
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -192,6 +192,17 @@ var BakedAnimationController = class {
|
|
|
192
192
|
__publicField(this, "actionIdToClip", /* @__PURE__ */ new Map());
|
|
193
193
|
this.host = host;
|
|
194
194
|
}
|
|
195
|
+
getActionId(action) {
|
|
196
|
+
if (!action) return void 0;
|
|
197
|
+
return this.actionIds.get(action) ?? action.__actionId;
|
|
198
|
+
}
|
|
199
|
+
setActionId(action, clipName) {
|
|
200
|
+
const actionId = makeActionId();
|
|
201
|
+
this.actionIds.set(action, actionId);
|
|
202
|
+
this.actionIdToClip.set(actionId, clipName);
|
|
203
|
+
action.__actionId = actionId;
|
|
204
|
+
return actionId;
|
|
205
|
+
}
|
|
195
206
|
getMeshNamesForAU(auId, config, explicitMeshNames) {
|
|
196
207
|
if (explicitMeshNames && explicitMeshNames.length > 0) {
|
|
197
208
|
return explicitMeshNames;
|
|
@@ -696,19 +707,13 @@ var BakedAnimationController = class {
|
|
|
696
707
|
mixerWeight
|
|
697
708
|
} = options || {};
|
|
698
709
|
let action = this.clipActions.get(clip.name);
|
|
699
|
-
let actionId =
|
|
710
|
+
let actionId = this.getActionId(action);
|
|
700
711
|
if (action && !actionId) {
|
|
701
|
-
actionId =
|
|
702
|
-
this.actionIds.set(action, actionId);
|
|
703
|
-
this.actionIdToClip.set(actionId, clip.name);
|
|
704
|
-
action.__actionId = actionId;
|
|
712
|
+
actionId = this.setActionId(action, clip.name);
|
|
705
713
|
}
|
|
706
714
|
if (!action) {
|
|
707
715
|
action = this.animationMixer.clipAction(clip);
|
|
708
|
-
actionId =
|
|
709
|
-
this.actionIds.set(action, actionId);
|
|
710
|
-
this.actionIdToClip.set(actionId, clip.name);
|
|
711
|
-
action.__actionId = actionId;
|
|
716
|
+
actionId = this.setActionId(action, clip.name);
|
|
712
717
|
}
|
|
713
718
|
const existingClip = this.animationClips.find((c) => c.name === clip.name);
|
|
714
719
|
if (!existingClip) {
|
|
@@ -861,10 +866,10 @@ var BakedAnimationController = class {
|
|
|
861
866
|
const debugSnapshot = () => ({
|
|
862
867
|
target: name,
|
|
863
868
|
params,
|
|
864
|
-
clipActions: Array.from(this.clipActions.entries()).map(([k, a]) => ({ name: k, actionId: this.
|
|
865
|
-
animationActions: Array.from(this.animationActions.entries()).map(([k, a]) => ({ name: k, actionId: this.
|
|
869
|
+
clipActions: Array.from(this.clipActions.entries()).map(([k, a]) => ({ name: k, actionId: this.getActionId(a) })),
|
|
870
|
+
animationActions: Array.from(this.animationActions.entries()).map(([k, a]) => ({ name: k, actionId: this.getActionId(a) })),
|
|
866
871
|
clipHandles: Array.from(this.clipHandles.entries()).map(([k, h]) => ({ name: k, actionId: h.actionId })),
|
|
867
|
-
mixerActions: (this.animationMixer?._actions || []).map((a) => ({ name: a?.getClip?.()?.name || "", actionId: this.
|
|
872
|
+
mixerActions: (this.animationMixer?._actions || []).map((a) => ({ name: a?.getClip?.()?.name || "", actionId: this.getActionId(a) }))
|
|
868
873
|
});
|
|
869
874
|
console.log("[Loom3] updateClipParams start", debugSnapshot());
|
|
870
875
|
const apply = (action) => {
|
|
@@ -1498,53 +1503,53 @@ var BONE_AU_TO_BINDINGS = {
|
|
|
1498
1503
|
42: [{ node: "TONGUE", channel: "rx", scale: 1, maxDegrees: 20 }]
|
|
1499
1504
|
};
|
|
1500
1505
|
var VISEME_KEYS = [
|
|
1501
|
-
"
|
|
1506
|
+
"AE",
|
|
1502
1507
|
"Ah",
|
|
1503
|
-
"Oh",
|
|
1504
|
-
"OO",
|
|
1505
|
-
"I",
|
|
1506
|
-
"U",
|
|
1507
|
-
"W",
|
|
1508
|
-
"L",
|
|
1509
|
-
"F_V",
|
|
1510
|
-
"Th",
|
|
1511
|
-
"S_Z",
|
|
1512
1508
|
"B_M_P",
|
|
1509
|
+
"Ch_J",
|
|
1510
|
+
"EE",
|
|
1511
|
+
"Er",
|
|
1512
|
+
"F_V",
|
|
1513
|
+
"Ih",
|
|
1513
1514
|
"K_G_H_NG",
|
|
1514
|
-
"
|
|
1515
|
-
"R"
|
|
1515
|
+
"Oh",
|
|
1516
|
+
"R",
|
|
1517
|
+
"S_Z",
|
|
1518
|
+
"T_L_D_N",
|
|
1519
|
+
"Th",
|
|
1520
|
+
"W_OO"
|
|
1516
1521
|
];
|
|
1517
1522
|
var VISEME_JAW_AMOUNTS = [
|
|
1518
|
-
0.
|
|
1519
|
-
// 0:
|
|
1523
|
+
0.75,
|
|
1524
|
+
// 0: AE
|
|
1520
1525
|
0.8,
|
|
1521
1526
|
// 1: Ah
|
|
1522
|
-
0
|
|
1523
|
-
// 2:
|
|
1524
|
-
0.5,
|
|
1525
|
-
// 3: OO
|
|
1526
|
-
0.2,
|
|
1527
|
-
// 4: I
|
|
1528
|
-
0.5,
|
|
1529
|
-
// 5: U
|
|
1530
|
-
0.4,
|
|
1531
|
-
// 6: W
|
|
1527
|
+
0,
|
|
1528
|
+
// 2: B_M_P
|
|
1532
1529
|
0.3,
|
|
1533
|
-
//
|
|
1534
|
-
0.
|
|
1535
|
-
//
|
|
1536
|
-
0.
|
|
1537
|
-
//
|
|
1530
|
+
// 3: Ch_J
|
|
1531
|
+
0.2,
|
|
1532
|
+
// 4: EE
|
|
1533
|
+
0.35,
|
|
1534
|
+
// 5: Er
|
|
1538
1535
|
0.1,
|
|
1539
|
-
//
|
|
1540
|
-
0,
|
|
1541
|
-
//
|
|
1536
|
+
// 6: F_V
|
|
1537
|
+
0.2,
|
|
1538
|
+
// 7: Ih
|
|
1542
1539
|
0.35,
|
|
1543
|
-
//
|
|
1544
|
-
0.
|
|
1545
|
-
//
|
|
1546
|
-
0.35
|
|
1547
|
-
//
|
|
1540
|
+
// 8: K_G_H_NG
|
|
1541
|
+
0.6,
|
|
1542
|
+
// 9: Oh
|
|
1543
|
+
0.35,
|
|
1544
|
+
// 10: R
|
|
1545
|
+
0.1,
|
|
1546
|
+
// 11: S_Z
|
|
1547
|
+
0.3,
|
|
1548
|
+
// 12: T_L_D_N
|
|
1549
|
+
0.15,
|
|
1550
|
+
// 13: Th
|
|
1551
|
+
0.5
|
|
1552
|
+
// 14: W_OO
|
|
1548
1553
|
];
|
|
1549
1554
|
var isMixedAU = (id) => {
|
|
1550
1555
|
const morphs = AU_TO_MORPHS[id];
|
|
@@ -2064,7 +2069,7 @@ var HairPhysicsController = class {
|
|
|
2064
2069
|
this.clearRegisteredHairObjects();
|
|
2065
2070
|
const result = [];
|
|
2066
2071
|
for (const obj of objects) {
|
|
2067
|
-
if (obj.
|
|
2072
|
+
if (obj instanceof THREE.Mesh) {
|
|
2068
2073
|
const mesh = obj;
|
|
2069
2074
|
this.registeredHairObjects.set(mesh.name, mesh);
|
|
2070
2075
|
const meshInfo = CC4_MESHES[mesh.name];
|
|
@@ -2140,7 +2145,7 @@ var HairPhysicsController = class {
|
|
|
2140
2145
|
}
|
|
2141
2146
|
} : this.hairPhysicsConfig.morphTargets;
|
|
2142
2147
|
this.hairPhysicsConfig = { ...this.hairPhysicsConfig, ...config, direction, morphTargets };
|
|
2143
|
-
const
|
|
2148
|
+
const idleKeys = [
|
|
2144
2149
|
"idleSwayAmount",
|
|
2145
2150
|
"idleSwaySpeed",
|
|
2146
2151
|
"windStrength",
|
|
@@ -2149,14 +2154,16 @@ var HairPhysicsController = class {
|
|
|
2149
2154
|
"windTurbulence",
|
|
2150
2155
|
"windFrequency",
|
|
2151
2156
|
"idleClipDuration"
|
|
2152
|
-
]
|
|
2157
|
+
];
|
|
2158
|
+
const idleChanged = idleKeys.some((key) => config[key] !== void 0);
|
|
2153
2159
|
const morphTargetsChanged = config.morphTargets !== void 0;
|
|
2154
2160
|
const directionChanged = config.direction !== void 0;
|
|
2155
|
-
const
|
|
2161
|
+
const impulseKeys = [
|
|
2156
2162
|
"stiffness",
|
|
2157
2163
|
"damping",
|
|
2158
2164
|
"impulseClipDuration"
|
|
2159
|
-
]
|
|
2165
|
+
];
|
|
2166
|
+
const impulseChanged = impulseKeys.some((key) => config[key] !== void 0);
|
|
2160
2167
|
const gravityChanged = morphTargetsChanged;
|
|
2161
2168
|
if (idleChanged || morphTargetsChanged) {
|
|
2162
2169
|
this.idleClipDirty = true;
|
|
@@ -2297,7 +2304,7 @@ var HairPhysicsController = class {
|
|
|
2297
2304
|
if (state.position) {
|
|
2298
2305
|
obj.position.set(state.position.x, state.position.y, state.position.z);
|
|
2299
2306
|
}
|
|
2300
|
-
if (state.color && obj.material) {
|
|
2307
|
+
if (state.color && obj.material && !Array.isArray(obj.material)) {
|
|
2301
2308
|
const mat = obj.material;
|
|
2302
2309
|
if (mat.color) {
|
|
2303
2310
|
mat.color.set(state.color.baseColor);
|
|
@@ -2675,35 +2682,29 @@ var HairPhysicsController = class {
|
|
|
2675
2682
|
};
|
|
2676
2683
|
|
|
2677
2684
|
// src/mappings/resolveProfile.ts
|
|
2678
|
-
var
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
}
|
|
2682
|
-
return item;
|
|
2683
|
-
});
|
|
2685
|
+
var isPlainObject = (value) => {
|
|
2686
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2687
|
+
};
|
|
2684
2688
|
var cloneValue = (value) => {
|
|
2685
2689
|
if (Array.isArray(value)) {
|
|
2686
|
-
return
|
|
2690
|
+
return value.map((item) => cloneValue(item));
|
|
2687
2691
|
}
|
|
2688
|
-
if (value
|
|
2692
|
+
if (isPlainObject(value)) {
|
|
2689
2693
|
return { ...value };
|
|
2690
2694
|
}
|
|
2691
2695
|
return value;
|
|
2692
2696
|
};
|
|
2693
2697
|
var mergeRecord = (base, override) => {
|
|
2694
|
-
if (!override) {
|
|
2695
|
-
const next2 = {};
|
|
2696
|
-
for (const [key, value] of Object.entries(base)) {
|
|
2697
|
-
next2[key] = cloneValue(value);
|
|
2698
|
-
}
|
|
2699
|
-
return next2;
|
|
2700
|
-
}
|
|
2701
2698
|
const next = {};
|
|
2702
2699
|
for (const [key, value] of Object.entries(base)) {
|
|
2703
2700
|
next[key] = cloneValue(value);
|
|
2704
2701
|
}
|
|
2705
|
-
|
|
2706
|
-
|
|
2702
|
+
if (override) {
|
|
2703
|
+
for (const [key, value] of Object.entries(override)) {
|
|
2704
|
+
if (value !== void 0) {
|
|
2705
|
+
next[key] = cloneValue(value);
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2707
2708
|
}
|
|
2708
2709
|
return next;
|
|
2709
2710
|
};
|