@lovelace_lol/loom3 1.0.45 → 1.0.46

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/dist/index.d.cts CHANGED
@@ -2244,6 +2244,31 @@ declare function resolveBoneNames(names: string[] | undefined, profile?: BoneRes
2244
2244
  declare function fuzzyNameMatch(objectName: string, targetName: string, suffixPattern?: string): boolean;
2245
2245
  declare function resolveFaceCenter(model: THREE.Object3D, region: Region, profile?: BoneResolutionProfile): ResolvedFaceCenter;
2246
2246
 
2247
+ type SemanticSide = 'left' | 'right';
2248
+ interface AnnotationLaterality {
2249
+ leftSideX: 1 | -1;
2250
+ confidence: number;
2251
+ evidence: string[];
2252
+ }
2253
+ type LateralityRegion = Pick<Region, 'name' | 'cameraAngle' | 'parent'>;
2254
+ declare function getDefaultAnnotationLaterality(): AnnotationLaterality;
2255
+ declare function normalizeCameraAngle(angle: number): number;
2256
+ declare function getRegionSemanticSide(regionName?: string): SemanticSide | null;
2257
+ declare function getSemanticHorizontalSign(regionName: string, laterality: AnnotationLaterality): 1 | -1 | null;
2258
+ declare function getSemanticHorizontalSignForSide(side: SemanticSide, laterality: AnnotationLaterality): 1 | -1;
2259
+ declare function detectAnnotationLaterality(model: THREE.Object3D | null, regions: Region[], characterConfig: BoneResolutionProfile | null): AnnotationLaterality;
2260
+ declare function resolveRegionCameraAngle(region: LateralityRegion, laterality: AnnotationLaterality): number | undefined;
2261
+ declare function resolveRegionVisibilityCameraAngle(region: LateralityRegion, laterality: AnnotationLaterality): number | undefined;
2262
+ declare function toWorldDirection(model: THREE.Object3D | null, localDirection: THREE.Vector3): THREE.Vector3;
2263
+ declare function toModelLocalDirection(model: THREE.Object3D | null, worldDirection: THREE.Vector3): THREE.Vector3;
2264
+ declare function getWorldDirectionForCameraAngle(model: THREE.Object3D | null, cameraAngle: number): THREE.Vector3;
2265
+ declare function getModelLocalOrbitAngle(model: THREE.Object3D | null, modelCenter: THREE.Vector3, worldPosition: THREE.Vector3): number;
2266
+ declare function passesMarkerCameraAngleGate(params: {
2267
+ markerAngle?: number;
2268
+ currentCameraAngle?: number;
2269
+ rangeDegrees?: number;
2270
+ }): boolean;
2271
+
2247
2272
  /**
2248
2273
  * HairPhysics - Spring-damper pendulum simulation for hair movement
2249
2274
  *
@@ -2672,4 +2697,4 @@ declare function detectFacingDirection(model: THREE.Object3D, eyeBoneNames?: {
2672
2697
  right: string[];
2673
2698
  }): 'forward' | 'backward' | 'unknown';
2674
2699
 
2675
- export { type AUInfo, type AUSelector, AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, type AddMorphTargetOptions, type AnalyzeModelOptions, type Animation, type AnimationActionHandle, type AnimationAnalysis, type AnimationBlendMode, type AnimationClipInfo, type AnimationEasing, type AnimationInfo, type AnimationPlayOptions, type AnimationSource, type AnimationState, AnimationThree, type AnnotationRegion, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneInfo, type BoneKey, type BoneResolutionProfile, 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, type CameraRelativeGazeOffset, type CameraRelativeGazeOptions, type CharacterConfig, type CharacterProfile, type CharacterRegistry, type ClipEvent, type ClipEventListener, type ClipHandle, type ClipOptions, type CompositeRotation, type CompositeRotationState, type CurvePoint, type CurvesMap, type CustomProfileRuntimeConfig, DEFAULT_HAIR_PHYSICS_CONFIG, type ExpandAnimation, type ExpandedRegionState, FISH_AU_MAPPING_CONFIG, type FaceCenterResult, type FallbackConfig, type FindFaceCenterOptions, type Hair, type HairMorphAxis, type HairMorphOutput$1 as HairMorphOutput, type HairMorphTargetMapping, type HairMorphTargetValueMapping, type HairMorphTargetsConfig, type HairObjectRef, type HairObjectState, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysicsDirectionConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsProfileConfig, type HairPhysicsRuntimeConfig, type HairPhysicsRuntimeConfigUpdate, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LineConfig, type LineCurve, type LineStyle, Loom3, type Loom3Config, Loom3 as Loom3Three, type LoomLarge, type LoomLargeConfig, Loom3 as LoomLargeThree, MORPH_TO_MESH, type MappingConsistencyResult, type MappingCorrection, type MappingCorrectionOptions, type MappingCorrectionResult, type MappingEditorModel, type MappingEditorSection, type MappingIssue, type MarkerGroup, type MarkerStyle, type MarkerStyleOverrides, type MeshCategory, type MeshInfo, type MeshMaterialSettings, type MixerLoopMode, type ModelAnalysisReport, type ModelData, type ModelMeshInfo, type MorphCandidate, type MorphCandidateMatch, type MorphCandidateReason, type MorphCategory, type MorphInfo, type MorphTargetAttributeData, type MorphTargetDelta, type MorphTargetRef, type MorphTargetsBySide, type NamedDirection, type PresetBackedProfileRuntimeConfig, type PresetType, type Profile, type ProfileOverrides, type ProfilePresetId, type ProfileRegistry, type ProfileRuntimeConfig, type ProviderVisemeEvent, type ProviderVisemeMatch, type ReadyPayload, type Region, type ResolvedFaceCenter, type ResolvedProfileRuntimeConfig, type ResolvedVisemeBindingTarget, type RotationAxis, type RotationsState, type Snippet, type TrackInfo, type TransitionHandle, VISEME_JAW_AMOUNTS, VISEME_KEYS, type ValidateMappingOptions, type ValidationResult, type VisemeBinding, type VisemeBindingTarget, type VisemeSlot, type VisemeSlotFeatures, 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 };
2700
+ export { type AUInfo, type AUSelector, AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, type AddMorphTargetOptions, type AnalyzeModelOptions, type Animation, type AnimationActionHandle, type AnimationAnalysis, type AnimationBlendMode, type AnimationClipInfo, type AnimationEasing, type AnimationInfo, type AnimationPlayOptions, type AnimationSource, type AnimationState, AnimationThree, type AnnotationLaterality, type AnnotationRegion, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneInfo, type BoneKey, type BoneResolutionProfile, 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, type CameraRelativeGazeOffset, type CameraRelativeGazeOptions, type CharacterConfig, type CharacterProfile, type CharacterRegistry, type ClipEvent, type ClipEventListener, type ClipHandle, type ClipOptions, type CompositeRotation, type CompositeRotationState, type CurvePoint, type CurvesMap, type CustomProfileRuntimeConfig, DEFAULT_HAIR_PHYSICS_CONFIG, type ExpandAnimation, type ExpandedRegionState, FISH_AU_MAPPING_CONFIG, type FaceCenterResult, type FallbackConfig, type FindFaceCenterOptions, type Hair, type HairMorphAxis, type HairMorphOutput$1 as HairMorphOutput, type HairMorphTargetMapping, type HairMorphTargetValueMapping, type HairMorphTargetsConfig, type HairObjectRef, type HairObjectState, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysicsDirectionConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsProfileConfig, type HairPhysicsRuntimeConfig, type HairPhysicsRuntimeConfigUpdate, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LineConfig, type LineCurve, type LineStyle, Loom3, type Loom3Config, Loom3 as Loom3Three, type LoomLarge, type LoomLargeConfig, Loom3 as LoomLargeThree, MORPH_TO_MESH, type MappingConsistencyResult, type MappingCorrection, type MappingCorrectionOptions, type MappingCorrectionResult, type MappingEditorModel, type MappingEditorSection, type MappingIssue, type MarkerGroup, type MarkerStyle, type MarkerStyleOverrides, type MeshCategory, type MeshInfo, type MeshMaterialSettings, type MixerLoopMode, type ModelAnalysisReport, type ModelData, type ModelMeshInfo, type MorphCandidate, type MorphCandidateMatch, type MorphCandidateReason, type MorphCategory, type MorphInfo, type MorphTargetAttributeData, type MorphTargetDelta, type MorphTargetRef, type MorphTargetsBySide, type NamedDirection, type PresetBackedProfileRuntimeConfig, type PresetType, type Profile, type ProfileOverrides, type ProfilePresetId, type ProfileRegistry, type ProfileRuntimeConfig, type ProviderVisemeEvent, type ProviderVisemeMatch, type ReadyPayload, type Region, type ResolvedFaceCenter, type ResolvedProfileRuntimeConfig, type ResolvedVisemeBindingTarget, type RotationAxis, type RotationsState, type Snippet, type TrackInfo, type TransitionHandle, VISEME_JAW_AMOUNTS, VISEME_KEYS, type ValidateMappingOptions, type ValidationResult, type VisemeBinding, type VisemeBindingTarget, type VisemeSlot, type VisemeSlotFeatures, analyzeModel, applyCharacterProfileToPreset, buildMappingEditorModel, collectMorphMeshes, compileVisemeKeys, computeCameraRelativeGazeOffset, detectAnnotationLaterality, detectFacingDirection, extendCharacterConfigWithPreset, extendPresetWithProfile, extendProfileConfigWithPreset, extractFromGLTF, extractLegacyCharacterProfileOverrides, extractModelData, extractProfileOverrides, findFaceCenter, fuzzyNameMatch, generateMappingCorrections, getDefaultAnnotationLaterality, getMeshNamesForAUProfile, getMeshNamesForVisemeProfile, getModelForwardDirection, getModelLocalOrbitAngle, getPreset, getPresetWithProfile, getProfilePresetId, getProfileVisemeSlots, getRegionSemanticSide, getSemanticHorizontalSign, getSemanticHorizontalSignForSide, getVisemeBindingTargets, getVisemeJawAmounts, getVisemeSlotIndex, getWorldDirectionForCameraAngle, hasLeftRightMorphs, isMixedAU, isPresetCompatible, mapProviderVisemeToSlot, mergeRegionsByName as mergeCharacterRegionsByName, mergeProfileRegionsByName, normalizeCameraAngle, passesMarkerCameraAngleGate, resolveBoneName, resolveBoneNames, resolveFaceCenter, resolvePreset, resolvePresetWithOverrides, resolveProfileFromPreset, resolveRegionCameraAngle, resolveRegionVisibilityCameraAngle, resolveVisemeMeshCategory, suggestBestPreset, toModelLocalDirection, toWorldDirection, validateMappingConfig, validateMappings };
package/dist/index.d.ts CHANGED
@@ -2244,6 +2244,31 @@ declare function resolveBoneNames(names: string[] | undefined, profile?: BoneRes
2244
2244
  declare function fuzzyNameMatch(objectName: string, targetName: string, suffixPattern?: string): boolean;
2245
2245
  declare function resolveFaceCenter(model: THREE.Object3D, region: Region, profile?: BoneResolutionProfile): ResolvedFaceCenter;
2246
2246
 
2247
+ type SemanticSide = 'left' | 'right';
2248
+ interface AnnotationLaterality {
2249
+ leftSideX: 1 | -1;
2250
+ confidence: number;
2251
+ evidence: string[];
2252
+ }
2253
+ type LateralityRegion = Pick<Region, 'name' | 'cameraAngle' | 'parent'>;
2254
+ declare function getDefaultAnnotationLaterality(): AnnotationLaterality;
2255
+ declare function normalizeCameraAngle(angle: number): number;
2256
+ declare function getRegionSemanticSide(regionName?: string): SemanticSide | null;
2257
+ declare function getSemanticHorizontalSign(regionName: string, laterality: AnnotationLaterality): 1 | -1 | null;
2258
+ declare function getSemanticHorizontalSignForSide(side: SemanticSide, laterality: AnnotationLaterality): 1 | -1;
2259
+ declare function detectAnnotationLaterality(model: THREE.Object3D | null, regions: Region[], characterConfig: BoneResolutionProfile | null): AnnotationLaterality;
2260
+ declare function resolveRegionCameraAngle(region: LateralityRegion, laterality: AnnotationLaterality): number | undefined;
2261
+ declare function resolveRegionVisibilityCameraAngle(region: LateralityRegion, laterality: AnnotationLaterality): number | undefined;
2262
+ declare function toWorldDirection(model: THREE.Object3D | null, localDirection: THREE.Vector3): THREE.Vector3;
2263
+ declare function toModelLocalDirection(model: THREE.Object3D | null, worldDirection: THREE.Vector3): THREE.Vector3;
2264
+ declare function getWorldDirectionForCameraAngle(model: THREE.Object3D | null, cameraAngle: number): THREE.Vector3;
2265
+ declare function getModelLocalOrbitAngle(model: THREE.Object3D | null, modelCenter: THREE.Vector3, worldPosition: THREE.Vector3): number;
2266
+ declare function passesMarkerCameraAngleGate(params: {
2267
+ markerAngle?: number;
2268
+ currentCameraAngle?: number;
2269
+ rangeDegrees?: number;
2270
+ }): boolean;
2271
+
2247
2272
  /**
2248
2273
  * HairPhysics - Spring-damper pendulum simulation for hair movement
2249
2274
  *
@@ -2672,4 +2697,4 @@ declare function detectFacingDirection(model: THREE.Object3D, eyeBoneNames?: {
2672
2697
  right: string[];
2673
2698
  }): 'forward' | 'backward' | 'unknown';
2674
2699
 
2675
- export { type AUInfo, type AUSelector, AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, type AddMorphTargetOptions, type AnalyzeModelOptions, type Animation, type AnimationActionHandle, type AnimationAnalysis, type AnimationBlendMode, type AnimationClipInfo, type AnimationEasing, type AnimationInfo, type AnimationPlayOptions, type AnimationSource, type AnimationState, AnimationThree, type AnnotationRegion, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneInfo, type BoneKey, type BoneResolutionProfile, 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, type CameraRelativeGazeOffset, type CameraRelativeGazeOptions, type CharacterConfig, type CharacterProfile, type CharacterRegistry, type ClipEvent, type ClipEventListener, type ClipHandle, type ClipOptions, type CompositeRotation, type CompositeRotationState, type CurvePoint, type CurvesMap, type CustomProfileRuntimeConfig, DEFAULT_HAIR_PHYSICS_CONFIG, type ExpandAnimation, type ExpandedRegionState, FISH_AU_MAPPING_CONFIG, type FaceCenterResult, type FallbackConfig, type FindFaceCenterOptions, type Hair, type HairMorphAxis, type HairMorphOutput$1 as HairMorphOutput, type HairMorphTargetMapping, type HairMorphTargetValueMapping, type HairMorphTargetsConfig, type HairObjectRef, type HairObjectState, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysicsDirectionConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsProfileConfig, type HairPhysicsRuntimeConfig, type HairPhysicsRuntimeConfigUpdate, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LineConfig, type LineCurve, type LineStyle, Loom3, type Loom3Config, Loom3 as Loom3Three, type LoomLarge, type LoomLargeConfig, Loom3 as LoomLargeThree, MORPH_TO_MESH, type MappingConsistencyResult, type MappingCorrection, type MappingCorrectionOptions, type MappingCorrectionResult, type MappingEditorModel, type MappingEditorSection, type MappingIssue, type MarkerGroup, type MarkerStyle, type MarkerStyleOverrides, type MeshCategory, type MeshInfo, type MeshMaterialSettings, type MixerLoopMode, type ModelAnalysisReport, type ModelData, type ModelMeshInfo, type MorphCandidate, type MorphCandidateMatch, type MorphCandidateReason, type MorphCategory, type MorphInfo, type MorphTargetAttributeData, type MorphTargetDelta, type MorphTargetRef, type MorphTargetsBySide, type NamedDirection, type PresetBackedProfileRuntimeConfig, type PresetType, type Profile, type ProfileOverrides, type ProfilePresetId, type ProfileRegistry, type ProfileRuntimeConfig, type ProviderVisemeEvent, type ProviderVisemeMatch, type ReadyPayload, type Region, type ResolvedFaceCenter, type ResolvedProfileRuntimeConfig, type ResolvedVisemeBindingTarget, type RotationAxis, type RotationsState, type Snippet, type TrackInfo, type TransitionHandle, VISEME_JAW_AMOUNTS, VISEME_KEYS, type ValidateMappingOptions, type ValidationResult, type VisemeBinding, type VisemeBindingTarget, type VisemeSlot, type VisemeSlotFeatures, 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 };
2700
+ export { type AUInfo, type AUSelector, AU_INFO, AU_MAPPING_CONFIG, AU_MIX_DEFAULTS, AU_TO_MORPHS, type AddMorphTargetOptions, type AnalyzeModelOptions, type Animation, type AnimationActionHandle, type AnimationAnalysis, type AnimationBlendMode, type AnimationClipInfo, type AnimationEasing, type AnimationInfo, type AnimationPlayOptions, type AnimationSource, type AnimationState, AnimationThree, type AnnotationLaterality, type AnnotationRegion, BETTA_FISH_PRESET, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneInfo, type BoneKey, type BoneResolutionProfile, 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, type CameraRelativeGazeOffset, type CameraRelativeGazeOptions, type CharacterConfig, type CharacterProfile, type CharacterRegistry, type ClipEvent, type ClipEventListener, type ClipHandle, type ClipOptions, type CompositeRotation, type CompositeRotationState, type CurvePoint, type CurvesMap, type CustomProfileRuntimeConfig, DEFAULT_HAIR_PHYSICS_CONFIG, type ExpandAnimation, type ExpandedRegionState, FISH_AU_MAPPING_CONFIG, type FaceCenterResult, type FallbackConfig, type FindFaceCenterOptions, type Hair, type HairMorphAxis, type HairMorphOutput$1 as HairMorphOutput, type HairMorphTargetMapping, type HairMorphTargetValueMapping, type HairMorphTargetsConfig, type HairObjectRef, type HairObjectState, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysicsDirectionConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsProfileConfig, type HairPhysicsRuntimeConfig, type HairPhysicsRuntimeConfigUpdate, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LineConfig, type LineCurve, type LineStyle, Loom3, type Loom3Config, Loom3 as Loom3Three, type LoomLarge, type LoomLargeConfig, Loom3 as LoomLargeThree, MORPH_TO_MESH, type MappingConsistencyResult, type MappingCorrection, type MappingCorrectionOptions, type MappingCorrectionResult, type MappingEditorModel, type MappingEditorSection, type MappingIssue, type MarkerGroup, type MarkerStyle, type MarkerStyleOverrides, type MeshCategory, type MeshInfo, type MeshMaterialSettings, type MixerLoopMode, type ModelAnalysisReport, type ModelData, type ModelMeshInfo, type MorphCandidate, type MorphCandidateMatch, type MorphCandidateReason, type MorphCategory, type MorphInfo, type MorphTargetAttributeData, type MorphTargetDelta, type MorphTargetRef, type MorphTargetsBySide, type NamedDirection, type PresetBackedProfileRuntimeConfig, type PresetType, type Profile, type ProfileOverrides, type ProfilePresetId, type ProfileRegistry, type ProfileRuntimeConfig, type ProviderVisemeEvent, type ProviderVisemeMatch, type ReadyPayload, type Region, type ResolvedFaceCenter, type ResolvedProfileRuntimeConfig, type ResolvedVisemeBindingTarget, type RotationAxis, type RotationsState, type Snippet, type TrackInfo, type TransitionHandle, VISEME_JAW_AMOUNTS, VISEME_KEYS, type ValidateMappingOptions, type ValidationResult, type VisemeBinding, type VisemeBindingTarget, type VisemeSlot, type VisemeSlotFeatures, analyzeModel, applyCharacterProfileToPreset, buildMappingEditorModel, collectMorphMeshes, compileVisemeKeys, computeCameraRelativeGazeOffset, detectAnnotationLaterality, detectFacingDirection, extendCharacterConfigWithPreset, extendPresetWithProfile, extendProfileConfigWithPreset, extractFromGLTF, extractLegacyCharacterProfileOverrides, extractModelData, extractProfileOverrides, findFaceCenter, fuzzyNameMatch, generateMappingCorrections, getDefaultAnnotationLaterality, getMeshNamesForAUProfile, getMeshNamesForVisemeProfile, getModelForwardDirection, getModelLocalOrbitAngle, getPreset, getPresetWithProfile, getProfilePresetId, getProfileVisemeSlots, getRegionSemanticSide, getSemanticHorizontalSign, getSemanticHorizontalSignForSide, getVisemeBindingTargets, getVisemeJawAmounts, getVisemeSlotIndex, getWorldDirectionForCameraAngle, hasLeftRightMorphs, isMixedAU, isPresetCompatible, mapProviderVisemeToSlot, mergeRegionsByName as mergeCharacterRegionsByName, mergeProfileRegionsByName, normalizeCameraAngle, passesMarkerCameraAngleGate, resolveBoneName, resolveBoneNames, resolveFaceCenter, resolvePreset, resolvePresetWithOverrides, resolveProfileFromPreset, resolveRegionCameraAngle, resolveRegionVisibilityCameraAngle, resolveVisemeMeshCategory, suggestBestPreset, toModelLocalDirection, toWorldDirection, validateMappingConfig, validateMappings };
package/dist/index.js CHANGED
@@ -7517,6 +7517,274 @@ function resolveFaceCenter(model, region, profile) {
7517
7517
  };
7518
7518
  }
7519
7519
 
7520
+ // src/camera/annotationCameraAngles.ts
7521
+ var DEFAULT_LATERALITY = {
7522
+ leftSideX: -1,
7523
+ confidence: 0,
7524
+ evidence: ["default:left=-X"]
7525
+ };
7526
+ var SIDE_TOKEN_PATTERN = /(^|[_\s-])(left|right)(?=$|[_\s-])/i;
7527
+ var MIN_LATERAL_SEPARATION = 1e-3;
7528
+ function invertHorizontalSign(sign) {
7529
+ return sign === 1 ? -1 : 1;
7530
+ }
7531
+ function averagePoints(points) {
7532
+ if (points.length === 0) return null;
7533
+ const center = new THREE2.Vector3();
7534
+ for (const point of points) {
7535
+ center.add(point);
7536
+ }
7537
+ return center.divideScalar(points.length);
7538
+ }
7539
+ function replaceSemanticSideToken(name, replacement) {
7540
+ const match = SIDE_TOKEN_PATTERN.exec(name);
7541
+ if (!match) return null;
7542
+ const [fullMatch, prefix] = match;
7543
+ const start = match.index;
7544
+ const end = start + fullMatch.length;
7545
+ return `${name.slice(0, start)}${prefix}${replacement}${name.slice(end)}`;
7546
+ }
7547
+ function collectMatchedPoints(model, targetNames, matcher, extractor) {
7548
+ const points = [];
7549
+ for (const targetName of targetNames) {
7550
+ model.traverse((obj) => {
7551
+ if (!matcher(obj, targetName)) return;
7552
+ const point = extractor(obj);
7553
+ if (point) {
7554
+ points.push(point);
7555
+ }
7556
+ });
7557
+ }
7558
+ return points;
7559
+ }
7560
+ function getRegionWorldCenter(model, region, characterConfig) {
7561
+ if (region.customPosition) {
7562
+ return new THREE2.Vector3(
7563
+ region.customPosition.x,
7564
+ region.customPosition.y,
7565
+ region.customPosition.z
7566
+ );
7567
+ }
7568
+ if (region.objects?.includes("*")) {
7569
+ return null;
7570
+ }
7571
+ const suffixPattern = characterConfig?.suffixPattern;
7572
+ const points = [];
7573
+ if (region.bones?.length) {
7574
+ const boneNames = resolveBoneNames(region.bones, characterConfig ?? void 0);
7575
+ points.push(
7576
+ ...collectMatchedPoints(
7577
+ model,
7578
+ boneNames,
7579
+ (obj, targetName) => fuzzyNameMatch(obj.name, targetName, suffixPattern),
7580
+ (obj) => {
7581
+ const worldPos = new THREE2.Vector3();
7582
+ obj.getWorldPosition(worldPos);
7583
+ return worldPos;
7584
+ }
7585
+ )
7586
+ );
7587
+ }
7588
+ if (region.meshes?.length) {
7589
+ points.push(
7590
+ ...collectMatchedPoints(
7591
+ model,
7592
+ region.meshes,
7593
+ (obj, targetName) => obj.isMesh && fuzzyNameMatch(obj.name, targetName, suffixPattern),
7594
+ (obj) => {
7595
+ const box = new THREE2.Box3().setFromObject(obj);
7596
+ if (box.isEmpty()) {
7597
+ return null;
7598
+ }
7599
+ return box.getCenter(new THREE2.Vector3());
7600
+ }
7601
+ )
7602
+ );
7603
+ }
7604
+ if (region.objects?.length) {
7605
+ const objectTargets = region.objects.filter((target) => target !== "*");
7606
+ points.push(
7607
+ ...collectMatchedPoints(
7608
+ model,
7609
+ objectTargets,
7610
+ (obj, targetName) => fuzzyNameMatch(obj.name, targetName, suffixPattern),
7611
+ (obj) => {
7612
+ if (obj.isMesh) {
7613
+ const box = new THREE2.Box3().setFromObject(obj);
7614
+ if (!box.isEmpty()) {
7615
+ return box.getCenter(new THREE2.Vector3());
7616
+ }
7617
+ }
7618
+ const worldPos = new THREE2.Vector3();
7619
+ obj.getWorldPosition(worldPos);
7620
+ return worldPos;
7621
+ }
7622
+ )
7623
+ );
7624
+ }
7625
+ return averagePoints(points);
7626
+ }
7627
+ function getRegionLocalCenter(model, region, characterConfig) {
7628
+ const worldCenter = getRegionWorldCenter(model, region, characterConfig);
7629
+ return worldCenter ? model.worldToLocal(worldCenter.clone()) : null;
7630
+ }
7631
+ function cloneLaterality(value) {
7632
+ return {
7633
+ leftSideX: value.leftSideX,
7634
+ confidence: value.confidence,
7635
+ evidence: [...value.evidence]
7636
+ };
7637
+ }
7638
+ function getDefaultAnnotationLaterality() {
7639
+ return cloneLaterality(DEFAULT_LATERALITY);
7640
+ }
7641
+ function normalizeCameraAngle(angle) {
7642
+ return (angle % 360 + 360) % 360;
7643
+ }
7644
+ function getRegionSemanticSide(regionName) {
7645
+ if (!regionName) return null;
7646
+ const match = SIDE_TOKEN_PATTERN.exec(regionName);
7647
+ if (!match) return null;
7648
+ return match[2].toLowerCase() === "left" ? "left" : "right";
7649
+ }
7650
+ function getSemanticHorizontalSign(regionName, laterality) {
7651
+ const side = getRegionSemanticSide(regionName);
7652
+ if (side === "left") return laterality.leftSideX;
7653
+ if (side === "right") return invertHorizontalSign(laterality.leftSideX);
7654
+ return null;
7655
+ }
7656
+ function getSemanticHorizontalSignForSide(side, laterality) {
7657
+ return side === "left" ? laterality.leftSideX : invertHorizontalSign(laterality.leftSideX);
7658
+ }
7659
+ function detectAnnotationLaterality(model, regions, characterConfig) {
7660
+ if (!model || regions.length === 0) {
7661
+ return getDefaultAnnotationLaterality();
7662
+ }
7663
+ model.updateMatrixWorld(true);
7664
+ const regionsByName = new Map(
7665
+ regions.map((region) => [region.name.toLowerCase(), region])
7666
+ );
7667
+ const votes = [];
7668
+ const pairedKeys = /* @__PURE__ */ new Set();
7669
+ for (const region of regions) {
7670
+ if (getRegionSemanticSide(region.name) !== "left") continue;
7671
+ const mirroredName = replaceSemanticSideToken(region.name, "right");
7672
+ if (!mirroredName) continue;
7673
+ const other = regionsByName.get(mirroredName.toLowerCase());
7674
+ if (!other) continue;
7675
+ const pairKey = [region.name.toLowerCase(), other.name.toLowerCase()].sort().join("|");
7676
+ if (pairedKeys.has(pairKey)) continue;
7677
+ pairedKeys.add(pairKey);
7678
+ const leftCenter = getRegionLocalCenter(model, region, characterConfig);
7679
+ const rightCenter = getRegionLocalCenter(model, other, characterConfig);
7680
+ if (!leftCenter || !rightCenter) continue;
7681
+ const separation = Math.abs(leftCenter.x - rightCenter.x);
7682
+ if (separation < MIN_LATERAL_SEPARATION) continue;
7683
+ votes.push({
7684
+ sign: leftCenter.x > rightCenter.x ? 1 : -1,
7685
+ weight: separation,
7686
+ evidence: `pair:${region.name}/${other.name}:${leftCenter.x.toFixed(3)}/${rightCenter.x.toFixed(3)}`
7687
+ });
7688
+ }
7689
+ if (votes.length === 0) {
7690
+ for (const region of regions) {
7691
+ const side = getRegionSemanticSide(region.name);
7692
+ if (!side) continue;
7693
+ const center = getRegionLocalCenter(model, region, characterConfig);
7694
+ if (!center || Math.abs(center.x) < MIN_LATERAL_SEPARATION) continue;
7695
+ const sign = side === "left" ? center.x > 0 ? 1 : -1 : center.x > 0 ? -1 : 1;
7696
+ votes.push({
7697
+ sign,
7698
+ weight: Math.abs(center.x),
7699
+ evidence: `single:${region.name}:${center.x.toFixed(3)}`
7700
+ });
7701
+ }
7702
+ }
7703
+ if (votes.length === 0) {
7704
+ return getDefaultAnnotationLaterality();
7705
+ }
7706
+ let signedWeight = 0;
7707
+ let totalWeight = 0;
7708
+ for (const vote of votes) {
7709
+ signedWeight += vote.sign * vote.weight;
7710
+ totalWeight += vote.weight;
7711
+ }
7712
+ if (Math.abs(signedWeight) < MIN_LATERAL_SEPARATION) {
7713
+ return getDefaultAnnotationLaterality();
7714
+ }
7715
+ return {
7716
+ leftSideX: signedWeight > 0 ? 1 : -1,
7717
+ confidence: totalWeight > 0 ? Math.abs(signedWeight) / totalWeight : 0,
7718
+ evidence: votes.map((vote) => vote.evidence)
7719
+ };
7720
+ }
7721
+ function resolveRegionCameraAngle(region, laterality) {
7722
+ if (region.cameraAngle === void 0) {
7723
+ return void 0;
7724
+ }
7725
+ const normalizedAngle = normalizeCameraAngle(region.cameraAngle);
7726
+ const side = getRegionSemanticSide(region.name);
7727
+ if (side && (normalizedAngle === 90 || normalizedAngle === 270)) {
7728
+ return side === "left" ? laterality.leftSideX > 0 ? 90 : 270 : laterality.leftSideX > 0 ? 270 : 90;
7729
+ }
7730
+ return normalizedAngle;
7731
+ }
7732
+ function resolveRegionVisibilityCameraAngle(region, laterality) {
7733
+ const explicitAngle = resolveRegionCameraAngle(region, laterality);
7734
+ if (explicitAngle !== void 0) {
7735
+ return explicitAngle;
7736
+ }
7737
+ if (!region.parent) {
7738
+ return void 0;
7739
+ }
7740
+ const side = getRegionSemanticSide(region.name);
7741
+ if (!side) {
7742
+ return void 0;
7743
+ }
7744
+ return side === "left" ? laterality.leftSideX > 0 ? 90 : 270 : laterality.leftSideX > 0 ? 270 : 90;
7745
+ }
7746
+ function toWorldDirection(model, localDirection) {
7747
+ const worldDirection = localDirection.clone();
7748
+ if (model) {
7749
+ model.updateMatrixWorld(true);
7750
+ const worldQuaternion = new THREE2.Quaternion();
7751
+ model.getWorldQuaternion(worldQuaternion);
7752
+ worldDirection.applyQuaternion(worldQuaternion);
7753
+ }
7754
+ return worldDirection.normalize();
7755
+ }
7756
+ function toModelLocalDirection2(model, worldDirection) {
7757
+ const localDirection = worldDirection.clone();
7758
+ if (model) {
7759
+ model.updateMatrixWorld(true);
7760
+ const worldQuaternion = new THREE2.Quaternion();
7761
+ model.getWorldQuaternion(worldQuaternion);
7762
+ localDirection.applyQuaternion(worldQuaternion.invert());
7763
+ }
7764
+ return localDirection.normalize();
7765
+ }
7766
+ function getWorldDirectionForCameraAngle(model, cameraAngle) {
7767
+ const angleRad = normalizeCameraAngle(cameraAngle) * Math.PI / 180;
7768
+ return toWorldDirection(
7769
+ model,
7770
+ new THREE2.Vector3(Math.sin(angleRad), 0, Math.cos(angleRad))
7771
+ );
7772
+ }
7773
+ function getModelLocalOrbitAngle(model, modelCenter, worldPosition) {
7774
+ const worldOffset = new THREE2.Vector3().subVectors(worldPosition, modelCenter);
7775
+ const localOffset = toModelLocalDirection2(model, worldOffset);
7776
+ return normalizeCameraAngle(Math.atan2(localOffset.x, localOffset.z) * (180 / Math.PI));
7777
+ }
7778
+ function passesMarkerCameraAngleGate(params) {
7779
+ const { markerAngle, currentCameraAngle, rangeDegrees = 90 } = params;
7780
+ if (markerAngle === void 0 || markerAngle === 0 || currentCameraAngle === void 0) {
7781
+ return true;
7782
+ }
7783
+ let diff = Math.abs(currentCameraAngle - markerAngle);
7784
+ if (diff > 180) diff = 360 - diff;
7785
+ return diff <= rangeDegrees;
7786
+ }
7787
+
7520
7788
  // src/physics/HairPhysics.ts
7521
7789
  var DEFAULT_HAIR_PHYSICS_CONFIG = {
7522
7790
  mass: 1,
@@ -8625,6 +8893,6 @@ async function analyzeModel(options) {
8625
8893
  };
8626
8894
  }
8627
8895
 
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 };
8896
+ 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, detectAnnotationLaterality, detectFacingDirection, extendCharacterConfigWithPreset, extendPresetWithProfile, extendProfileConfigWithPreset, extractFromGLTF, extractLegacyCharacterProfileOverrides, extractModelData, extractProfileOverrides, findFaceCenter, fuzzyNameMatch, generateMappingCorrections, getDefaultAnnotationLaterality, getMeshNamesForAUProfile, getMeshNamesForVisemeProfile, getModelForwardDirection, getModelLocalOrbitAngle, getPreset, getPresetWithProfile, getProfilePresetId, getProfileVisemeSlots, getRegionSemanticSide, getSemanticHorizontalSign, getSemanticHorizontalSignForSide, getVisemeBindingTargets, getVisemeJawAmounts, getVisemeSlotIndex, getWorldDirectionForCameraAngle, hasLeftRightMorphs, isMixedAU, isPresetCompatible, mapProviderVisemeToSlot, mergeRegionsByName as mergeCharacterRegionsByName, mergeProfileRegionsByName, normalizeCameraAngle, passesMarkerCameraAngleGate, resolveBoneName, resolveBoneNames, resolveFaceCenter, resolvePreset, resolvePresetWithOverrides, resolveProfileFromPreset, resolveRegionCameraAngle, resolveRegionVisibilityCameraAngle, resolveVisemeMeshCategory, suggestBestPreset, toModelLocalDirection2 as toModelLocalDirection, toWorldDirection, validateMappingConfig, validateMappings };
8629
8897
  //# sourceMappingURL=index.js.map
8630
8898
  //# sourceMappingURL=index.js.map