@lovelace_lol/loom3 1.0.40 → 1.0.41

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 CHANGED
@@ -15,7 +15,7 @@ Loom3 provides mappings that connect [Facial Action Coding System (FACS)](https:
15
15
 
16
16
  Loom3 is broader than a face-controller wrapper. The library spans four practical areas:
17
17
  - Runtime control: Action Units, visemes, direct morphs, continuum pairs, composite rotations, transitions, and mixer playback.
18
- - Rig configuration: built-in presets, profile overrides, preset resolution, name resolution, viseme routing, mix weights, and skeletal-only preset support.
18
+ - Rig configuration: built-in presets, profile overrides, preset lookup and extension, name resolution, viseme routing, mix weights, and skeletal-only preset support.
19
19
  - Inspection and validation: mesh, morph, and bone discovery; preset-fit checks; correction suggestions; and full model analysis.
20
20
  - Runtime tooling: mesh/material debugging, baked animation clip helpers, hair physics, and region/geometry helpers for annotation or camera tooling.
21
21
 
@@ -366,7 +366,7 @@ For the current runtime-oriented documentation, including:
366
366
  - `cameraOffset`
367
367
  - `style.lineDirection`
368
368
  - the difference between `cameraAngle: 0` and omitting `cameraAngle`
369
- - the current LoomLarge runtime note that annotations have not been moved from the demo project into Loom3 yet
369
+ - runtime compatibility and legacy `config.regions` fallback behavior
370
370
 
371
371
  see [ANNOTATION_CONFIGURATION.md](./ANNOTATION_CONFIGURATION.md).
372
372
 
@@ -380,7 +380,7 @@ Open in LoomLarge: [Properties tab](https://www.characterloom.com/?drawer=open&t
380
380
 
381
381
  Before you tune AUs or hand-edit a profile, confirm that you picked the right preset and that the model actually matches it. Loom3 exposes a full preset-selection and validation workflow, not just low-level control APIs.
382
382
 
383
- ### Resolving presets by type
383
+ ### Looking Up and Extending Presets by Type
384
384
 
385
385
  Use preset helpers when you want a stable entry point by model class instead of importing a preset constant directly:
386
386
 
package/dist/index.cjs CHANGED
@@ -3573,7 +3573,7 @@ var mergeAnnotationRegion = (base, override) => {
3573
3573
  merged.meshes = override.meshes ? [...override.meshes] : base.meshes ? [...base.meshes] : void 0;
3574
3574
  merged.objects = override.objects ? [...override.objects] : base.objects ? [...base.objects] : void 0;
3575
3575
  merged.children = override.children ? [...override.children] : base.children ? [...base.children] : void 0;
3576
- merged.cameraOffset = override.cameraOffset ? { ...override.cameraOffset } : base.cameraOffset ? { ...base.cameraOffset } : void 0;
3576
+ merged.cameraOffset = override.cameraOffset ? { ...base.cameraOffset, ...override.cameraOffset } : base.cameraOffset ? { ...base.cameraOffset } : void 0;
3577
3577
  merged.style = override.style ? {
3578
3578
  ...base.style,
3579
3579
  ...override.style,
@@ -6412,22 +6412,32 @@ function mergeRegionsByName(base, override) {
6412
6412
  }
6413
6413
  return Array.from(merged.values());
6414
6414
  }
6415
+ function getAnnotationRegions(value) {
6416
+ return Array.isArray(value) ? value : void 0;
6417
+ }
6418
+ function getLegacyNestedOverrides(config) {
6419
+ return isPlainObject2(config.profile) ? config.profile : {};
6420
+ }
6421
+ function getLegacyRuntimeRegions(config) {
6422
+ return Array.isArray(config.regions) && config.regions.length > 0 ? config.regions : void 0;
6423
+ }
6424
+ function getCanonicalAnnotationOverrides(config) {
6425
+ return mergeRegionsByName(
6426
+ getAnnotationRegions(getLegacyNestedOverrides(config).annotationRegions),
6427
+ getAnnotationRegions(config.annotationRegions)
6428
+ );
6429
+ }
6415
6430
  function extractProfileOverrides(config) {
6416
6431
  const topLevelConfig = config;
6417
- const legacyNestedOverrides = isPlainObject2(config.profile) ? config.profile : {};
6432
+ const legacyNestedOverrides = getLegacyNestedOverrides(config);
6433
+ const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
6434
+ const legacyRuntimeRegions = getLegacyRuntimeRegions(config);
6435
+ const annotationOverrides = canonicalAnnotationOverrides ?? (legacyRuntimeRegions ? legacyRuntimeRegions.map((region) => cloneRegion(region)) : void 0);
6418
6436
  const overrides = {};
6419
6437
  for (const key of PROFILE_OVERRIDE_KEYS) {
6420
6438
  if (key === "annotationRegions") {
6421
- const topLevelAnnotationRegions = Array.isArray(topLevelConfig.annotationRegions) ? topLevelConfig.annotationRegions : void 0;
6422
- const legacyAnnotationRegions = Array.isArray(legacyNestedOverrides.annotationRegions) ? legacyNestedOverrides.annotationRegions : void 0;
6423
- const legacyRegionFallback = Array.isArray(config.regions) && config.regions.length > 0 ? config.regions : void 0;
6424
- const legacyProfileRegions = mergeRegionsByName(legacyRegionFallback, legacyAnnotationRegions);
6425
- const regions = mergeRegionsByName(
6426
- legacyProfileRegions,
6427
- topLevelAnnotationRegions
6428
- );
6429
- if (regions) {
6430
- overrides.annotationRegions = regions.map((region) => cloneRegion(region));
6439
+ if (annotationOverrides) {
6440
+ overrides.annotationRegions = annotationOverrides.map((region) => cloneRegion(region));
6431
6441
  }
6432
6442
  continue;
6433
6443
  }
@@ -6440,13 +6450,6 @@ function extractProfileOverrides(config) {
6440
6450
  }
6441
6451
  return overrides;
6442
6452
  }
6443
- function hasCanonicalAnnotationRegionOverrides(config) {
6444
- const topLevelConfig = config;
6445
- if (Array.isArray(topLevelConfig.annotationRegions)) {
6446
- return true;
6447
- }
6448
- return isPlainObject2(config.profile) && Array.isArray(config.profile.annotationRegions);
6449
- }
6450
6453
  function applyCharacterProfileToPreset(config) {
6451
6454
  const presetType = config.auPresetType;
6452
6455
  if (!presetType) {
@@ -6478,24 +6481,34 @@ function extendCharacterConfigWithPreset(config) {
6478
6481
  if (!presetType || presetType === "custom") {
6479
6482
  return config;
6480
6483
  }
6484
+ const canonicalAnnotationOverrides = getCanonicalAnnotationOverrides(config);
6485
+ const legacyRuntimeRegions = getLegacyRuntimeRegions(config);
6481
6486
  const profileOverrides = extractProfileOverrides(config);
6482
6487
  const extendedPresetProfile = applyCharacterProfileToPreset(config);
6483
6488
  if (!extendedPresetProfile) {
6484
6489
  return config;
6485
6490
  }
6486
- const presetRegions = extendedPresetProfile.annotationRegions;
6487
- const mergedRegions = hasCanonicalAnnotationRegionOverrides(config) ? mergeRegionsByName(config.regions, presetRegions) : mergeRegionsByName(presetRegions, config.regions);
6488
- const normalizedRegions = normalizeRegionTree(
6489
- mergedRegions,
6491
+ const presetRegionNames = new Set(
6492
+ (getPreset(presetType).annotationRegions ?? []).map((region) => region.name)
6493
+ );
6494
+ const extendedAnnotationRegions = normalizeRegionTree(
6495
+ extendedPresetProfile.annotationRegions,
6496
+ profileOverrides.disabledRegions
6497
+ );
6498
+ const extendedRegionNames = new Set((extendedAnnotationRegions ?? []).map((region) => region.name));
6499
+ const legacyExtraRegions = canonicalAnnotationOverrides && legacyRuntimeRegions ? legacyRuntimeRegions.filter((region) => !presetRegionNames.has(region.name) && !extendedRegionNames.has(region.name)).map((region) => cloneRegion(region)) : void 0;
6500
+ const mergedRegions = normalizeRegionTree(
6501
+ mergeRegionsByName(extendedAnnotationRegions, legacyExtraRegions),
6490
6502
  profileOverrides.disabledRegions
6491
6503
  );
6492
6504
  const extendedRegions = orderExtendedRegions(
6493
- normalizedRegions,
6494
- [config.regions, profileOverrides.annotationRegions, presetRegions]
6505
+ mergedRegions,
6506
+ canonicalAnnotationOverrides ? [extendedAnnotationRegions, legacyExtraRegions] : [legacyRuntimeRegions, extendedAnnotationRegions]
6495
6507
  );
6496
6508
  return {
6497
6509
  ...config,
6498
6510
  ...extendedPresetProfile,
6511
+ annotationRegions: extendedRegions ?? extendedAnnotationRegions,
6499
6512
  regions: extendedRegions ?? config.regions
6500
6513
  };
6501
6514
  }