@lovelace_lol/loom3 1.0.44 → 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 +39 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +239 -212
- package/dist/index.d.ts +239 -212
- package/dist/index.js +35 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7011,7 +7011,7 @@ function normalizeRegionTree(regions, disabledNames) {
|
|
|
7011
7011
|
});
|
|
7012
7012
|
}
|
|
7013
7013
|
|
|
7014
|
-
// src/
|
|
7014
|
+
// src/profiles/resolveProfileConfig.ts
|
|
7015
7015
|
var PROFILE_OVERRIDE_KEYS = [
|
|
7016
7016
|
"name",
|
|
7017
7017
|
"animalType",
|
|
@@ -7118,7 +7118,7 @@ function mergeRegion(base, override) {
|
|
|
7118
7118
|
} : void 0
|
|
7119
7119
|
};
|
|
7120
7120
|
}
|
|
7121
|
-
function
|
|
7121
|
+
function mergeProfileRegionsByName(base, override) {
|
|
7122
7122
|
if (!base && !override) return void 0;
|
|
7123
7123
|
const merged = /* @__PURE__ */ new Map();
|
|
7124
7124
|
for (const region of base ?? []) {
|
|
@@ -7133,6 +7133,10 @@ function mergeRegionsByName(base, override) {
|
|
|
7133
7133
|
function getAnnotationRegions(value) {
|
|
7134
7134
|
return Array.isArray(value) ? value : void 0;
|
|
7135
7135
|
}
|
|
7136
|
+
var mergeRegionsByName = mergeProfileRegionsByName;
|
|
7137
|
+
function getProfilePresetId(config) {
|
|
7138
|
+
return config.profilePresetId ?? config.presetId ?? config.baseProfileId ?? config.auPresetType;
|
|
7139
|
+
}
|
|
7136
7140
|
function getLegacyNestedOverrides(config) {
|
|
7137
7141
|
return isPlainObject2(config.profile) ? config.profile : {};
|
|
7138
7142
|
}
|
|
@@ -7140,12 +7144,12 @@ function getLegacyRuntimeRegions(config) {
|
|
|
7140
7144
|
return Array.isArray(config.regions) && config.regions.length > 0 ? config.regions : void 0;
|
|
7141
7145
|
}
|
|
7142
7146
|
function getCanonicalAnnotationOverrides(config) {
|
|
7143
|
-
return
|
|
7147
|
+
return mergeProfileRegionsByName(
|
|
7144
7148
|
getAnnotationRegions(getLegacyNestedOverrides(config).annotationRegions),
|
|
7145
7149
|
getAnnotationRegions(config.annotationRegions)
|
|
7146
7150
|
);
|
|
7147
7151
|
}
|
|
7148
|
-
function
|
|
7152
|
+
function extractLegacyCharacterProfileOverrides(config) {
|
|
7149
7153
|
const topLevelConfig = config;
|
|
7150
7154
|
const legacyNestedOverrides = getLegacyNestedOverrides(config);
|
|
7151
7155
|
const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
|
|
@@ -7168,12 +7172,18 @@ function extractProfileOverrides(config) {
|
|
|
7168
7172
|
}
|
|
7169
7173
|
return overrides;
|
|
7170
7174
|
}
|
|
7171
|
-
function
|
|
7172
|
-
|
|
7175
|
+
function extractProfileOverrides(config) {
|
|
7176
|
+
return extractLegacyCharacterProfileOverrides(config);
|
|
7177
|
+
}
|
|
7178
|
+
function resolveProfileFromPreset(config) {
|
|
7179
|
+
const presetType = getProfilePresetId(config);
|
|
7173
7180
|
if (!presetType) {
|
|
7174
7181
|
return null;
|
|
7175
7182
|
}
|
|
7176
|
-
return extendPresetWithProfile(getPreset(presetType),
|
|
7183
|
+
return extendPresetWithProfile(getPreset(presetType), extractLegacyCharacterProfileOverrides(config));
|
|
7184
|
+
}
|
|
7185
|
+
function applyCharacterProfileToPreset(config) {
|
|
7186
|
+
return resolveProfileFromPreset(config);
|
|
7177
7187
|
}
|
|
7178
7188
|
function orderExtendedRegions(extendedRegions, prioritizedLists) {
|
|
7179
7189
|
if (!extendedRegions) return void 0;
|
|
@@ -7194,15 +7204,15 @@ function orderExtendedRegions(extendedRegions, prioritizedLists) {
|
|
|
7194
7204
|
}
|
|
7195
7205
|
return orderedNames.map((name) => extendedByName.get(name)).filter((region) => Boolean(region));
|
|
7196
7206
|
}
|
|
7197
|
-
function
|
|
7198
|
-
const presetType = config
|
|
7207
|
+
function extendProfileConfigWithPreset(config) {
|
|
7208
|
+
const presetType = getProfilePresetId(config);
|
|
7199
7209
|
if (!presetType || presetType === "custom") {
|
|
7200
7210
|
return config;
|
|
7201
7211
|
}
|
|
7202
7212
|
const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
|
|
7203
7213
|
const legacyRuntimeRegions = getLegacyRuntimeRegions(config);
|
|
7204
|
-
const profileOverrides =
|
|
7205
|
-
const extendedPresetProfile =
|
|
7214
|
+
const profileOverrides = extractLegacyCharacterProfileOverrides(config);
|
|
7215
|
+
const extendedPresetProfile = resolveProfileFromPreset(config);
|
|
7206
7216
|
if (!extendedPresetProfile) {
|
|
7207
7217
|
return config;
|
|
7208
7218
|
}
|
|
@@ -7216,7 +7226,7 @@ function extendCharacterConfigWithPreset(config) {
|
|
|
7216
7226
|
const extendedRegionNames = new Set((extendedAnnotationRegions ?? []).map((region) => region.name));
|
|
7217
7227
|
const legacyExtraRegions = canonicalAnnotationOverrides && legacyRuntimeRegions ? legacyRuntimeRegions.filter((region) => !presetRegionNames.has(region.name) && !extendedRegionNames.has(region.name)).map((region) => cloneRegion(region)) : void 0;
|
|
7218
7228
|
const mergedRegions = normalizeRegionTree(
|
|
7219
|
-
|
|
7229
|
+
mergeProfileRegionsByName(extendedAnnotationRegions, legacyExtraRegions),
|
|
7220
7230
|
profileOverrides.disabledRegions
|
|
7221
7231
|
);
|
|
7222
7232
|
const extendedRegions = orderExtendedRegions(
|
|
@@ -7230,6 +7240,9 @@ function extendCharacterConfigWithPreset(config) {
|
|
|
7230
7240
|
regions: extendedRegions ?? config.regions
|
|
7231
7241
|
};
|
|
7232
7242
|
}
|
|
7243
|
+
function extendCharacterConfigWithPreset(config) {
|
|
7244
|
+
return extendProfileConfigWithPreset(config);
|
|
7245
|
+
}
|
|
7233
7246
|
var DEFAULT_EPSILON = 1e-4;
|
|
7234
7247
|
var DEFAULT_YAW_WEIGHT = 0.35;
|
|
7235
7248
|
var DEFAULT_PITCH_WEIGHT = 0.2;
|
|
@@ -7454,9 +7467,9 @@ function detectFacingDirection(model, eyeBoneNames = {
|
|
|
7454
7467
|
function normalizeLooseName(value) {
|
|
7455
7468
|
return value.replace(/\./g, "");
|
|
7456
7469
|
}
|
|
7457
|
-
function resolveBoneNameCandidates(semanticName,
|
|
7458
|
-
if (!
|
|
7459
|
-
const { bonePrefix, boneSuffix, boneNodes } =
|
|
7470
|
+
function resolveBoneNameCandidates(semanticName, profile) {
|
|
7471
|
+
if (!profile) return [semanticName];
|
|
7472
|
+
const { bonePrefix, boneSuffix, boneNodes } = profile;
|
|
7460
7473
|
if (!boneNodes || !boneNodes[semanticName]) {
|
|
7461
7474
|
return [semanticName];
|
|
7462
7475
|
}
|
|
@@ -7470,14 +7483,14 @@ function resolveBoneNameCandidates(semanticName, config) {
|
|
|
7470
7483
|
const fullyAffixed = suffix && !prefixedBase.endsWith(suffix) ? `${prefixedBase}${suffix}` : prefixedBase;
|
|
7471
7484
|
return Array.from(/* @__PURE__ */ new Set([fullyAffixed, baseName]));
|
|
7472
7485
|
}
|
|
7473
|
-
function resolveBoneName(semanticName,
|
|
7474
|
-
return resolveBoneNameCandidates(semanticName,
|
|
7486
|
+
function resolveBoneName(semanticName, profile) {
|
|
7487
|
+
return resolveBoneNameCandidates(semanticName, profile)[0] ?? semanticName;
|
|
7475
7488
|
}
|
|
7476
|
-
function resolveBoneNames(names,
|
|
7489
|
+
function resolveBoneNames(names, profile) {
|
|
7477
7490
|
if (!names || names.length === 0) return [];
|
|
7478
7491
|
return Array.from(
|
|
7479
7492
|
new Set(
|
|
7480
|
-
names.flatMap((name) => resolveBoneNameCandidates(name,
|
|
7493
|
+
names.flatMap((name) => resolveBoneNameCandidates(name, profile))
|
|
7481
7494
|
)
|
|
7482
7495
|
);
|
|
7483
7496
|
}
|
|
@@ -7490,8 +7503,8 @@ function fuzzyNameMatch(objectName, targetName, suffixPattern) {
|
|
|
7490
7503
|
const regex = suffixPattern ? new RegExp(suffixPattern) : /^[_\.]\d+$/;
|
|
7491
7504
|
return regex.test(suffix);
|
|
7492
7505
|
}
|
|
7493
|
-
function resolveFaceCenter(model, region,
|
|
7494
|
-
const resolvedBones = resolveBoneNames(region.bones,
|
|
7506
|
+
function resolveFaceCenter(model, region, profile) {
|
|
7507
|
+
const resolvedBones = resolveBoneNames(region.bones, profile);
|
|
7495
7508
|
const headBoneNames = resolvedBones.filter((name) => name.toLowerCase().includes("head"));
|
|
7496
7509
|
const result = findFaceCenter(model, {
|
|
7497
7510
|
headBoneNames: headBoneNames.length > 0 ? headBoneNames : void 0,
|
|
@@ -8612,6 +8625,6 @@ async function analyzeModel(options) {
|
|
|
8612
8625
|
};
|
|
8613
8626
|
}
|
|
8614
8627
|
|
|
8615
|
-
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, getVisemeBindingTargets, 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 };
|
|
8616
8629
|
//# sourceMappingURL=index.js.map
|
|
8617
8630
|
//# sourceMappingURL=index.js.map
|