@lovelace_lol/loom3 1.0.28 → 1.0.29
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 +3 -3
- package/dist/index.cjs +48 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -4
- package/dist/index.d.ts +18 -4
- package/dist/index.js +48 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -349,13 +349,13 @@ const loom = new Loom3({
|
|
|
349
349
|
|
|
350
350
|
`annotationRegions` is the Loom3 field for camera/marker region defaults and profile overrides.
|
|
351
351
|
|
|
352
|
-
If your app fetches a full saved `CharacterConfig` from Firestore or another backend, use `
|
|
352
|
+
If your app fetches a full saved `CharacterConfig` from Firestore or another backend, use `extendCharacterConfigWithPreset(...)` to build the runtime shape before handing that config to camera/marker tooling:
|
|
353
353
|
|
|
354
354
|
```typescript
|
|
355
|
-
import {
|
|
355
|
+
import { extendCharacterConfigWithPreset } from '@lovelace_lol/loom3';
|
|
356
356
|
|
|
357
357
|
const savedConfig = await fetchCharacterConfig();
|
|
358
|
-
const runtimeConfig =
|
|
358
|
+
const runtimeConfig = extendCharacterConfigWithPreset(savedConfig);
|
|
359
359
|
```
|
|
360
360
|
|
|
361
361
|
For the current runtime-oriented documentation, including:
|
package/dist/index.cjs
CHANGED
|
@@ -1887,7 +1887,17 @@ var CC4_BONE_NODES = {
|
|
|
1887
1887
|
NECK: "NeckTwist01",
|
|
1888
1888
|
NECK_TWIST: "NeckTwist02",
|
|
1889
1889
|
JAW: "JawRoot",
|
|
1890
|
-
TONGUE: "Tongue01"
|
|
1890
|
+
TONGUE: "Tongue01",
|
|
1891
|
+
SPINE_01: "Spine01",
|
|
1892
|
+
SPINE_02: "Spine02",
|
|
1893
|
+
CLAVICLE_L: "L_Clavicle",
|
|
1894
|
+
CLAVICLE_R: "R_Clavicle",
|
|
1895
|
+
HAND_L: "L_Hand",
|
|
1896
|
+
HAND_R: "R_Hand",
|
|
1897
|
+
FOOT_L: "L_Foot",
|
|
1898
|
+
FOOT_R: "R_Foot",
|
|
1899
|
+
TOEBASE_L: "L_ToeBase",
|
|
1900
|
+
TOEBASE_R: "R_ToeBase"
|
|
1891
1901
|
};
|
|
1892
1902
|
var CC4_EYE_MESH_NODES = {
|
|
1893
1903
|
LEFT: "CC_Base_Eye",
|
|
@@ -2125,7 +2135,7 @@ var CC4_PRESET = {
|
|
|
2125
2135
|
},
|
|
2126
2136
|
{
|
|
2127
2137
|
name: "head",
|
|
2128
|
-
bones: ["
|
|
2138
|
+
bones: ["HEAD", "JAW"],
|
|
2129
2139
|
paddingFactor: 1.5,
|
|
2130
2140
|
children: ["face", "left_eye", "right_eye", "mouth"],
|
|
2131
2141
|
expandAnimation: "staggered",
|
|
@@ -2133,66 +2143,66 @@ var CC4_PRESET = {
|
|
|
2133
2143
|
},
|
|
2134
2144
|
{
|
|
2135
2145
|
name: "face",
|
|
2136
|
-
bones: ["
|
|
2146
|
+
bones: ["HEAD"],
|
|
2137
2147
|
// meshes: populated by user selection in wizard - varies per character
|
|
2138
2148
|
paddingFactor: 1.3,
|
|
2139
2149
|
parent: "head"
|
|
2140
2150
|
},
|
|
2141
2151
|
{
|
|
2142
2152
|
name: "left_eye",
|
|
2143
|
-
bones: ["
|
|
2153
|
+
bones: ["EYE_L"],
|
|
2144
2154
|
paddingFactor: 0.9,
|
|
2145
2155
|
parent: "head"
|
|
2146
2156
|
},
|
|
2147
2157
|
{
|
|
2148
2158
|
name: "right_eye",
|
|
2149
|
-
bones: ["
|
|
2159
|
+
bones: ["EYE_R"],
|
|
2150
2160
|
paddingFactor: 0.9,
|
|
2151
2161
|
parent: "head"
|
|
2152
2162
|
},
|
|
2153
2163
|
{
|
|
2154
2164
|
name: "mouth",
|
|
2155
|
-
bones: ["
|
|
2165
|
+
bones: ["JAW"],
|
|
2156
2166
|
paddingFactor: 1.5,
|
|
2157
2167
|
parent: "head"
|
|
2158
2168
|
},
|
|
2159
2169
|
{
|
|
2160
2170
|
name: "upper_body",
|
|
2161
2171
|
bones: [
|
|
2162
|
-
"
|
|
2163
|
-
"
|
|
2164
|
-
"
|
|
2165
|
-
"
|
|
2172
|
+
"SPINE_02",
|
|
2173
|
+
"HEAD",
|
|
2174
|
+
"CLAVICLE_L",
|
|
2175
|
+
"CLAVICLE_R"
|
|
2166
2176
|
],
|
|
2167
2177
|
paddingFactor: 1.6
|
|
2168
2178
|
},
|
|
2169
2179
|
{
|
|
2170
2180
|
name: "back",
|
|
2171
|
-
bones: ["
|
|
2181
|
+
bones: ["SPINE_01", "SPINE_02"],
|
|
2172
2182
|
paddingFactor: 1.8,
|
|
2173
2183
|
cameraAngle: 180
|
|
2174
2184
|
},
|
|
2175
2185
|
{
|
|
2176
2186
|
name: "left_hand",
|
|
2177
|
-
bones: ["
|
|
2187
|
+
bones: ["HAND_L"],
|
|
2178
2188
|
paddingFactor: 1.3,
|
|
2179
2189
|
cameraAngle: 270
|
|
2180
2190
|
},
|
|
2181
2191
|
{
|
|
2182
2192
|
name: "right_hand",
|
|
2183
|
-
bones: ["
|
|
2193
|
+
bones: ["HAND_R"],
|
|
2184
2194
|
paddingFactor: 1.3,
|
|
2185
2195
|
cameraAngle: 90
|
|
2186
2196
|
},
|
|
2187
2197
|
{
|
|
2188
2198
|
name: "left_foot",
|
|
2189
|
-
bones: ["
|
|
2199
|
+
bones: ["FOOT_L", "TOEBASE_L"],
|
|
2190
2200
|
paddingFactor: 2.5,
|
|
2191
2201
|
cameraAngle: 270
|
|
2192
2202
|
},
|
|
2193
2203
|
{
|
|
2194
2204
|
name: "right_foot",
|
|
2195
|
-
bones: ["
|
|
2205
|
+
bones: ["FOOT_R", "TOEBASE_R"],
|
|
2196
2206
|
paddingFactor: 2.5,
|
|
2197
2207
|
cameraAngle: 90
|
|
2198
2208
|
}
|
|
@@ -5447,13 +5457,6 @@ function mergeRegion(base, override) {
|
|
|
5447
5457
|
} : void 0
|
|
5448
5458
|
};
|
|
5449
5459
|
}
|
|
5450
|
-
function mergeStringRecord(base, override) {
|
|
5451
|
-
if (!base && !override) return void 0;
|
|
5452
|
-
return {
|
|
5453
|
-
...base ? { ...base } : {},
|
|
5454
|
-
...override ? { ...override } : {}
|
|
5455
|
-
};
|
|
5456
|
-
}
|
|
5457
5460
|
function mergeRegionsByName(base, override) {
|
|
5458
5461
|
if (!base && !override) return void 0;
|
|
5459
5462
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -5519,7 +5522,7 @@ function orderResolvedRegions(resolvedRegions, prioritizedLists) {
|
|
|
5519
5522
|
}
|
|
5520
5523
|
return orderedNames.map((name) => resolvedByName.get(name)).filter((region) => Boolean(region));
|
|
5521
5524
|
}
|
|
5522
|
-
function
|
|
5525
|
+
function extendCharacterConfigWithPreset(config) {
|
|
5523
5526
|
const presetType = config.auPresetType;
|
|
5524
5527
|
if (!presetType || presetType === "custom") {
|
|
5525
5528
|
return config;
|
|
@@ -5537,13 +5540,13 @@ function resolveCharacterConfig(config) {
|
|
|
5537
5540
|
);
|
|
5538
5541
|
return {
|
|
5539
5542
|
...config,
|
|
5540
|
-
|
|
5541
|
-
boneSuffix: config.boneSuffix ?? presetResolvedProfile.boneSuffix,
|
|
5542
|
-
boneNodes: mergeStringRecord(presetResolvedProfile.boneNodes, config.boneNodes),
|
|
5543
|
-
suffixPattern: config.suffixPattern ?? presetResolvedProfile.suffixPattern,
|
|
5543
|
+
...presetResolvedProfile,
|
|
5544
5544
|
regions: resolvedRegions ?? config.regions
|
|
5545
5545
|
};
|
|
5546
5546
|
}
|
|
5547
|
+
function resolveCharacterConfig(config) {
|
|
5548
|
+
return extendCharacterConfigWithPreset(config);
|
|
5549
|
+
}
|
|
5547
5550
|
var DEFAULT_HEAD_BONE_NAMES = ["CC_Base_Head", "Head", "head", "Bip01_Head"];
|
|
5548
5551
|
var DEFAULT_REFERENCE_HEIGHT = 1.8;
|
|
5549
5552
|
var DEFAULT_FORWARD_OFFSET = 0.08;
|
|
@@ -5731,23 +5734,32 @@ function detectFacingDirection(model, eyeBoneNames = {
|
|
|
5731
5734
|
function normalizeLooseName(value) {
|
|
5732
5735
|
return value.replace(/\./g, "");
|
|
5733
5736
|
}
|
|
5734
|
-
function
|
|
5735
|
-
if (!config) return semanticName;
|
|
5737
|
+
function resolveBoneNameCandidates(semanticName, config) {
|
|
5738
|
+
if (!config) return [semanticName];
|
|
5736
5739
|
const { bonePrefix, boneSuffix, boneNodes } = config;
|
|
5737
5740
|
if (!boneNodes || !boneNodes[semanticName]) {
|
|
5738
|
-
return semanticName;
|
|
5741
|
+
return [semanticName];
|
|
5739
5742
|
}
|
|
5740
5743
|
const baseName = boneNodes[semanticName];
|
|
5741
|
-
if (baseName.includes("_") || baseName.includes(".")) {
|
|
5742
|
-
return baseName;
|
|
5743
|
-
}
|
|
5744
5744
|
const prefix = bonePrefix || "";
|
|
5745
5745
|
const suffix = boneSuffix || "";
|
|
5746
|
-
|
|
5746
|
+
if (!prefix && !suffix) {
|
|
5747
|
+
return [baseName];
|
|
5748
|
+
}
|
|
5749
|
+
const prefixedBase = prefix && baseName.startsWith(prefix) ? baseName : prefix + baseName;
|
|
5750
|
+
const fullyAffixed = suffix && !prefixedBase.endsWith(suffix) ? `${prefixedBase}${suffix}` : prefixedBase;
|
|
5751
|
+
return Array.from(/* @__PURE__ */ new Set([fullyAffixed, baseName]));
|
|
5752
|
+
}
|
|
5753
|
+
function resolveBoneName(semanticName, config) {
|
|
5754
|
+
return resolveBoneNameCandidates(semanticName, config)[0] ?? semanticName;
|
|
5747
5755
|
}
|
|
5748
5756
|
function resolveBoneNames(names, config) {
|
|
5749
5757
|
if (!names || names.length === 0) return [];
|
|
5750
|
-
return
|
|
5758
|
+
return Array.from(
|
|
5759
|
+
new Set(
|
|
5760
|
+
names.flatMap((name) => resolveBoneNameCandidates(name, config))
|
|
5761
|
+
)
|
|
5762
|
+
);
|
|
5751
5763
|
}
|
|
5752
5764
|
function fuzzyNameMatch(objectName, targetName, suffixPattern) {
|
|
5753
5765
|
if (objectName === targetName) return true;
|
|
@@ -6884,6 +6896,7 @@ exports.applyCharacterProfileToPreset = applyCharacterProfileToPreset;
|
|
|
6884
6896
|
exports.applyProfileToPreset = applyProfileToPreset;
|
|
6885
6897
|
exports.collectMorphMeshes = collectMorphMeshes;
|
|
6886
6898
|
exports.detectFacingDirection = detectFacingDirection;
|
|
6899
|
+
exports.extendCharacterConfigWithPreset = extendCharacterConfigWithPreset;
|
|
6887
6900
|
exports.extractFromGLTF = extractFromGLTF;
|
|
6888
6901
|
exports.extractModelData = extractModelData;
|
|
6889
6902
|
exports.extractProfileOverrides = extractProfileOverrides;
|