@lovelace_lol/loom3 1.0.43 → 1.0.45
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 +16 -15
- package/dist/index.cjs +130 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -212
- package/dist/index.d.ts +246 -212
- package/dist/index.js +125 -69
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -53,6 +53,9 @@ function bindingTargets(binding) {
|
|
|
53
53
|
if (targets && targets.length > 0) return targets;
|
|
54
54
|
return binding.morph !== void 0 && binding.morph !== "" ? [binding.morph] : [];
|
|
55
55
|
}
|
|
56
|
+
function normalizeBindingWeight(weight) {
|
|
57
|
+
return Number.isFinite(weight) ? Math.max(0, weight ?? 1) : 1;
|
|
58
|
+
}
|
|
56
59
|
function getProfileVisemeSlots(profile) {
|
|
57
60
|
if (profile.visemeSlots && profile.visemeSlots.length > 0) {
|
|
58
61
|
return [...profile.visemeSlots].sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
|
|
@@ -78,6 +81,23 @@ function compileVisemeKeys(profile) {
|
|
|
78
81
|
return target ?? profile.visemeKeys?.[index] ?? "";
|
|
79
82
|
});
|
|
80
83
|
}
|
|
84
|
+
function getVisemeBindingTargets(profile, visemeIndex) {
|
|
85
|
+
const slots = getProfileVisemeSlots(profile);
|
|
86
|
+
const slot = slots[visemeIndex];
|
|
87
|
+
const binding = slot ? profile.visemeBindings?.[slot.id] : void 0;
|
|
88
|
+
const boundTargets = binding?.targets?.filter((target) => target.morph !== void 0 && target.morph !== "").map((target) => ({
|
|
89
|
+
morph: target.morph,
|
|
90
|
+
weight: normalizeBindingWeight(target.weight)
|
|
91
|
+
}));
|
|
92
|
+
if (boundTargets && boundTargets.length > 0) {
|
|
93
|
+
return boundTargets;
|
|
94
|
+
}
|
|
95
|
+
if (binding?.morph !== void 0 && binding.morph !== "") {
|
|
96
|
+
return [{ morph: binding.morph, weight: 1 }];
|
|
97
|
+
}
|
|
98
|
+
const legacyTarget = profile.visemeKeys?.[visemeIndex];
|
|
99
|
+
return legacyTarget !== void 0 && legacyTarget !== "" ? [{ morph: legacyTarget, weight: 1 }] : [];
|
|
100
|
+
}
|
|
81
101
|
function getVisemeJawAmounts(profile) {
|
|
82
102
|
const slots = getProfileVisemeSlots(profile);
|
|
83
103
|
if (slots.length === 0) return profile.visemeJawAmounts ? [...profile.visemeJawAmounts] : void 0;
|
|
@@ -1714,12 +1734,13 @@ var BakedAnimationController = class {
|
|
|
1714
1734
|
const globalBalance = options?.balance ?? 0;
|
|
1715
1735
|
const balanceMap = options?.balanceMap;
|
|
1716
1736
|
const meshNames = options?.meshNames;
|
|
1737
|
+
const visemeSlotCount = getProfileVisemeSlots(config).length;
|
|
1717
1738
|
let maxTime = 0;
|
|
1718
1739
|
const isNumericAU = (id) => /^\d+$/.test(id);
|
|
1719
1740
|
const isVisemeIndex = (id) => {
|
|
1720
1741
|
if (options?.snippetCategory !== "visemeSnippet") return false;
|
|
1721
1742
|
const num = Number(id);
|
|
1722
|
-
return !Number.isNaN(num) && num >= 0 && num <
|
|
1743
|
+
return !Number.isNaN(num) && num >= 0 && num < visemeSlotCount;
|
|
1723
1744
|
};
|
|
1724
1745
|
const sampleAt = (arr, t) => {
|
|
1725
1746
|
if (!arr.length) return 0;
|
|
@@ -1757,11 +1778,13 @@ var BakedAnimationController = class {
|
|
|
1757
1778
|
const auId = Number(curveId);
|
|
1758
1779
|
if (isVisemeIndex(curveId)) {
|
|
1759
1780
|
const visemeMeshNames = this.getMeshNamesForViseme(config, meshNames);
|
|
1760
|
-
const
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1781
|
+
for (const target of getVisemeBindingTargets(config, auId)) {
|
|
1782
|
+
const effectiveScale = intensityScale * target.weight;
|
|
1783
|
+
if (typeof target.morph === "number") {
|
|
1784
|
+
this.addMorphIndexTracks(tracks, target.morph, keyframes, effectiveScale, visemeMeshNames);
|
|
1785
|
+
} else if (target.morph) {
|
|
1786
|
+
this.addMorphTracks(tracks, target.morph, keyframes, effectiveScale, visemeMeshNames);
|
|
1787
|
+
}
|
|
1765
1788
|
}
|
|
1766
1789
|
} else {
|
|
1767
1790
|
const auMeshNames = this.getMeshNamesForAU(auId, config, meshNames);
|
|
@@ -1804,7 +1827,7 @@ var BakedAnimationController = class {
|
|
|
1804
1827
|
}
|
|
1805
1828
|
const autoVisemeJaw = options?.autoVisemeJaw !== false;
|
|
1806
1829
|
const jawScale = options?.jawScale ?? 1;
|
|
1807
|
-
const visemeJawAmounts = config
|
|
1830
|
+
const visemeJawAmounts = getVisemeJawAmounts(config);
|
|
1808
1831
|
if (autoVisemeJaw && jawScale > 0 && visemeJawAmounts && options?.snippetCategory === "visemeSnippet" && keyframeTimes.length > 0) {
|
|
1809
1832
|
const bones = this.host.getBones();
|
|
1810
1833
|
const jawEntry = bones["JAW"];
|
|
@@ -1812,7 +1835,7 @@ var BakedAnimationController = class {
|
|
|
1812
1835
|
const jawValues = [];
|
|
1813
1836
|
for (const t of keyframeTimes) {
|
|
1814
1837
|
let jawAmount = 0;
|
|
1815
|
-
for (let visemeIdx = 0; visemeIdx <
|
|
1838
|
+
for (let visemeIdx = 0; visemeIdx < visemeSlotCount; visemeIdx++) {
|
|
1816
1839
|
const visemeCurve = curves[String(visemeIdx)];
|
|
1817
1840
|
if (!visemeCurve) continue;
|
|
1818
1841
|
const visemeValue = clampIntensity(sampleAt(visemeCurve, t) * intensityScale);
|
|
@@ -5340,10 +5363,15 @@ var _Loom3 = class _Loom3 {
|
|
|
5340
5363
|
};
|
|
5341
5364
|
this.resolvedAUMorphTargets.set(auId, resolved);
|
|
5342
5365
|
}
|
|
5343
|
-
for (let i = 0; i < (this.config
|
|
5344
|
-
const key = this.config.visemeKeys[i];
|
|
5366
|
+
for (let i = 0; i < getProfileVisemeSlots(this.config).length; i += 1) {
|
|
5345
5367
|
const visemeMeshNames = this.getMeshNamesForViseme();
|
|
5346
|
-
const targets =
|
|
5368
|
+
const targets = [];
|
|
5369
|
+
for (const bindingTarget of getVisemeBindingTargets(this.config, i)) {
|
|
5370
|
+
const resolved = typeof bindingTarget.morph === "number" ? this.resolveMorphTargetsByIndex(bindingTarget.morph, visemeMeshNames) : this.resolveMorphTargets(bindingTarget.morph, visemeMeshNames);
|
|
5371
|
+
for (const target of resolved) {
|
|
5372
|
+
targets.push({ ...target, weight: bindingTarget.weight });
|
|
5373
|
+
}
|
|
5374
|
+
}
|
|
5347
5375
|
this.resolvedVisemeTargets[i] = targets;
|
|
5348
5376
|
}
|
|
5349
5377
|
}
|
|
@@ -5811,46 +5839,33 @@ var _Loom3 = class _Loom3 {
|
|
|
5811
5839
|
// VISEME CONTROL
|
|
5812
5840
|
// ============================================================================
|
|
5813
5841
|
setViseme(visemeIndex, value, jawScale = 1) {
|
|
5814
|
-
if (visemeIndex < 0 || visemeIndex >= this.
|
|
5842
|
+
if (visemeIndex < 0 || visemeIndex >= this.visemeValues.length) return;
|
|
5815
5843
|
const val = clamp012(value);
|
|
5816
5844
|
this.visemeValues[visemeIndex] = val;
|
|
5817
5845
|
this.visemeJawScales[visemeIndex] = jawScale;
|
|
5818
|
-
|
|
5819
|
-
if (targets && targets.length > 0) {
|
|
5820
|
-
this.applyMorphTargets(targets, val);
|
|
5821
|
-
} else {
|
|
5822
|
-
const morphKey = this.config.visemeKeys[visemeIndex];
|
|
5823
|
-
const visemeMeshNames = this.getMeshNamesForViseme();
|
|
5824
|
-
if (typeof morphKey === "number") {
|
|
5825
|
-
this.setMorphInfluence(morphKey, val, visemeMeshNames);
|
|
5826
|
-
} else if (typeof morphKey === "string") {
|
|
5827
|
-
this.setMorph(morphKey, val, visemeMeshNames);
|
|
5828
|
-
}
|
|
5829
|
-
}
|
|
5830
|
-
const jawAmount = this.getVisemeJawAmount(visemeIndex) * val * jawScale;
|
|
5831
|
-
if (Math.abs(jawScale) > 1e-6 && Math.abs(jawAmount) > 1e-6) {
|
|
5832
|
-
this.updateBoneRotation("JAW", "pitch", jawAmount);
|
|
5833
|
-
}
|
|
5846
|
+
this.applyVisemeRuntimeState();
|
|
5834
5847
|
}
|
|
5835
5848
|
transitionViseme(visemeIndex, to, durationMs = 80, jawScale = 1) {
|
|
5836
|
-
if (visemeIndex < 0 || visemeIndex >= this.
|
|
5849
|
+
if (visemeIndex < 0 || visemeIndex >= this.visemeValues.length) {
|
|
5837
5850
|
return { promise: Promise.resolve(), pause: () => {
|
|
5838
5851
|
}, resume: () => {
|
|
5839
5852
|
}, cancel: () => {
|
|
5840
5853
|
} };
|
|
5841
5854
|
}
|
|
5842
|
-
const morphKey = this.config.visemeKeys[visemeIndex];
|
|
5843
5855
|
const target = clamp012(to);
|
|
5844
|
-
this.visemeValues[visemeIndex]
|
|
5856
|
+
const from = this.visemeValues[visemeIndex] ?? 0;
|
|
5845
5857
|
this.visemeJawScales[visemeIndex] = jawScale;
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5858
|
+
return this.animation.addTransition(
|
|
5859
|
+
`viseme_value_${visemeIndex}`,
|
|
5860
|
+
from,
|
|
5861
|
+
target,
|
|
5862
|
+
durationMs,
|
|
5863
|
+
(value) => {
|
|
5864
|
+
this.visemeValues[visemeIndex] = clamp012(value);
|
|
5865
|
+
this.visemeJawScales[visemeIndex] = jawScale;
|
|
5866
|
+
this.applyVisemeRuntimeState();
|
|
5867
|
+
}
|
|
5868
|
+
);
|
|
5854
5869
|
}
|
|
5855
5870
|
setVisemeById(slotId, value, jawScale = 1) {
|
|
5856
5871
|
const index = getVisemeSlotIndex(this.config, slotId);
|
|
@@ -5914,8 +5929,9 @@ var _Loom3 = class _Loom3 {
|
|
|
5914
5929
|
}
|
|
5915
5930
|
resetToNeutral() {
|
|
5916
5931
|
this.auValues = {};
|
|
5917
|
-
|
|
5918
|
-
this.
|
|
5932
|
+
const visemeCount = getProfileVisemeSlots(this.config).length;
|
|
5933
|
+
this.visemeValues = new Array(visemeCount).fill(0);
|
|
5934
|
+
this.visemeJawScales = new Array(visemeCount).fill(1);
|
|
5919
5935
|
this.translations = {};
|
|
5920
5936
|
this.initBoneRotations();
|
|
5921
5937
|
this.clearTransitions();
|
|
@@ -5949,11 +5965,7 @@ var _Loom3 = class _Loom3 {
|
|
|
5949
5965
|
if (Number.isNaN(auId)) continue;
|
|
5950
5966
|
this.setAU(auId, value, this.auBalances[auId]);
|
|
5951
5967
|
}
|
|
5952
|
-
|
|
5953
|
-
const value = this.visemeValues[visemeIndex] ?? 0;
|
|
5954
|
-
if (value <= 0) continue;
|
|
5955
|
-
this.setViseme(visemeIndex, value, this.visemeJawScales[visemeIndex] ?? 1);
|
|
5956
|
-
}
|
|
5968
|
+
this.applyVisemeRuntimeState();
|
|
5957
5969
|
if (this.model) {
|
|
5958
5970
|
this.flushPendingComposites();
|
|
5959
5971
|
this.model.updateMatrixWorld(true);
|
|
@@ -6311,6 +6323,37 @@ var _Loom3 = class _Loom3 {
|
|
|
6311
6323
|
target.infl[target.idx] = val;
|
|
6312
6324
|
}
|
|
6313
6325
|
}
|
|
6326
|
+
applyVisemeRuntimeState() {
|
|
6327
|
+
for (const targets of this.resolvedVisemeTargets) {
|
|
6328
|
+
for (const target of targets || []) {
|
|
6329
|
+
if (target.idx < target.infl.length) {
|
|
6330
|
+
target.infl[target.idx] = 0;
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
}
|
|
6334
|
+
for (let index = 0; index < this.visemeValues.length; index += 1) {
|
|
6335
|
+
const value = clamp012(this.visemeValues[index] ?? 0);
|
|
6336
|
+
if (value <= 1e-6) continue;
|
|
6337
|
+
const targets = this.resolvedVisemeTargets[index] || [];
|
|
6338
|
+
for (const target of targets) {
|
|
6339
|
+
if (target.idx >= target.infl.length) continue;
|
|
6340
|
+
const weighted = clamp012(value * target.weight);
|
|
6341
|
+
target.infl[target.idx] = Math.max(target.infl[target.idx] ?? 0, weighted);
|
|
6342
|
+
}
|
|
6343
|
+
}
|
|
6344
|
+
this.updateBoneRotation("JAW", "pitch", this.getActiveVisemeJawAmount());
|
|
6345
|
+
}
|
|
6346
|
+
getActiveVisemeJawAmount() {
|
|
6347
|
+
let jawAmount = 0;
|
|
6348
|
+
for (let index = 0; index < this.visemeValues.length; index += 1) {
|
|
6349
|
+
const value = clamp012(this.visemeValues[index] ?? 0);
|
|
6350
|
+
if (value <= 1e-6) continue;
|
|
6351
|
+
const jawScale = this.visemeJawScales[index] ?? 1;
|
|
6352
|
+
if (Math.abs(jawScale) <= 1e-6) continue;
|
|
6353
|
+
jawAmount = Math.max(jawAmount, this.getVisemeJawAmount(index) * value * jawScale);
|
|
6354
|
+
}
|
|
6355
|
+
return jawAmount;
|
|
6356
|
+
}
|
|
6314
6357
|
getMorphValue(key) {
|
|
6315
6358
|
if (this.faceMesh) {
|
|
6316
6359
|
const dict = this.faceMesh.morphTargetDictionary;
|
|
@@ -6496,7 +6539,7 @@ var _Loom3 = class _Loom3 {
|
|
|
6496
6539
|
return meshNames?.length ? `idx:${index}@${meshNames.join(",")}` : `idx:${index}`;
|
|
6497
6540
|
}
|
|
6498
6541
|
syncVisemeRuntimeState() {
|
|
6499
|
-
const visemeCount = this.config.
|
|
6542
|
+
const visemeCount = getProfileVisemeSlots(this.config).length;
|
|
6500
6543
|
this.visemeValues = Array.from(
|
|
6501
6544
|
{ length: visemeCount },
|
|
6502
6545
|
(_, index) => this.visemeValues[index] ?? 0
|
|
@@ -6968,7 +7011,7 @@ function normalizeRegionTree(regions, disabledNames) {
|
|
|
6968
7011
|
});
|
|
6969
7012
|
}
|
|
6970
7013
|
|
|
6971
|
-
// src/
|
|
7014
|
+
// src/profiles/resolveProfileConfig.ts
|
|
6972
7015
|
var PROFILE_OVERRIDE_KEYS = [
|
|
6973
7016
|
"name",
|
|
6974
7017
|
"animalType",
|
|
@@ -7075,7 +7118,7 @@ function mergeRegion(base, override) {
|
|
|
7075
7118
|
} : void 0
|
|
7076
7119
|
};
|
|
7077
7120
|
}
|
|
7078
|
-
function
|
|
7121
|
+
function mergeProfileRegionsByName(base, override) {
|
|
7079
7122
|
if (!base && !override) return void 0;
|
|
7080
7123
|
const merged = /* @__PURE__ */ new Map();
|
|
7081
7124
|
for (const region of base ?? []) {
|
|
@@ -7090,6 +7133,10 @@ function mergeRegionsByName(base, override) {
|
|
|
7090
7133
|
function getAnnotationRegions(value) {
|
|
7091
7134
|
return Array.isArray(value) ? value : void 0;
|
|
7092
7135
|
}
|
|
7136
|
+
var mergeRegionsByName = mergeProfileRegionsByName;
|
|
7137
|
+
function getProfilePresetId(config) {
|
|
7138
|
+
return config.profilePresetId ?? config.presetId ?? config.baseProfileId ?? config.auPresetType;
|
|
7139
|
+
}
|
|
7093
7140
|
function getLegacyNestedOverrides(config) {
|
|
7094
7141
|
return isPlainObject2(config.profile) ? config.profile : {};
|
|
7095
7142
|
}
|
|
@@ -7097,12 +7144,12 @@ function getLegacyRuntimeRegions(config) {
|
|
|
7097
7144
|
return Array.isArray(config.regions) && config.regions.length > 0 ? config.regions : void 0;
|
|
7098
7145
|
}
|
|
7099
7146
|
function getCanonicalAnnotationOverrides(config) {
|
|
7100
|
-
return
|
|
7147
|
+
return mergeProfileRegionsByName(
|
|
7101
7148
|
getAnnotationRegions(getLegacyNestedOverrides(config).annotationRegions),
|
|
7102
7149
|
getAnnotationRegions(config.annotationRegions)
|
|
7103
7150
|
);
|
|
7104
7151
|
}
|
|
7105
|
-
function
|
|
7152
|
+
function extractLegacyCharacterProfileOverrides(config) {
|
|
7106
7153
|
const topLevelConfig = config;
|
|
7107
7154
|
const legacyNestedOverrides = getLegacyNestedOverrides(config);
|
|
7108
7155
|
const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
|
|
@@ -7125,12 +7172,18 @@ function extractProfileOverrides(config) {
|
|
|
7125
7172
|
}
|
|
7126
7173
|
return overrides;
|
|
7127
7174
|
}
|
|
7128
|
-
function
|
|
7129
|
-
|
|
7175
|
+
function extractProfileOverrides(config) {
|
|
7176
|
+
return extractLegacyCharacterProfileOverrides(config);
|
|
7177
|
+
}
|
|
7178
|
+
function resolveProfileFromPreset(config) {
|
|
7179
|
+
const presetType = getProfilePresetId(config);
|
|
7130
7180
|
if (!presetType) {
|
|
7131
7181
|
return null;
|
|
7132
7182
|
}
|
|
7133
|
-
return extendPresetWithProfile(getPreset(presetType),
|
|
7183
|
+
return extendPresetWithProfile(getPreset(presetType), extractLegacyCharacterProfileOverrides(config));
|
|
7184
|
+
}
|
|
7185
|
+
function applyCharacterProfileToPreset(config) {
|
|
7186
|
+
return resolveProfileFromPreset(config);
|
|
7134
7187
|
}
|
|
7135
7188
|
function orderExtendedRegions(extendedRegions, prioritizedLists) {
|
|
7136
7189
|
if (!extendedRegions) return void 0;
|
|
@@ -7151,15 +7204,15 @@ function orderExtendedRegions(extendedRegions, prioritizedLists) {
|
|
|
7151
7204
|
}
|
|
7152
7205
|
return orderedNames.map((name) => extendedByName.get(name)).filter((region) => Boolean(region));
|
|
7153
7206
|
}
|
|
7154
|
-
function
|
|
7155
|
-
const presetType = config
|
|
7207
|
+
function extendProfileConfigWithPreset(config) {
|
|
7208
|
+
const presetType = getProfilePresetId(config);
|
|
7156
7209
|
if (!presetType || presetType === "custom") {
|
|
7157
7210
|
return config;
|
|
7158
7211
|
}
|
|
7159
7212
|
const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
|
|
7160
7213
|
const legacyRuntimeRegions = getLegacyRuntimeRegions(config);
|
|
7161
|
-
const profileOverrides =
|
|
7162
|
-
const extendedPresetProfile =
|
|
7214
|
+
const profileOverrides = extractLegacyCharacterProfileOverrides(config);
|
|
7215
|
+
const extendedPresetProfile = resolveProfileFromPreset(config);
|
|
7163
7216
|
if (!extendedPresetProfile) {
|
|
7164
7217
|
return config;
|
|
7165
7218
|
}
|
|
@@ -7173,7 +7226,7 @@ function extendCharacterConfigWithPreset(config) {
|
|
|
7173
7226
|
const extendedRegionNames = new Set((extendedAnnotationRegions ?? []).map((region) => region.name));
|
|
7174
7227
|
const legacyExtraRegions = canonicalAnnotationOverrides && legacyRuntimeRegions ? legacyRuntimeRegions.filter((region) => !presetRegionNames.has(region.name) && !extendedRegionNames.has(region.name)).map((region) => cloneRegion(region)) : void 0;
|
|
7175
7228
|
const mergedRegions = normalizeRegionTree(
|
|
7176
|
-
|
|
7229
|
+
mergeProfileRegionsByName(extendedAnnotationRegions, legacyExtraRegions),
|
|
7177
7230
|
profileOverrides.disabledRegions
|
|
7178
7231
|
);
|
|
7179
7232
|
const extendedRegions = orderExtendedRegions(
|
|
@@ -7187,6 +7240,9 @@ function extendCharacterConfigWithPreset(config) {
|
|
|
7187
7240
|
regions: extendedRegions ?? config.regions
|
|
7188
7241
|
};
|
|
7189
7242
|
}
|
|
7243
|
+
function extendCharacterConfigWithPreset(config) {
|
|
7244
|
+
return extendProfileConfigWithPreset(config);
|
|
7245
|
+
}
|
|
7190
7246
|
var DEFAULT_EPSILON = 1e-4;
|
|
7191
7247
|
var DEFAULT_YAW_WEIGHT = 0.35;
|
|
7192
7248
|
var DEFAULT_PITCH_WEIGHT = 0.2;
|
|
@@ -7411,9 +7467,9 @@ function detectFacingDirection(model, eyeBoneNames = {
|
|
|
7411
7467
|
function normalizeLooseName(value) {
|
|
7412
7468
|
return value.replace(/\./g, "");
|
|
7413
7469
|
}
|
|
7414
|
-
function resolveBoneNameCandidates(semanticName,
|
|
7415
|
-
if (!
|
|
7416
|
-
const { bonePrefix, boneSuffix, boneNodes } =
|
|
7470
|
+
function resolveBoneNameCandidates(semanticName, profile) {
|
|
7471
|
+
if (!profile) return [semanticName];
|
|
7472
|
+
const { bonePrefix, boneSuffix, boneNodes } = profile;
|
|
7417
7473
|
if (!boneNodes || !boneNodes[semanticName]) {
|
|
7418
7474
|
return [semanticName];
|
|
7419
7475
|
}
|
|
@@ -7427,14 +7483,14 @@ function resolveBoneNameCandidates(semanticName, config) {
|
|
|
7427
7483
|
const fullyAffixed = suffix && !prefixedBase.endsWith(suffix) ? `${prefixedBase}${suffix}` : prefixedBase;
|
|
7428
7484
|
return Array.from(/* @__PURE__ */ new Set([fullyAffixed, baseName]));
|
|
7429
7485
|
}
|
|
7430
|
-
function resolveBoneName(semanticName,
|
|
7431
|
-
return resolveBoneNameCandidates(semanticName,
|
|
7486
|
+
function resolveBoneName(semanticName, profile) {
|
|
7487
|
+
return resolveBoneNameCandidates(semanticName, profile)[0] ?? semanticName;
|
|
7432
7488
|
}
|
|
7433
|
-
function resolveBoneNames(names,
|
|
7489
|
+
function resolveBoneNames(names, profile) {
|
|
7434
7490
|
if (!names || names.length === 0) return [];
|
|
7435
7491
|
return Array.from(
|
|
7436
7492
|
new Set(
|
|
7437
|
-
names.flatMap((name) => resolveBoneNameCandidates(name,
|
|
7493
|
+
names.flatMap((name) => resolveBoneNameCandidates(name, profile))
|
|
7438
7494
|
)
|
|
7439
7495
|
);
|
|
7440
7496
|
}
|
|
@@ -7447,8 +7503,8 @@ function fuzzyNameMatch(objectName, targetName, suffixPattern) {
|
|
|
7447
7503
|
const regex = suffixPattern ? new RegExp(suffixPattern) : /^[_\.]\d+$/;
|
|
7448
7504
|
return regex.test(suffix);
|
|
7449
7505
|
}
|
|
7450
|
-
function resolveFaceCenter(model, region,
|
|
7451
|
-
const resolvedBones = resolveBoneNames(region.bones,
|
|
7506
|
+
function resolveFaceCenter(model, region, profile) {
|
|
7507
|
+
const resolvedBones = resolveBoneNames(region.bones, profile);
|
|
7452
7508
|
const headBoneNames = resolvedBones.filter((name) => name.toLowerCase().includes("head"));
|
|
7453
7509
|
const result = findFaceCenter(model, {
|
|
7454
7510
|
headBoneNames: headBoneNames.length > 0 ? headBoneNames : void 0,
|
|
@@ -8569,6 +8625,6 @@ async function analyzeModel(options) {
|
|
|
8569
8625
|
};
|
|
8570
8626
|
}
|
|
8571
8627
|
|
|
8572
|
-
export { AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, AnimationThree, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, CC4_BONE_NODES, CC4_BONE_PREFIX, CC4_EYE_MESH_NODES, CC4_MAPPING_SECTIONS, CC4_MESHES, CC4_PRESET, CC4_SUFFIX_PATTERN, CC4_VISEME_SLOTS, CC4_VISEME_SYSTEM_ID, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, DEFAULT_HAIR_PHYSICS_CONFIG, FISH_AU_MAPPING_CONFIG, HairPhysics, Loom3, Loom3 as Loom3Three, Loom3 as LoomLargeThree, MORPH_TO_MESH, VISEME_JAW_AMOUNTS, VISEME_KEYS, analyzeModel, applyCharacterProfileToPreset, buildMappingEditorModel, collectMorphMeshes, compileVisemeKeys, computeCameraRelativeGazeOffset, detectFacingDirection, extendCharacterConfigWithPreset, extendPresetWithProfile, extractFromGLTF, extractModelData, extractProfileOverrides, findFaceCenter, fuzzyNameMatch, generateMappingCorrections, getMeshNamesForAUProfile, getMeshNamesForVisemeProfile, getModelForwardDirection, getPreset, getPresetWithProfile, getProfileVisemeSlots, getVisemeJawAmounts, getVisemeSlotIndex, hasLeftRightMorphs, isMixedAU, isPresetCompatible, mapProviderVisemeToSlot, mergeRegionsByName as mergeCharacterRegionsByName, resolveBoneName, resolveBoneNames, resolveFaceCenter, resolvePreset, resolvePresetWithOverrides, resolveVisemeMeshCategory, suggestBestPreset, validateMappingConfig, validateMappings };
|
|
8628
|
+
export { AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, AnimationThree, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, CC4_BONE_NODES, CC4_BONE_PREFIX, CC4_EYE_MESH_NODES, CC4_MAPPING_SECTIONS, CC4_MESHES, CC4_PRESET, CC4_SUFFIX_PATTERN, CC4_VISEME_SLOTS, CC4_VISEME_SYSTEM_ID, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, DEFAULT_HAIR_PHYSICS_CONFIG, FISH_AU_MAPPING_CONFIG, HairPhysics, Loom3, Loom3 as Loom3Three, Loom3 as LoomLargeThree, MORPH_TO_MESH, VISEME_JAW_AMOUNTS, VISEME_KEYS, analyzeModel, applyCharacterProfileToPreset, buildMappingEditorModel, collectMorphMeshes, compileVisemeKeys, computeCameraRelativeGazeOffset, detectFacingDirection, extendCharacterConfigWithPreset, extendPresetWithProfile, extendProfileConfigWithPreset, extractFromGLTF, extractLegacyCharacterProfileOverrides, extractModelData, extractProfileOverrides, findFaceCenter, fuzzyNameMatch, generateMappingCorrections, getMeshNamesForAUProfile, getMeshNamesForVisemeProfile, getModelForwardDirection, getPreset, getPresetWithProfile, getProfilePresetId, getProfileVisemeSlots, getVisemeBindingTargets, getVisemeJawAmounts, getVisemeSlotIndex, hasLeftRightMorphs, isMixedAU, isPresetCompatible, mapProviderVisemeToSlot, mergeRegionsByName as mergeCharacterRegionsByName, mergeProfileRegionsByName, resolveBoneName, resolveBoneNames, resolveFaceCenter, resolvePreset, resolvePresetWithOverrides, resolveProfileFromPreset, resolveVisemeMeshCategory, suggestBestPreset, validateMappingConfig, validateMappings };
|
|
8573
8629
|
//# sourceMappingURL=index.js.map
|
|
8574
8630
|
//# sourceMappingURL=index.js.map
|