@lovelace_lol/loom3 1.0.28 → 1.0.30
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 +49 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -7
- package/dist/index.d.ts +18 -7
- package/dist/index.js +49 -38
- 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,74 +2135,73 @@ 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
|
-
expandAnimation: "staggered"
|
|
2132
|
-
showChildConnections: true
|
|
2141
|
+
expandAnimation: "staggered"
|
|
2133
2142
|
},
|
|
2134
2143
|
{
|
|
2135
2144
|
name: "face",
|
|
2136
|
-
bones: ["
|
|
2145
|
+
bones: ["HEAD"],
|
|
2137
2146
|
// meshes: populated by user selection in wizard - varies per character
|
|
2138
2147
|
paddingFactor: 1.3,
|
|
2139
2148
|
parent: "head"
|
|
2140
2149
|
},
|
|
2141
2150
|
{
|
|
2142
2151
|
name: "left_eye",
|
|
2143
|
-
bones: ["
|
|
2152
|
+
bones: ["EYE_L"],
|
|
2144
2153
|
paddingFactor: 0.9,
|
|
2145
2154
|
parent: "head"
|
|
2146
2155
|
},
|
|
2147
2156
|
{
|
|
2148
2157
|
name: "right_eye",
|
|
2149
|
-
bones: ["
|
|
2158
|
+
bones: ["EYE_R"],
|
|
2150
2159
|
paddingFactor: 0.9,
|
|
2151
2160
|
parent: "head"
|
|
2152
2161
|
},
|
|
2153
2162
|
{
|
|
2154
2163
|
name: "mouth",
|
|
2155
|
-
bones: ["
|
|
2164
|
+
bones: ["JAW"],
|
|
2156
2165
|
paddingFactor: 1.5,
|
|
2157
2166
|
parent: "head"
|
|
2158
2167
|
},
|
|
2159
2168
|
{
|
|
2160
2169
|
name: "upper_body",
|
|
2161
2170
|
bones: [
|
|
2162
|
-
"
|
|
2163
|
-
"
|
|
2164
|
-
"
|
|
2165
|
-
"
|
|
2171
|
+
"SPINE_02",
|
|
2172
|
+
"HEAD",
|
|
2173
|
+
"CLAVICLE_L",
|
|
2174
|
+
"CLAVICLE_R"
|
|
2166
2175
|
],
|
|
2167
2176
|
paddingFactor: 1.6
|
|
2168
2177
|
},
|
|
2169
2178
|
{
|
|
2170
2179
|
name: "back",
|
|
2171
|
-
bones: ["
|
|
2180
|
+
bones: ["SPINE_01", "SPINE_02"],
|
|
2172
2181
|
paddingFactor: 1.8,
|
|
2173
2182
|
cameraAngle: 180
|
|
2174
2183
|
},
|
|
2175
2184
|
{
|
|
2176
2185
|
name: "left_hand",
|
|
2177
|
-
bones: ["
|
|
2186
|
+
bones: ["HAND_L"],
|
|
2178
2187
|
paddingFactor: 1.3,
|
|
2179
2188
|
cameraAngle: 270
|
|
2180
2189
|
},
|
|
2181
2190
|
{
|
|
2182
2191
|
name: "right_hand",
|
|
2183
|
-
bones: ["
|
|
2192
|
+
bones: ["HAND_R"],
|
|
2184
2193
|
paddingFactor: 1.3,
|
|
2185
2194
|
cameraAngle: 90
|
|
2186
2195
|
},
|
|
2187
2196
|
{
|
|
2188
2197
|
name: "left_foot",
|
|
2189
|
-
bones: ["
|
|
2198
|
+
bones: ["FOOT_L", "TOEBASE_L"],
|
|
2190
2199
|
paddingFactor: 2.5,
|
|
2191
2200
|
cameraAngle: 270
|
|
2192
2201
|
},
|
|
2193
2202
|
{
|
|
2194
2203
|
name: "right_foot",
|
|
2195
|
-
bones: ["
|
|
2204
|
+
bones: ["FOOT_R", "TOEBASE_R"],
|
|
2196
2205
|
paddingFactor: 2.5,
|
|
2197
2206
|
cameraAngle: 90
|
|
2198
2207
|
}
|
|
@@ -5447,13 +5456,6 @@ function mergeRegion(base, override) {
|
|
|
5447
5456
|
} : void 0
|
|
5448
5457
|
};
|
|
5449
5458
|
}
|
|
5450
|
-
function mergeStringRecord(base, override) {
|
|
5451
|
-
if (!base && !override) return void 0;
|
|
5452
|
-
return {
|
|
5453
|
-
...base ? { ...base } : {},
|
|
5454
|
-
...override ? { ...override } : {}
|
|
5455
|
-
};
|
|
5456
|
-
}
|
|
5457
5459
|
function mergeRegionsByName(base, override) {
|
|
5458
5460
|
if (!base && !override) return void 0;
|
|
5459
5461
|
const merged = /* @__PURE__ */ new Map();
|
|
@@ -5519,7 +5521,7 @@ function orderResolvedRegions(resolvedRegions, prioritizedLists) {
|
|
|
5519
5521
|
}
|
|
5520
5522
|
return orderedNames.map((name) => resolvedByName.get(name)).filter((region) => Boolean(region));
|
|
5521
5523
|
}
|
|
5522
|
-
function
|
|
5524
|
+
function extendCharacterConfigWithPreset(config) {
|
|
5523
5525
|
const presetType = config.auPresetType;
|
|
5524
5526
|
if (!presetType || presetType === "custom") {
|
|
5525
5527
|
return config;
|
|
@@ -5537,13 +5539,13 @@ function resolveCharacterConfig(config) {
|
|
|
5537
5539
|
);
|
|
5538
5540
|
return {
|
|
5539
5541
|
...config,
|
|
5540
|
-
|
|
5541
|
-
boneSuffix: config.boneSuffix ?? presetResolvedProfile.boneSuffix,
|
|
5542
|
-
boneNodes: mergeStringRecord(presetResolvedProfile.boneNodes, config.boneNodes),
|
|
5543
|
-
suffixPattern: config.suffixPattern ?? presetResolvedProfile.suffixPattern,
|
|
5542
|
+
...presetResolvedProfile,
|
|
5544
5543
|
regions: resolvedRegions ?? config.regions
|
|
5545
5544
|
};
|
|
5546
5545
|
}
|
|
5546
|
+
function resolveCharacterConfig(config) {
|
|
5547
|
+
return extendCharacterConfigWithPreset(config);
|
|
5548
|
+
}
|
|
5547
5549
|
var DEFAULT_HEAD_BONE_NAMES = ["CC_Base_Head", "Head", "head", "Bip01_Head"];
|
|
5548
5550
|
var DEFAULT_REFERENCE_HEIGHT = 1.8;
|
|
5549
5551
|
var DEFAULT_FORWARD_OFFSET = 0.08;
|
|
@@ -5731,23 +5733,32 @@ function detectFacingDirection(model, eyeBoneNames = {
|
|
|
5731
5733
|
function normalizeLooseName(value) {
|
|
5732
5734
|
return value.replace(/\./g, "");
|
|
5733
5735
|
}
|
|
5734
|
-
function
|
|
5735
|
-
if (!config) return semanticName;
|
|
5736
|
+
function resolveBoneNameCandidates(semanticName, config) {
|
|
5737
|
+
if (!config) return [semanticName];
|
|
5736
5738
|
const { bonePrefix, boneSuffix, boneNodes } = config;
|
|
5737
5739
|
if (!boneNodes || !boneNodes[semanticName]) {
|
|
5738
|
-
return semanticName;
|
|
5740
|
+
return [semanticName];
|
|
5739
5741
|
}
|
|
5740
5742
|
const baseName = boneNodes[semanticName];
|
|
5741
|
-
if (baseName.includes("_") || baseName.includes(".")) {
|
|
5742
|
-
return baseName;
|
|
5743
|
-
}
|
|
5744
5743
|
const prefix = bonePrefix || "";
|
|
5745
5744
|
const suffix = boneSuffix || "";
|
|
5746
|
-
|
|
5745
|
+
if (!prefix && !suffix) {
|
|
5746
|
+
return [baseName];
|
|
5747
|
+
}
|
|
5748
|
+
const prefixedBase = prefix && baseName.startsWith(prefix) ? baseName : prefix + baseName;
|
|
5749
|
+
const fullyAffixed = suffix && !prefixedBase.endsWith(suffix) ? `${prefixedBase}${suffix}` : prefixedBase;
|
|
5750
|
+
return Array.from(/* @__PURE__ */ new Set([fullyAffixed, baseName]));
|
|
5751
|
+
}
|
|
5752
|
+
function resolveBoneName(semanticName, config) {
|
|
5753
|
+
return resolveBoneNameCandidates(semanticName, config)[0] ?? semanticName;
|
|
5747
5754
|
}
|
|
5748
5755
|
function resolveBoneNames(names, config) {
|
|
5749
5756
|
if (!names || names.length === 0) return [];
|
|
5750
|
-
return
|
|
5757
|
+
return Array.from(
|
|
5758
|
+
new Set(
|
|
5759
|
+
names.flatMap((name) => resolveBoneNameCandidates(name, config))
|
|
5760
|
+
)
|
|
5761
|
+
);
|
|
5751
5762
|
}
|
|
5752
5763
|
function fuzzyNameMatch(objectName, targetName, suffixPattern) {
|
|
5753
5764
|
if (objectName === targetName) return true;
|
|
@@ -6884,6 +6895,7 @@ exports.applyCharacterProfileToPreset = applyCharacterProfileToPreset;
|
|
|
6884
6895
|
exports.applyProfileToPreset = applyProfileToPreset;
|
|
6885
6896
|
exports.collectMorphMeshes = collectMorphMeshes;
|
|
6886
6897
|
exports.detectFacingDirection = detectFacingDirection;
|
|
6898
|
+
exports.extendCharacterConfigWithPreset = extendCharacterConfigWithPreset;
|
|
6887
6899
|
exports.extractFromGLTF = extractFromGLTF;
|
|
6888
6900
|
exports.extractModelData = extractModelData;
|
|
6889
6901
|
exports.extractProfileOverrides = extractProfileOverrides;
|