@aura3d/engine 1.0.10 → 1.3.0

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.
Files changed (533) hide show
  1. package/README.md +59 -23
  2. package/dist/animation/AnimationClipEvents.d.ts +55 -0
  3. package/dist/animation/AnimationClipEvents.d.ts.map +1 -1
  4. package/dist/animation/AnimationClipEvents.js +136 -0
  5. package/dist/animation/AnimationClipEvents.js.map +1 -1
  6. package/dist/animation/AnimationClipRegistry.d.ts +22 -0
  7. package/dist/animation/AnimationClipRegistry.d.ts.map +1 -1
  8. package/dist/animation/AnimationClipRegistry.js +89 -0
  9. package/dist/animation/AnimationClipRegistry.js.map +1 -1
  10. package/dist/animation/AnimationController.d.ts +14 -0
  11. package/dist/animation/AnimationController.d.ts.map +1 -1
  12. package/dist/animation/AnimationController.js +21 -0
  13. package/dist/animation/AnimationController.js.map +1 -1
  14. package/dist/animation/AnimationMixer.d.ts +10 -0
  15. package/dist/animation/AnimationMixer.d.ts.map +1 -1
  16. package/dist/animation/AnimationMixer.js +35 -0
  17. package/dist/animation/AnimationMixer.js.map +1 -1
  18. package/dist/animation/AnimationStateGraph.d.ts +20 -1
  19. package/dist/animation/AnimationStateGraph.d.ts.map +1 -1
  20. package/dist/animation/AnimationStateGraph.js +73 -1
  21. package/dist/animation/AnimationStateGraph.js.map +1 -1
  22. package/dist/animation/AnimationStateMachine.d.ts +26 -0
  23. package/dist/animation/AnimationStateMachine.d.ts.map +1 -1
  24. package/dist/animation/AnimationStateMachine.js +32 -0
  25. package/dist/animation/AnimationStateMachine.js.map +1 -1
  26. package/dist/animation/Bone.d.ts +4 -0
  27. package/dist/animation/Bone.d.ts.map +1 -1
  28. package/dist/animation/Bone.js +3 -0
  29. package/dist/animation/Bone.js.map +1 -1
  30. package/dist/animation/FighterAnimationAdapter.d.ts +49 -0
  31. package/dist/animation/FighterAnimationAdapter.d.ts.map +1 -0
  32. package/dist/animation/FighterAnimationAdapter.js +71 -0
  33. package/dist/animation/FighterAnimationAdapter.js.map +1 -0
  34. package/dist/animation/FootIk.d.ts +77 -0
  35. package/dist/animation/FootIk.d.ts.map +1 -0
  36. package/dist/animation/FootIk.js +153 -0
  37. package/dist/animation/FootIk.js.map +1 -0
  38. package/dist/animation/HumanoidBoneInference.d.ts +61 -0
  39. package/dist/animation/HumanoidBoneInference.d.ts.map +1 -0
  40. package/dist/animation/HumanoidBoneInference.js +239 -0
  41. package/dist/animation/HumanoidBoneInference.js.map +1 -0
  42. package/dist/animation/HumanoidRetargeting.d.ts +57 -0
  43. package/dist/animation/HumanoidRetargeting.d.ts.map +1 -1
  44. package/dist/animation/HumanoidRetargeting.js +184 -6
  45. package/dist/animation/HumanoidRetargeting.js.map +1 -1
  46. package/dist/animation/IK.d.ts +5 -0
  47. package/dist/animation/IK.d.ts.map +1 -1
  48. package/dist/animation/IK.js +9 -0
  49. package/dist/animation/IK.js.map +1 -1
  50. package/dist/animation/Inertialization.d.ts +65 -0
  51. package/dist/animation/Inertialization.d.ts.map +1 -0
  52. package/dist/animation/Inertialization.js +211 -0
  53. package/dist/animation/Inertialization.js.map +1 -0
  54. package/dist/animation/LocomotionController.d.ts +5 -0
  55. package/dist/animation/LocomotionController.d.ts.map +1 -1
  56. package/dist/animation/LocomotionController.js +3 -0
  57. package/dist/animation/LocomotionController.js.map +1 -1
  58. package/dist/animation/LocomotionKit.d.ts +52 -0
  59. package/dist/animation/LocomotionKit.d.ts.map +1 -0
  60. package/dist/animation/LocomotionKit.js +38 -0
  61. package/dist/animation/LocomotionKit.js.map +1 -0
  62. package/dist/animation/MotionQuality.d.ts +6 -0
  63. package/dist/animation/MotionQuality.d.ts.map +1 -1
  64. package/dist/animation/MotionQuality.js +16 -0
  65. package/dist/animation/MotionQuality.js.map +1 -1
  66. package/dist/animation/RigQuality.d.ts +31 -0
  67. package/dist/animation/RigQuality.d.ts.map +1 -0
  68. package/dist/animation/RigQuality.js +70 -0
  69. package/dist/animation/RigQuality.js.map +1 -0
  70. package/dist/animation/SecondaryAnimationFixtures.d.ts.map +1 -1
  71. package/dist/animation/SecondaryAnimationFixtures.js +1 -3
  72. package/dist/animation/SecondaryAnimationFixtures.js.map +1 -1
  73. package/dist/animation/Skeleton.d.ts +16 -1
  74. package/dist/animation/Skeleton.d.ts.map +1 -1
  75. package/dist/animation/Skeleton.js +42 -0
  76. package/dist/animation/Skeleton.js.map +1 -1
  77. package/dist/animation/SpringBones.d.ts +60 -0
  78. package/dist/animation/SpringBones.d.ts.map +1 -0
  79. package/dist/animation/SpringBones.js +173 -0
  80. package/dist/animation/SpringBones.js.map +1 -0
  81. package/dist/animation/browser-index.d.ts +12 -3
  82. package/dist/animation/browser-index.d.ts.map +1 -1
  83. package/dist/animation/browser-index.js +11 -2
  84. package/dist/animation/browser-index.js.map +1 -1
  85. package/dist/animation/index.d.ts +11 -3
  86. package/dist/animation/index.d.ts.map +1 -1
  87. package/dist/animation/index.js +10 -2
  88. package/dist/animation/index.js.map +1 -1
  89. package/dist/animation/library/performanceStateGraph.d.ts +42 -0
  90. package/dist/animation/library/performanceStateGraph.d.ts.map +1 -0
  91. package/dist/animation/library/performanceStateGraph.js +101 -0
  92. package/dist/animation/library/performanceStateGraph.js.map +1 -0
  93. package/dist/animation/library/standardHumanoidClips.d.ts +27 -0
  94. package/dist/animation/library/standardHumanoidClips.d.ts.map +1 -0
  95. package/dist/animation/library/standardHumanoidClips.js +357 -0
  96. package/dist/animation/library/standardHumanoidClips.js.map +1 -0
  97. package/dist/assets/GLTFAnimationRuntime.d.ts +85 -0
  98. package/dist/assets/GLTFAnimationRuntime.d.ts.map +1 -1
  99. package/dist/assets/GLTFAnimationRuntime.js +143 -0
  100. package/dist/assets/GLTFAnimationRuntime.js.map +1 -1
  101. package/dist/assets/GLTFAutoFit.d.ts +61 -0
  102. package/dist/assets/GLTFAutoFit.d.ts.map +1 -0
  103. package/dist/assets/GLTFAutoFit.js +77 -0
  104. package/dist/assets/GLTFAutoFit.js.map +1 -0
  105. package/dist/assets/GLTFLoader.d.ts +21 -0
  106. package/dist/assets/GLTFLoader.d.ts.map +1 -1
  107. package/dist/assets/GLTFLoader.js +60 -15
  108. package/dist/assets/GLTFLoader.js.map +1 -1
  109. package/dist/assets/GLTFRenderResources.d.ts +9 -1
  110. package/dist/assets/GLTFRenderResources.d.ts.map +1 -1
  111. package/dist/assets/GLTFRenderResources.js +93 -4
  112. package/dist/assets/GLTFRenderResources.js.map +1 -1
  113. package/dist/assets/browser-index.d.ts +6 -4
  114. package/dist/assets/browser-index.d.ts.map +1 -1
  115. package/dist/assets/browser-index.js +3 -2
  116. package/dist/assets/browser-index.js.map +1 -1
  117. package/dist/assets/index.d.ts +7 -5
  118. package/dist/assets/index.d.ts.map +1 -1
  119. package/dist/assets/index.js +4 -3
  120. package/dist/assets/index.js.map +1 -1
  121. package/dist/audio/AudioBus.d.ts +2 -0
  122. package/dist/audio/AudioBus.d.ts.map +1 -1
  123. package/dist/audio/AudioBus.js +6 -0
  124. package/dist/audio/AudioBus.js.map +1 -1
  125. package/dist/audio/AudioFileManager.d.ts +23 -0
  126. package/dist/audio/AudioFileManager.d.ts.map +1 -1
  127. package/dist/audio/AudioFileManager.js +60 -0
  128. package/dist/audio/AudioFileManager.js.map +1 -1
  129. package/dist/audio/AudioMixer.d.ts +43 -0
  130. package/dist/audio/AudioMixer.d.ts.map +1 -1
  131. package/dist/audio/AudioMixer.js +43 -0
  132. package/dist/audio/AudioMixer.js.map +1 -1
  133. package/dist/audio/AudioTimelineTrack.d.ts +25 -0
  134. package/dist/audio/AudioTimelineTrack.d.ts.map +1 -1
  135. package/dist/audio/AudioTimelineTrack.js +59 -0
  136. package/dist/audio/AudioTimelineTrack.js.map +1 -1
  137. package/dist/audio/AudioWaveform.d.ts +22 -0
  138. package/dist/audio/AudioWaveform.d.ts.map +1 -1
  139. package/dist/audio/AudioWaveform.js +18 -0
  140. package/dist/audio/AudioWaveform.js.map +1 -1
  141. package/dist/audio/index.d.ts +8 -7
  142. package/dist/audio/index.d.ts.map +1 -1
  143. package/dist/audio/index.js +4 -4
  144. package/dist/audio/index.js.map +1 -1
  145. package/dist/aura3d-cli/animation-asset-profiles.d.ts +15 -0
  146. package/dist/aura3d-cli/animation-asset-profiles.d.ts.map +1 -0
  147. package/dist/aura3d-cli/animation-asset-profiles.js +46 -0
  148. package/dist/aura3d-cli/animation-asset-profiles.js.map +1 -0
  149. package/dist/aura3d-cli/animation-asset-validator.d.ts +22 -0
  150. package/dist/aura3d-cli/animation-asset-validator.d.ts.map +1 -0
  151. package/dist/aura3d-cli/animation-asset-validator.js +49 -0
  152. package/dist/aura3d-cli/animation-asset-validator.js.map +1 -0
  153. package/dist/aura3d-cli/cartoon-asset-profiles.d.ts +1 -0
  154. package/dist/aura3d-cli/cartoon-asset-profiles.d.ts.map +1 -1
  155. package/dist/aura3d-cli/cartoon-asset-profiles.js +8 -4
  156. package/dist/aura3d-cli/cartoon-asset-profiles.js.map +1 -1
  157. package/dist/aura3d-cli/cli.js +78 -9
  158. package/dist/aura3d-cli/cli.js.map +1 -1
  159. package/dist/aura3d-cli/game-asset-validator.d.ts +4 -4
  160. package/dist/aura3d-cli/game-asset-validator.d.ts.map +1 -1
  161. package/dist/aura3d-cli/game-asset-validator.js +2 -2
  162. package/dist/aura3d-cli/game-asset-validator.js.map +1 -1
  163. package/dist/aura3d-cli/index.d.ts +69 -8
  164. package/dist/aura3d-cli/index.d.ts.map +1 -1
  165. package/dist/aura3d-cli/index.js +261 -17
  166. package/dist/aura3d-cli/index.js.map +1 -1
  167. package/dist/aura3d-cli/pull-bridge.d.ts +30 -4
  168. package/dist/aura3d-cli/pull-bridge.d.ts.map +1 -1
  169. package/dist/aura3d-cli/pull-bridge.js +320 -51
  170. package/dist/aura3d-cli/pull-bridge.js.map +1 -1
  171. package/dist/create-aura3d/index.d.ts +1 -1
  172. package/dist/create-aura3d/index.d.ts.map +1 -1
  173. package/dist/create-aura3d/index.js +6 -4
  174. package/dist/create-aura3d/index.js.map +1 -1
  175. package/dist/editor-runtime/AnimationSceneEditor.d.ts +111 -0
  176. package/dist/editor-runtime/AnimationSceneEditor.d.ts.map +1 -0
  177. package/dist/editor-runtime/AnimationSceneEditor.js +285 -0
  178. package/dist/editor-runtime/AnimationSceneEditor.js.map +1 -0
  179. package/dist/editor-runtime/AssetDropZone.d.ts +10 -8
  180. package/dist/editor-runtime/AssetDropZone.d.ts.map +1 -1
  181. package/dist/editor-runtime/AssetDropZone.js +14 -0
  182. package/dist/editor-runtime/AssetDropZone.js.map +1 -1
  183. package/dist/editor-runtime/CameraPathEditor.d.ts +48 -0
  184. package/dist/editor-runtime/CameraPathEditor.d.ts.map +1 -0
  185. package/dist/editor-runtime/CameraPathEditor.js +181 -0
  186. package/dist/editor-runtime/CameraPathEditor.js.map +1 -0
  187. package/dist/editor-runtime/CartoonSceneEditor.d.ts +24 -0
  188. package/dist/editor-runtime/CartoonSceneEditor.d.ts.map +1 -1
  189. package/dist/editor-runtime/CartoonSceneEditor.js +35 -2
  190. package/dist/editor-runtime/CartoonSceneEditor.js.map +1 -1
  191. package/dist/editor-runtime/EpisodeReviewPanel.d.ts +67 -0
  192. package/dist/editor-runtime/EpisodeReviewPanel.d.ts.map +1 -0
  193. package/dist/editor-runtime/EpisodeReviewPanel.js +162 -0
  194. package/dist/editor-runtime/EpisodeReviewPanel.js.map +1 -0
  195. package/dist/editor-runtime/EventTrackEditor.d.ts +54 -0
  196. package/dist/editor-runtime/EventTrackEditor.d.ts.map +1 -0
  197. package/dist/editor-runtime/EventTrackEditor.js +124 -0
  198. package/dist/editor-runtime/EventTrackEditor.js.map +1 -0
  199. package/dist/editor-runtime/MultiUserReviewWorkflow.d.ts +77 -0
  200. package/dist/editor-runtime/MultiUserReviewWorkflow.d.ts.map +1 -0
  201. package/dist/editor-runtime/MultiUserReviewWorkflow.js +162 -0
  202. package/dist/editor-runtime/MultiUserReviewWorkflow.js.map +1 -0
  203. package/dist/editor-runtime/NonlinearAnimationEditor.d.ts +81 -0
  204. package/dist/editor-runtime/NonlinearAnimationEditor.d.ts.map +1 -0
  205. package/dist/editor-runtime/NonlinearAnimationEditor.js +180 -0
  206. package/dist/editor-runtime/NonlinearAnimationEditor.js.map +1 -0
  207. package/dist/editor-runtime/RenderQueuePanel.d.ts +38 -0
  208. package/dist/editor-runtime/RenderQueuePanel.d.ts.map +1 -0
  209. package/dist/editor-runtime/RenderQueuePanel.js +72 -0
  210. package/dist/editor-runtime/RenderQueuePanel.js.map +1 -0
  211. package/dist/editor-runtime/SceneOutliner.d.ts +3 -3
  212. package/dist/editor-runtime/SceneOutliner.d.ts.map +1 -1
  213. package/dist/editor-runtime/SceneOutliner.js.map +1 -1
  214. package/dist/editor-runtime/TimelineEditorController.d.ts +10 -0
  215. package/dist/editor-runtime/TimelineEditorController.d.ts.map +1 -1
  216. package/dist/editor-runtime/TimelineEditorController.js +28 -3
  217. package/dist/editor-runtime/TimelineEditorController.js.map +1 -1
  218. package/dist/editor-runtime/TimelineUI.d.ts.map +1 -1
  219. package/dist/editor-runtime/TimelineUI.js +5 -0
  220. package/dist/editor-runtime/TimelineUI.js.map +1 -1
  221. package/dist/editor-runtime/VisualReviewDashboard.d.ts +43 -0
  222. package/dist/editor-runtime/VisualReviewDashboard.d.ts.map +1 -0
  223. package/dist/editor-runtime/VisualReviewDashboard.js +47 -0
  224. package/dist/editor-runtime/VisualReviewDashboard.js.map +1 -0
  225. package/dist/editor-runtime/index.d.ts +18 -4
  226. package/dist/editor-runtime/index.d.ts.map +1 -1
  227. package/dist/editor-runtime/index.js +8 -1
  228. package/dist/editor-runtime/index.js.map +1 -1
  229. package/dist/engine/agent-api/AnimationAssetManifest.d.ts +50 -0
  230. package/dist/engine/agent-api/AnimationAssetManifest.d.ts.map +1 -0
  231. package/dist/engine/agent-api/AnimationAssetManifest.js +65 -0
  232. package/dist/engine/agent-api/AnimationAssetManifest.js.map +1 -0
  233. package/dist/engine/agent-api/AnimationDirector.d.ts +120 -0
  234. package/dist/engine/agent-api/AnimationDirector.d.ts.map +1 -0
  235. package/dist/engine/agent-api/AnimationDirector.js +432 -0
  236. package/dist/engine/agent-api/AnimationDirector.js.map +1 -0
  237. package/dist/engine/agent-api/AnimationEpisodePackage.d.ts +51 -0
  238. package/dist/engine/agent-api/AnimationEpisodePackage.d.ts.map +1 -0
  239. package/dist/engine/agent-api/AnimationEpisodePackage.js +79 -0
  240. package/dist/engine/agent-api/AnimationEpisodePackage.js.map +1 -0
  241. package/dist/engine/agent-api/AnimationMotionQuality.d.ts +83 -0
  242. package/dist/engine/agent-api/AnimationMotionQuality.d.ts.map +1 -0
  243. package/dist/engine/agent-api/AnimationMotionQuality.js +128 -0
  244. package/dist/engine/agent-api/AnimationMotionQuality.js.map +1 -0
  245. package/dist/engine/agent-api/AnimationPerformance.d.ts +150 -0
  246. package/dist/engine/agent-api/AnimationPerformance.d.ts.map +1 -0
  247. package/dist/engine/agent-api/AnimationPerformance.js +345 -0
  248. package/dist/engine/agent-api/AnimationPerformance.js.map +1 -0
  249. package/dist/engine/agent-api/AnimationRenderQueue.d.ts +143 -0
  250. package/dist/engine/agent-api/AnimationRenderQueue.d.ts.map +1 -0
  251. package/dist/engine/agent-api/AnimationRenderQueue.js +410 -0
  252. package/dist/engine/agent-api/AnimationRenderQueue.js.map +1 -0
  253. package/dist/engine/agent-api/AnimationRouteProof.d.ts +112 -0
  254. package/dist/engine/agent-api/AnimationRouteProof.d.ts.map +1 -0
  255. package/dist/engine/agent-api/AnimationRouteProof.js +127 -0
  256. package/dist/engine/agent-api/AnimationRouteProof.js.map +1 -0
  257. package/dist/engine/agent-api/AssetLibraryBrowser.d.ts +43 -5
  258. package/dist/engine/agent-api/AssetLibraryBrowser.d.ts.map +1 -1
  259. package/dist/engine/agent-api/AssetLibraryBrowser.js +56 -4
  260. package/dist/engine/agent-api/AssetLibraryBrowser.js.map +1 -1
  261. package/dist/engine/agent-api/AudioMuxer.d.ts +4 -0
  262. package/dist/engine/agent-api/AudioMuxer.d.ts.map +1 -1
  263. package/dist/engine/agent-api/AudioMuxer.js +6 -0
  264. package/dist/engine/agent-api/AudioMuxer.js.map +1 -1
  265. package/dist/engine/agent-api/AudioVisemeAnalyzer.d.ts +4 -0
  266. package/dist/engine/agent-api/AudioVisemeAnalyzer.d.ts.map +1 -1
  267. package/dist/engine/agent-api/AudioVisemeAnalyzer.js +3 -0
  268. package/dist/engine/agent-api/AudioVisemeAnalyzer.js.map +1 -1
  269. package/dist/engine/agent-api/AuraVoiceBridge.d.ts +7 -7
  270. package/dist/engine/agent-api/AuraVoiceBridge.d.ts.map +1 -1
  271. package/dist/engine/agent-api/AuraVoiceBridge.js +5 -5
  272. package/dist/engine/agent-api/AuraVoiceBridge.js.map +1 -1
  273. package/dist/engine/agent-api/BatchEpisodeRenderer.d.ts +31 -0
  274. package/dist/engine/agent-api/BatchEpisodeRenderer.d.ts.map +1 -0
  275. package/dist/engine/agent-api/BatchEpisodeRenderer.js +20 -0
  276. package/dist/engine/agent-api/BatchEpisodeRenderer.js.map +1 -0
  277. package/dist/engine/agent-api/BodyLanguageLibrary.d.ts +3 -3
  278. package/dist/engine/agent-api/BodyLanguageLibrary.d.ts.map +1 -1
  279. package/dist/engine/agent-api/BodyLanguageLibrary.js.map +1 -1
  280. package/dist/engine/agent-api/BrowserFrameCaptureAdapter.d.ts +65 -0
  281. package/dist/engine/agent-api/BrowserFrameCaptureAdapter.d.ts.map +1 -0
  282. package/dist/engine/agent-api/BrowserFrameCaptureAdapter.js +42 -0
  283. package/dist/engine/agent-api/BrowserFrameCaptureAdapter.js.map +1 -0
  284. package/dist/engine/agent-api/CameraPresetLibrary.d.ts +1 -1
  285. package/dist/engine/agent-api/CameraPresetLibrary.d.ts.map +1 -1
  286. package/dist/engine/agent-api/CameraPresetLibrary.js +18 -0
  287. package/dist/engine/agent-api/CameraPresetLibrary.js.map +1 -1
  288. package/dist/engine/agent-api/CaptionExporter.d.ts +5 -1
  289. package/dist/engine/agent-api/CaptionExporter.d.ts.map +1 -1
  290. package/dist/engine/agent-api/CaptionExporter.js +18 -3
  291. package/dist/engine/agent-api/CaptionExporter.js.map +1 -1
  292. package/dist/engine/agent-api/CartoonAssetManifest.d.ts +19 -1
  293. package/dist/engine/agent-api/CartoonAssetManifest.d.ts.map +1 -1
  294. package/dist/engine/agent-api/CartoonAssetManifest.js +62 -1
  295. package/dist/engine/agent-api/CartoonAssetManifest.js.map +1 -1
  296. package/dist/engine/agent-api/CartoonDirector.d.ts +26 -1
  297. package/dist/engine/agent-api/CartoonDirector.d.ts.map +1 -1
  298. package/dist/engine/agent-api/CartoonDirector.js +92 -2
  299. package/dist/engine/agent-api/CartoonDirector.js.map +1 -1
  300. package/dist/engine/agent-api/CartoonEpisodePackage.d.ts +51 -0
  301. package/dist/engine/agent-api/CartoonEpisodePackage.d.ts.map +1 -0
  302. package/dist/engine/agent-api/CartoonEpisodePackage.js +79 -0
  303. package/dist/engine/agent-api/CartoonEpisodePackage.js.map +1 -0
  304. package/dist/engine/agent-api/CartoonMotionQuality.d.ts +83 -0
  305. package/dist/engine/agent-api/CartoonMotionQuality.d.ts.map +1 -0
  306. package/dist/engine/agent-api/CartoonMotionQuality.js +128 -0
  307. package/dist/engine/agent-api/CartoonMotionQuality.js.map +1 -0
  308. package/dist/engine/agent-api/CartoonPerformance.d.ts +1 -0
  309. package/dist/engine/agent-api/CartoonPerformance.d.ts.map +1 -1
  310. package/dist/engine/agent-api/CartoonPerformance.js +28 -0
  311. package/dist/engine/agent-api/CartoonPerformance.js.map +1 -1
  312. package/dist/engine/agent-api/CartoonRenderQueue.d.ts +11 -0
  313. package/dist/engine/agent-api/CartoonRenderQueue.d.ts.map +1 -1
  314. package/dist/engine/agent-api/CartoonRenderQueue.js +25 -0
  315. package/dist/engine/agent-api/CartoonRenderQueue.js.map +1 -1
  316. package/dist/engine/agent-api/CartoonRouteProof.d.ts +112 -0
  317. package/dist/engine/agent-api/CartoonRouteProof.d.ts.map +1 -0
  318. package/dist/engine/agent-api/CartoonRouteProof.js +127 -0
  319. package/dist/engine/agent-api/CartoonRouteProof.js.map +1 -0
  320. package/dist/engine/agent-api/CharacterAssembly.d.ts +2 -2
  321. package/dist/engine/agent-api/CharacterAssembly.d.ts.map +1 -1
  322. package/dist/engine/agent-api/CloudRenderAdapter.d.ts +55 -0
  323. package/dist/engine/agent-api/CloudRenderAdapter.d.ts.map +1 -0
  324. package/dist/engine/agent-api/CloudRenderAdapter.js +75 -0
  325. package/dist/engine/agent-api/CloudRenderAdapter.js.map +1 -0
  326. package/dist/engine/agent-api/ExternalPhonemeAnalyzer.d.ts +54 -0
  327. package/dist/engine/agent-api/ExternalPhonemeAnalyzer.d.ts.map +1 -0
  328. package/dist/engine/agent-api/ExternalPhonemeAnalyzer.js +107 -0
  329. package/dist/engine/agent-api/ExternalPhonemeAnalyzer.js.map +1 -0
  330. package/dist/engine/agent-api/FfmpegFrameEncoder.d.ts +129 -0
  331. package/dist/engine/agent-api/FfmpegFrameEncoder.d.ts.map +1 -0
  332. package/dist/engine/agent-api/FfmpegFrameEncoder.js +306 -0
  333. package/dist/engine/agent-api/FfmpegFrameEncoder.js.map +1 -0
  334. package/dist/engine/agent-api/FrameEncoder.d.ts +23 -6
  335. package/dist/engine/agent-api/FrameEncoder.d.ts.map +1 -1
  336. package/dist/engine/agent-api/FrameEncoder.js +14 -0
  337. package/dist/engine/agent-api/FrameEncoder.js.map +1 -1
  338. package/dist/engine/agent-api/GameAssetValidation.d.ts +1 -1
  339. package/dist/engine/agent-api/GameAssetValidation.d.ts.map +1 -1
  340. package/dist/engine/agent-api/MediaRecorderFrameEncoder.d.ts +19 -0
  341. package/dist/engine/agent-api/MediaRecorderFrameEncoder.d.ts.map +1 -0
  342. package/dist/engine/agent-api/MediaRecorderFrameEncoder.js +79 -0
  343. package/dist/engine/agent-api/MediaRecorderFrameEncoder.js.map +1 -0
  344. package/dist/engine/agent-api/PerformanceBlender.d.ts +23 -4
  345. package/dist/engine/agent-api/PerformanceBlender.d.ts.map +1 -1
  346. package/dist/engine/agent-api/PerformanceBlender.js +33 -0
  347. package/dist/engine/agent-api/PerformanceBlender.js.map +1 -1
  348. package/dist/engine/agent-api/PerformanceCaptureSession.d.ts +65 -0
  349. package/dist/engine/agent-api/PerformanceCaptureSession.d.ts.map +1 -0
  350. package/dist/engine/agent-api/PerformanceCaptureSession.js +131 -0
  351. package/dist/engine/agent-api/PerformanceCaptureSession.js.map +1 -0
  352. package/dist/engine/agent-api/PerformancePoseEditor.d.ts +8 -8
  353. package/dist/engine/agent-api/PerformancePoseEditor.d.ts.map +1 -1
  354. package/dist/engine/agent-api/PerformancePoseEditor.js.map +1 -1
  355. package/dist/engine/agent-api/PngSequenceEncoder.d.ts +34 -0
  356. package/dist/engine/agent-api/PngSequenceEncoder.d.ts.map +1 -0
  357. package/dist/engine/agent-api/PngSequenceEncoder.js +75 -0
  358. package/dist/engine/agent-api/PngSequenceEncoder.js.map +1 -0
  359. package/dist/engine/agent-api/PromptAnimationContract.d.ts +27 -2
  360. package/dist/engine/agent-api/PromptAnimationContract.d.ts.map +1 -1
  361. package/dist/engine/agent-api/PromptAnimationContract.js +60 -1
  362. package/dist/engine/agent-api/PromptAnimationContract.js.map +1 -1
  363. package/dist/engine/agent-api/PromptAnimationEvidence.d.ts +2 -2
  364. package/dist/engine/agent-api/PromptAnimationEvidence.d.ts.map +1 -1
  365. package/dist/engine/agent-api/PublishingPipeline.d.ts +8 -3
  366. package/dist/engine/agent-api/PublishingPipeline.d.ts.map +1 -1
  367. package/dist/engine/agent-api/PublishingPipeline.js +17 -3
  368. package/dist/engine/agent-api/PublishingPipeline.js.map +1 -1
  369. package/dist/engine/agent-api/RuntimeNodeHandle.d.ts +2 -0
  370. package/dist/engine/agent-api/RuntimeNodeHandle.d.ts.map +1 -1
  371. package/dist/engine/agent-api/RuntimeNodeHandle.js.map +1 -1
  372. package/dist/engine/agent-api/SceneGroundingUtils.d.ts +73 -0
  373. package/dist/engine/agent-api/SceneGroundingUtils.d.ts.map +1 -0
  374. package/dist/engine/agent-api/SceneGroundingUtils.js +74 -0
  375. package/dist/engine/agent-api/SceneGroundingUtils.js.map +1 -0
  376. package/dist/engine/agent-api/SceneSequencer.d.ts +13 -0
  377. package/dist/engine/agent-api/SceneSequencer.d.ts.map +1 -1
  378. package/dist/engine/agent-api/SceneSequencer.js +40 -0
  379. package/dist/engine/agent-api/SceneSequencer.js.map +1 -1
  380. package/dist/engine/agent-api/ShotTimeline.d.ts +3 -3
  381. package/dist/engine/agent-api/ShotTimeline.d.ts.map +1 -1
  382. package/dist/engine/agent-api/ShotTimeline.js.map +1 -1
  383. package/dist/engine/agent-api/ThumbnailGenerator.d.ts +4 -4
  384. package/dist/engine/agent-api/ThumbnailGenerator.d.ts.map +1 -1
  385. package/dist/engine/agent-api/ThumbnailGenerator.js.map +1 -1
  386. package/dist/engine/agent-api/VideoExportPipeline.d.ts +23 -9
  387. package/dist/engine/agent-api/VideoExportPipeline.d.ts.map +1 -1
  388. package/dist/engine/agent-api/VideoExportPipeline.js +32 -1
  389. package/dist/engine/agent-api/VideoExportPipeline.js.map +1 -1
  390. package/dist/engine/agent-api/VisemeController.d.ts +12 -0
  391. package/dist/engine/agent-api/VisemeController.d.ts.map +1 -1
  392. package/dist/engine/agent-api/VisemeController.js +23 -0
  393. package/dist/engine/agent-api/VisemeController.js.map +1 -1
  394. package/dist/engine/agent-api/WebCodecsFrameEncoder.d.ts +21 -0
  395. package/dist/engine/agent-api/WebCodecsFrameEncoder.d.ts.map +1 -0
  396. package/dist/engine/agent-api/WebCodecsFrameEncoder.js +94 -0
  397. package/dist/engine/agent-api/WebCodecsFrameEncoder.js.map +1 -0
  398. package/dist/engine/agent-api/YouTubeMetadataGenerator.d.ts +2 -2
  399. package/dist/engine/agent-api/YouTubeMetadataGenerator.d.ts.map +1 -1
  400. package/dist/engine/agent-api/YouTubeMetadataGenerator.js +1 -1
  401. package/dist/engine/agent-api/YouTubeMetadataGenerator.js.map +1 -1
  402. package/dist/engine/agent-api/YouTubeUploadAdapter.d.ts +48 -0
  403. package/dist/engine/agent-api/YouTubeUploadAdapter.d.ts.map +1 -0
  404. package/dist/engine/agent-api/YouTubeUploadAdapter.js +114 -0
  405. package/dist/engine/agent-api/YouTubeUploadAdapter.js.map +1 -0
  406. package/dist/engine/agent-api/humanoid-walk-runtime.d.ts +1 -1
  407. package/dist/engine/agent-api/index.d.ts +52 -18
  408. package/dist/engine/agent-api/index.d.ts.map +1 -1
  409. package/dist/engine/agent-api/index.js +51 -15
  410. package/dist/engine/agent-api/index.js.map +1 -1
  411. package/dist/engine/agent-api/product-viewer-runtime.d.ts.map +1 -1
  412. package/dist/engine/animation-studio/animation-episode-validator.d.ts +24 -0
  413. package/dist/engine/animation-studio/animation-episode-validator.d.ts.map +1 -0
  414. package/dist/engine/animation-studio/animation-episode-validator.js +74 -0
  415. package/dist/engine/animation-studio/animation-episode-validator.js.map +1 -0
  416. package/dist/engine/animation-studio/director-heuristics.d.ts +73 -0
  417. package/dist/engine/animation-studio/director-heuristics.d.ts.map +1 -0
  418. package/dist/engine/animation-studio/director-heuristics.js +149 -0
  419. package/dist/engine/animation-studio/director-heuristics.js.map +1 -0
  420. package/dist/engine/animation-studio/episode-document.d.ts +214 -0
  421. package/dist/engine/animation-studio/episode-document.d.ts.map +1 -0
  422. package/dist/engine/animation-studio/episode-document.js +143 -0
  423. package/dist/engine/animation-studio/episode-document.js.map +1 -0
  424. package/dist/engine/animation-studio/index.d.ts +20 -0
  425. package/dist/engine/animation-studio/index.d.ts.map +1 -0
  426. package/dist/engine/animation-studio/index.js +20 -0
  427. package/dist/engine/animation-studio/index.js.map +1 -0
  428. package/dist/engine/animation-studio/scene-tools.d.ts +34 -0
  429. package/dist/engine/animation-studio/scene-tools.d.ts.map +1 -0
  430. package/dist/engine/animation-studio/scene-tools.js +95 -0
  431. package/dist/engine/animation-studio/scene-tools.js.map +1 -0
  432. package/dist/engine/index.d.ts +2 -1
  433. package/dist/engine/index.d.ts.map +1 -1
  434. package/dist/engine/index.js +1 -1
  435. package/dist/engine/index.js.map +1 -1
  436. package/dist/engine/production-runtime/TypedGLBActor.d.ts +13 -1
  437. package/dist/engine/production-runtime/TypedGLBActor.d.ts.map +1 -1
  438. package/dist/engine/production-runtime/TypedGLBActor.js +8 -0
  439. package/dist/engine/production-runtime/TypedGLBActor.js.map +1 -1
  440. package/dist/physics/Raycast.d.ts +17 -0
  441. package/dist/physics/Raycast.d.ts.map +1 -1
  442. package/dist/physics/Raycast.js +16 -0
  443. package/dist/physics/Raycast.js.map +1 -1
  444. package/dist/rendering/ForwardPass.js +18 -13
  445. package/dist/rendering/ForwardPass.js.map +1 -1
  446. package/dist/rendering/FrameVisualMetrics.d.ts +19 -0
  447. package/dist/rendering/FrameVisualMetrics.d.ts.map +1 -1
  448. package/dist/rendering/FrameVisualMetrics.js +57 -0
  449. package/dist/rendering/FrameVisualMetrics.js.map +1 -1
  450. package/dist/rendering/MorphTargetPlan.d.ts +42 -0
  451. package/dist/rendering/MorphTargetPlan.d.ts.map +1 -0
  452. package/dist/rendering/MorphTargetPlan.js +129 -0
  453. package/dist/rendering/MorphTargetPlan.js.map +1 -0
  454. package/dist/rendering/MorphUnlitMaterial.d.ts.map +1 -1
  455. package/dist/rendering/MorphUnlitMaterial.js +7 -1
  456. package/dist/rendering/MorphUnlitMaterial.js.map +1 -1
  457. package/dist/rendering/ShaderLibrary.d.ts.map +1 -1
  458. package/dist/rendering/ShaderLibrary.js +34 -6
  459. package/dist/rendering/ShaderLibrary.js.map +1 -1
  460. package/dist/rendering/WebGPUDevice.d.ts +2 -0
  461. package/dist/rendering/WebGPUDevice.d.ts.map +1 -1
  462. package/dist/rendering/WebGPUDevice.js +69 -12
  463. package/dist/rendering/WebGPUDevice.js.map +1 -1
  464. package/dist/rendering/animation/AnimationMaterialStyle.d.ts +19 -0
  465. package/dist/rendering/animation/AnimationMaterialStyle.d.ts.map +1 -0
  466. package/dist/rendering/animation/AnimationMaterialStyle.js +13 -0
  467. package/dist/rendering/animation/AnimationMaterialStyle.js.map +1 -0
  468. package/dist/rendering/animation/AnimationRenderPreset.d.ts +36 -0
  469. package/dist/rendering/animation/AnimationRenderPreset.d.ts.map +1 -0
  470. package/dist/rendering/animation/AnimationRenderPreset.js +23 -0
  471. package/dist/rendering/animation/AnimationRenderPreset.js.map +1 -0
  472. package/dist/rendering/animation/AnimationToonMaterial.d.ts +130 -0
  473. package/dist/rendering/animation/AnimationToonMaterial.d.ts.map +1 -0
  474. package/dist/rendering/animation/AnimationToonMaterial.js +303 -0
  475. package/dist/rendering/animation/AnimationToonMaterial.js.map +1 -0
  476. package/dist/rendering/animation/AnimationVisualQuality.d.ts +28 -0
  477. package/dist/rendering/animation/AnimationVisualQuality.d.ts.map +1 -0
  478. package/dist/rendering/animation/AnimationVisualQuality.js +39 -0
  479. package/dist/rendering/animation/AnimationVisualQuality.js.map +1 -0
  480. package/dist/rendering/animation/applyAnimationRenderPreset.d.ts +79 -0
  481. package/dist/rendering/animation/applyAnimationRenderPreset.d.ts.map +1 -0
  482. package/dist/rendering/animation/applyAnimationRenderPreset.js +88 -0
  483. package/dist/rendering/animation/applyAnimationRenderPreset.js.map +1 -0
  484. package/dist/rendering/animation/index.d.ts +6 -0
  485. package/dist/rendering/animation/index.d.ts.map +1 -0
  486. package/dist/rendering/animation/index.js +6 -0
  487. package/dist/rendering/animation/index.js.map +1 -0
  488. package/dist/rendering/cartoon/CartoonMaterialStyle.d.ts +19 -0
  489. package/dist/rendering/cartoon/CartoonMaterialStyle.d.ts.map +1 -0
  490. package/dist/rendering/cartoon/CartoonMaterialStyle.js +13 -0
  491. package/dist/rendering/cartoon/CartoonMaterialStyle.js.map +1 -0
  492. package/dist/rendering/cartoon/CartoonRenderPreset.d.ts +36 -0
  493. package/dist/rendering/cartoon/CartoonRenderPreset.d.ts.map +1 -0
  494. package/dist/rendering/cartoon/CartoonRenderPreset.js +23 -0
  495. package/dist/rendering/cartoon/CartoonRenderPreset.js.map +1 -0
  496. package/dist/rendering/cartoon/CartoonToonMaterial.d.ts +130 -0
  497. package/dist/rendering/cartoon/CartoonToonMaterial.d.ts.map +1 -0
  498. package/dist/rendering/cartoon/CartoonToonMaterial.js +303 -0
  499. package/dist/rendering/cartoon/CartoonToonMaterial.js.map +1 -0
  500. package/dist/rendering/cartoon/CartoonVisualQuality.d.ts +28 -0
  501. package/dist/rendering/cartoon/CartoonVisualQuality.d.ts.map +1 -0
  502. package/dist/rendering/cartoon/CartoonVisualQuality.js +39 -0
  503. package/dist/rendering/cartoon/CartoonVisualQuality.js.map +1 -0
  504. package/dist/rendering/cartoon/applyCartoonRenderPreset.d.ts +79 -0
  505. package/dist/rendering/cartoon/applyCartoonRenderPreset.d.ts.map +1 -0
  506. package/dist/rendering/cartoon/applyCartoonRenderPreset.js +88 -0
  507. package/dist/rendering/cartoon/applyCartoonRenderPreset.js.map +1 -0
  508. package/dist/rendering/cartoon/index.d.ts +6 -0
  509. package/dist/rendering/cartoon/index.d.ts.map +1 -0
  510. package/dist/rendering/cartoon/index.js +6 -0
  511. package/dist/rendering/cartoon/index.js.map +1 -0
  512. package/dist/rendering/index.d.ts +6 -3
  513. package/dist/rendering/index.d.ts.map +1 -1
  514. package/dist/rendering/index.js +4 -2
  515. package/dist/rendering/index.js.map +1 -1
  516. package/dist/scripting/AnimationNodeCategories.d.ts +3 -0
  517. package/dist/scripting/AnimationNodeCategories.d.ts.map +1 -0
  518. package/dist/scripting/AnimationNodeCategories.js +9 -0
  519. package/dist/scripting/AnimationNodeCategories.js.map +1 -0
  520. package/dist/scripting/AnimationVisualNodes.d.ts +3 -0
  521. package/dist/scripting/AnimationVisualNodes.d.ts.map +1 -0
  522. package/dist/scripting/AnimationVisualNodes.js +41 -0
  523. package/dist/scripting/AnimationVisualNodes.js.map +1 -0
  524. package/dist/scripting/VisualGraphExecutor.js +24 -24
  525. package/dist/scripting/VisualGraphExecutor.js.map +1 -1
  526. package/dist/scripting/VisualNodeCatalog.js +2 -2
  527. package/dist/scripting/VisualNodeCatalog.js.map +1 -1
  528. package/dist/scripting/index.d.ts +3 -3
  529. package/dist/scripting/index.d.ts.map +1 -1
  530. package/dist/scripting/index.js +2 -2
  531. package/dist/scripting/index.js.map +1 -1
  532. package/package.json +162 -120
  533. package/templates/product-viewer/tests/screenshot.spec.ts +8 -16
@@ -0,0 +1,239 @@
1
+ import { HUMANOID_BONES, REQUIRED_HUMANOID_BONES } from "./HumanoidRetargeting.js";
2
+ /**
3
+ * Per-logical-group "core" tokens. These are matched against normalized node names. Side-bearing
4
+ * groups omit the side here — sidedness is detected separately (`L_`, `Left`, `_l`, `.R`, etc.) so
5
+ * a single table serves both sides. Keys are *logical groups* (`shoulder`, `upperArm`, …), not
6
+ * {@link HumanoidBoneName}s; the side-resolved slots are derived below in {@link SLOT_SPECS}.
7
+ */
8
+ const ALIAS_BY_KEY = {
9
+ hips: ["hips", "hip", "pelvis", "root", "cog", "bip01pelvis"],
10
+ spine: ["spine", "spine0", "spine00", "spine1", "spine01", "abdomen", "lowerback", "torso"],
11
+ chest: ["chest", "spine2", "spine02", "spine3", "ribcage", "upperback"],
12
+ upperChest: ["upperchest", "spine3", "spine03", "spine4", "upperchestspine"],
13
+ neck: ["neck", "neck0", "neck01", "neck1"],
14
+ head: ["head"],
15
+ shoulder: ["shoulder", "clavicle", "collar", "scapula"],
16
+ upperArm: ["upperarm", "armupper", "arm", "uparm", "shoulderarm", "humerus", "armupper01"],
17
+ lowerArm: ["lowerarm", "armlower", "forearm", "loarm", "elbow", "ulna", "armlower01"],
18
+ hand: ["hand", "wrist", "palm"],
19
+ upperLeg: ["upperleg", "legupper", "thigh", "upleg", "legupper01", "femur"],
20
+ lowerLeg: ["lowerleg", "leglower", "calf", "shin", "leg", "loleg", "knee", "leglower01", "tibia"],
21
+ foot: ["foot", "ankle"],
22
+ toes: ["toe", "toes", "toebase", "ball"]
23
+ };
24
+ const REQUIRED_SET = new Set(REQUIRED_HUMANOID_BONES);
25
+ const SLOT_SPECS = [
26
+ { bone: "hips", aliasKey: "hips", side: null },
27
+ { bone: "spine", aliasKey: "spine", side: null },
28
+ { bone: "chest", aliasKey: "chest", side: null },
29
+ { bone: "upperChest", aliasKey: "upperChest", side: null },
30
+ { bone: "neck", aliasKey: "neck", side: null },
31
+ { bone: "head", aliasKey: "head", side: null },
32
+ { bone: "leftShoulder", aliasKey: "shoulder", side: "left" },
33
+ { bone: "leftUpperArm", aliasKey: "upperArm", side: "left" },
34
+ { bone: "leftLowerArm", aliasKey: "lowerArm", side: "left" },
35
+ { bone: "leftHand", aliasKey: "hand", side: "left" },
36
+ { bone: "rightShoulder", aliasKey: "shoulder", side: "right" },
37
+ { bone: "rightUpperArm", aliasKey: "upperArm", side: "right" },
38
+ { bone: "rightLowerArm", aliasKey: "lowerArm", side: "right" },
39
+ { bone: "rightHand", aliasKey: "hand", side: "right" },
40
+ { bone: "leftUpperLeg", aliasKey: "upperLeg", side: "left" },
41
+ { bone: "leftLowerLeg", aliasKey: "lowerLeg", side: "left" },
42
+ { bone: "leftFoot", aliasKey: "foot", side: "left" },
43
+ { bone: "leftToes", aliasKey: "toes", side: "left" },
44
+ { bone: "rightUpperLeg", aliasKey: "upperLeg", side: "right" },
45
+ { bone: "rightLowerLeg", aliasKey: "lowerLeg", side: "right" },
46
+ { bone: "rightFoot", aliasKey: "foot", side: "right" },
47
+ { bone: "rightToes", aliasKey: "toes", side: "right" }
48
+ ].map((spec) => ({ ...spec, required: REQUIRED_SET.has(spec.bone) }));
49
+ const NAMESPACE_RE = /^(?:mixamorig\d*:|mixamorig\d*|bip\d*\s*|biped\s*|armature[|:_]?)/i;
50
+ function stripNamespace(name) {
51
+ let out = name;
52
+ // Blender/glTF skinned hierarchies often prefix `Armature|` or `Armature/`.
53
+ out = out.replace(/^armature[|/]/i, "");
54
+ out = out.replace(NAMESPACE_RE, "");
55
+ return out;
56
+ }
57
+ /** Collapse to alphanumerics only, lowercased — `L_Arm_Upper.01` -> `larmupper01`. */
58
+ function canonicalize(name) {
59
+ return name.toLowerCase().replace(/[^a-z0-9]/g, "");
60
+ }
61
+ function detectSide(raw) {
62
+ const lower = raw.toLowerCase();
63
+ // Explicit word boundaries first (left/right) — these are unambiguous.
64
+ if (/(^|[^a-z])left([^a-z]|$)|leftarm|leftleg|lefthand|leftfoot|leftshoulder|leftupleg/.test(lower))
65
+ return "left";
66
+ if (/(^|[^a-z])right([^a-z]|$)|rightarm|rightleg|righthand|rightfoot|rightshoulder|rightupleg/.test(lower))
67
+ return "right";
68
+ // Side prefixes: L_, R_, l., r. and suffixes: _l, _r, .l, .r, _L, name ends in L/R
69
+ if (/(^|[^a-z])l[_.\- ]/.test(lower) || /[_.\- ]l($|[^a-z])/.test(lower))
70
+ return "left";
71
+ if (/(^|[^a-z])r[_.\- ]/.test(lower) || /[_.\- ]r($|[^a-z])/.test(lower))
72
+ return "right";
73
+ // Leading single side letter directly glued to a part: "LShoulder", "RArm", "L_Leg".
74
+ if (/^l(?=[a-z0-9])/.test(lower) && !/^le(?!ft)/.test(lower) && !/^lo/.test(lower) && !/^la(?!rm)/.test(lower)) {
75
+ // crude: only treat leading "l" as side when followed by a known limb-ish token.
76
+ if (/^l(shoulder|arm|upperarm|lowerarm|forearm|hand|wrist|leg|upperleg|lowerleg|thigh|calf|shin|foot|ankle|toe|clav|coll)/.test(lower)) {
77
+ return "left";
78
+ }
79
+ }
80
+ if (/^r(?=[a-z0-9])/.test(lower)) {
81
+ if (/^r(shoulder|arm|upperarm|lowerarm|forearm|hand|wrist|leg|upperleg|lowerleg|thigh|calf|shin|foot|ankle|toe|clav|coll)/.test(lower)) {
82
+ return "right";
83
+ }
84
+ }
85
+ return null;
86
+ }
87
+ function normalizeNode(raw) {
88
+ const stripped = stripNamespace(raw);
89
+ return {
90
+ raw,
91
+ canon: canonicalize(stripped),
92
+ side: detectSide(stripped) ?? detectSide(raw)
93
+ };
94
+ }
95
+ /**
96
+ * Score how well `node` fits `aliasKey`. Returns 0 for no match. Higher = better.
97
+ * The score rewards: exact-token equality, longer alias fragments (more specific), and earlier
98
+ * occurrence in the name. This lets `spine2`/`chest` win the chest slot over a generic `spine`.
99
+ */
100
+ function scoreCandidate(node, aliasKey, aliases) {
101
+ let best = 0;
102
+ for (const alias of aliases) {
103
+ const a = canonicalize(alias);
104
+ if (a.length === 0)
105
+ continue;
106
+ const idx = node.canon.indexOf(a);
107
+ if (idx < 0)
108
+ continue;
109
+ // Base: specificity by alias length.
110
+ let score = 10 + a.length * 2;
111
+ // Exact match (whole canon equals alias) is the strongest signal.
112
+ if (node.canon === a)
113
+ score += 40;
114
+ // Side bones: a side-stripped exact-ish match where the remainder is only side tokens.
115
+ const remainder = node.canon.replace(a, "");
116
+ if (remainder.length <= 2)
117
+ score += 15;
118
+ // Prefer matches that appear toward the end (the "leaf" semantic token) for limb parts,
119
+ // but prefer earlier for spine/hips where the root token leads.
120
+ score += Math.max(0, 6 - idx);
121
+ if (score > best)
122
+ best = score;
123
+ }
124
+ // De-emphasize generic "spine" matching when the name clearly carries a chest/upperchest digit.
125
+ if (aliasKey === "spine" && /(spine[2-9]|spine0[2-9])/.test(node.canon)) {
126
+ best = Math.max(0, best - 12);
127
+ }
128
+ return best;
129
+ }
130
+ /**
131
+ * Infer a {@link HumanoidRigDefinition} from a flat list of skeleton node names.
132
+ *
133
+ * Strategy: each humanoid slot has a side-agnostic alias table plus an L/R/Left/Right side tag.
134
+ * For every slot we score all candidate nodes (filtered by detected side when the slot is sided),
135
+ * pick the highest-scoring one, and forbid reusing a node across slots. Conventions covered:
136
+ * Mixamo (`mixamorig:Hips`/`LeftArm`), Sketchfab/Blender (`Hip_00`, `Spine1..3`, `L_Shoulder`,
137
+ * `L_Arm_Upper_01`, `L_Leg_Upper_01`, `L_Hand`, `L_Foot`), and UE-ish (`pelvis`, `upperarm_l`,
138
+ * `thigh_r`, `calf_l`).
139
+ *
140
+ * Each produced {@link HumanoidBoneBinding} carries `name` (the resolved node) and `aliases`
141
+ * (the other plausible candidates for that slot), wiring the previously-unread `aliases` field.
142
+ */
143
+ export function inferHumanoidRigDetailed(nodeNames, options = {}) {
144
+ const nodes = nodeNames.map(normalizeNode);
145
+ const used = new Set();
146
+ const bones = {};
147
+ const matches = [];
148
+ // Process required + more-specific slots first so generic "spine"/"leg" don't steal nodes that a
149
+ // more specific slot (chest/upperChest/lowerLeg) wants. We sort by a static priority.
150
+ const ordered = [...SLOT_SPECS].sort((a, b) => slotPriority(a.bone) - slotPriority(b.bone));
151
+ for (const spec of ordered) {
152
+ const aliasList = mergeAliases(spec, options.extraAliases);
153
+ const candidates = [];
154
+ for (const node of nodes) {
155
+ if (used.has(node.raw))
156
+ continue;
157
+ if (spec.side && node.side && node.side !== spec.side)
158
+ continue;
159
+ // For sided slots, skip nodes with no detectable side only if a sided alternative exists.
160
+ const score = scoreCandidate(node, spec.aliasKey, aliasList);
161
+ if (score <= 0)
162
+ continue;
163
+ // Penalize sided slot matching a side-less node (ambiguous).
164
+ const adjusted = spec.side && !node.side ? score - 8 : score;
165
+ if (adjusted <= 0)
166
+ continue;
167
+ candidates.push({ node, score: adjusted });
168
+ }
169
+ candidates.sort((a, b) => b.score - a.score);
170
+ const winner = candidates[0];
171
+ const candidateNames = candidates.map((c) => c.node.raw);
172
+ if (winner) {
173
+ used.add(winner.node.raw);
174
+ bones[spec.bone] = {
175
+ name: winner.node.raw,
176
+ aliases: candidateNames.slice(1)
177
+ };
178
+ matches.push({ bone: spec.bone, node: winner.node.raw, score: winner.score, candidates: candidateNames });
179
+ }
180
+ else {
181
+ matches.push({ bone: spec.bone, score: 0, candidates: [] });
182
+ }
183
+ }
184
+ const missingRequired = REQUIRED_HUMANOID_BONES.filter((bone) => !bones[bone]);
185
+ const rig = {
186
+ id: options.id ?? "inferred-humanoid",
187
+ ...(options.name !== undefined ? { name: options.name } : {}),
188
+ bones,
189
+ ...(options.scale !== undefined ? { scale: options.scale } : {}),
190
+ ...(options.units !== undefined ? { units: options.units } : {}),
191
+ ...(options.facingAxis !== undefined ? { facingAxis: options.facingAxis } : {}),
192
+ metadata: { inferred: true, inferredFromNodeCount: nodeNames.length }
193
+ };
194
+ return { rig, matches, missingRequired };
195
+ }
196
+ /** Convenience wrapper returning just the rig definition. */
197
+ export function inferHumanoidRig(nodeNames, options = {}) {
198
+ return inferHumanoidRigDetailed(nodeNames, options).rig;
199
+ }
200
+ function mergeAliases(spec, extra) {
201
+ const base = ALIAS_BY_KEY[spec.aliasKey] ?? [];
202
+ const extraForBone = extra?.[spec.bone] ?? [];
203
+ return extraForBone.length > 0 ? [...extraForBone, ...base] : base;
204
+ }
205
+ /**
206
+ * Lower number = resolved earlier. More-specific slots resolve first so they claim their nodes
207
+ * before generic siblings (e.g. `chest` before `spine`, `lowerLeg` before `upperLeg` before the
208
+ * generic `leg` token shared by both).
209
+ */
210
+ function slotPriority(bone) {
211
+ const table = {
212
+ hips: 0,
213
+ head: 1,
214
+ upperChest: 2,
215
+ chest: 3,
216
+ neck: 4,
217
+ leftHand: 5,
218
+ rightHand: 5,
219
+ leftFoot: 6,
220
+ rightFoot: 6,
221
+ leftToes: 7,
222
+ rightToes: 7,
223
+ leftShoulder: 8,
224
+ rightShoulder: 8,
225
+ leftLowerArm: 9,
226
+ rightLowerArm: 9,
227
+ leftUpperArm: 10,
228
+ rightUpperArm: 10,
229
+ leftLowerLeg: 11,
230
+ rightLowerLeg: 11,
231
+ leftUpperLeg: 12,
232
+ rightUpperLeg: 12,
233
+ spine: 13
234
+ };
235
+ return table[bone] ?? 20;
236
+ }
237
+ /** Re-exported for callers wanting to enumerate which slots inference targets. */
238
+ export const INFERABLE_HUMANOID_BONES = HUMANOID_BONES;
239
+ //# sourceMappingURL=HumanoidBoneInference.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HumanoidBoneInference.js","sourceRoot":"","sources":["../../../../packages/animation/src/HumanoidBoneInference.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,uBAAuB,EAIxB,MAAM,0BAA0B,CAAC;AAgDlC;;;;;GAKG;AACH,MAAM,YAAY,GAAsC;IACtD,IAAI,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AAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;IAC9C,OAAO,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACrE,CAAC;AAED;;;;GAIG;AACH,SAAS,YAAY,CAAC,IAAsB;IAC1C,MAAM,KAAK,GAA8C;QACvD,IAAI,EAAE,CAAC;QACP,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,CAAC;QACb,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,CAAC;QACf,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,CAAC;QACf,aAAa,EAAE,CAAC;QAChB,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;QACjB,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,EAAE;QACjB,KAAK,EAAE,EAAE;KACV,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;AAC3B,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,wBAAwB,GAAgC,cAAc,CAAC"}
@@ -54,6 +54,14 @@ export interface HumanoidBoneRetargetBinding {
54
54
  readonly source: HumanoidBoneBinding;
55
55
  readonly target: HumanoidBoneBinding;
56
56
  readonly scale: number;
57
+ /**
58
+ * Source rig rest-pose local rotation for this bone (identity when unknown). Captured at
59
+ * map-build time from `source.restPose[bone].rotation` or the binding's own `rotation` so the
60
+ * pose retargeter can reconcile differing bind orientations without re-reading the rigs.
61
+ */
62
+ readonly sourceRest?: AnimationQuaternion;
63
+ /** Target rig rest-pose local rotation for this bone (identity when unknown). */
64
+ readonly targetRest?: AnimationQuaternion;
57
65
  }
58
66
  export interface HumanoidRetargetingMap {
59
67
  readonly sourceRigId: string;
@@ -63,14 +71,63 @@ export interface HumanoidRetargetingMap {
63
71
  readonly requiredCoverage: number;
64
72
  readonly bindings: Partial<Record<HumanoidBoneName, HumanoidBoneRetargetBinding>>;
65
73
  readonly diagnostics: readonly HumanoidRetargetingDiagnostic[];
74
+ /** Source rig facing axis (defaults to `"z"`) used for hip/root facing reconciliation. */
75
+ readonly sourceFacingAxis?: HumanoidAxis;
76
+ /** Target rig facing axis (defaults to `"z"`) used for hip/root facing reconciliation. */
77
+ readonly targetFacingAxis?: HumanoidAxis;
66
78
  }
67
79
  export interface RetargetHumanoidPoseOptions {
68
80
  readonly includeUnmappedSourceBones?: boolean;
69
81
  readonly includeSemanticBoneNames?: boolean;
70
82
  readonly scaleRootMotion?: boolean;
71
83
  }
84
+ export interface AnimationHumanoidRetargetingOptions extends HumanoidRetargetingOptions {
85
+ readonly requiredClips?: readonly string[];
86
+ readonly availableClips?: readonly string[];
87
+ readonly mouthBlendshapeNames?: readonly string[];
88
+ readonly retargetMapProvided?: boolean;
89
+ }
90
+ export interface AnimationHumanoidRetargetingDiagnostics extends HumanoidRigDiagnostics {
91
+ readonly kind: "animation-humanoid-retargeting-diagnostics";
92
+ readonly mouthReady: boolean;
93
+ readonly clipReady: boolean;
94
+ readonly retargetMapProvided: boolean;
95
+ }
72
96
  export declare function analyzeHumanoidRig(rig: HumanoidRigDefinition, options?: HumanoidRetargetingOptions): HumanoidRigDiagnostics;
73
97
  export declare function createHumanoidRetargetingMap(source: HumanoidRigDefinition, target: HumanoidRigDefinition, options?: HumanoidRetargetingOptions): HumanoidRetargetingMap;
98
+ /**
99
+ * Retarget a source-rig {@link AnimationPose} onto the target rig described by `map`.
100
+ *
101
+ * This is NOT a 1:1 rotation copy. For each bone we reconcile differing rest/bind orientations and
102
+ * a differing facing axis, and scale translations by the per-bone length ratio:
103
+ *
104
+ * 1. Rest-pose reconciliation (per bone, local space). Let `Rs0` be the source rest local
105
+ * rotation and `Rt0` the target rest local rotation (both from the rigs' `restPose`/binding
106
+ * `rotation`, identity when unknown). An animation expresses a source local rotation `Ra`.
107
+ * The motion *away from rest* in the source's local frame is the delta `D = Rs0⁻¹ · Ra`. We
108
+ * re-anchor that delta onto the target rest: `Rt = Rt0 · D = Rt0 · Rs0⁻¹ · Ra`.
109
+ * When both rests are identity (or equal) this collapses to a straight copy, and an identity
110
+ * map (source rig === target rig) is therefore a no-op.
111
+ *
112
+ * 2. Facing-axis / coordinate-frame conversion. If the source faces a different cardinal axis
113
+ * than the target, the hips (root) rotation is pre-multiplied by the frame-alignment rotation
114
+ * `F` that carries the source facing axis onto the target facing axis: `Rt_hips = F · Rt_hips`.
115
+ * This only touches the root so child bones inherit the reframe through the hierarchy.
116
+ *
117
+ * 3. Position / hip-height scaling (unchanged from before): translations are scaled by the
118
+ * bone's length ratio (`binding.scale`), and optional root motion by the average bone scale.
119
+ *
120
+ * The signature and return type are unchanged.
121
+ *
122
+ * Honesty note: step 1 is the well-known "rest-delta" reconciliation. It is exact when the source
123
+ * and target rest orientations are the bones' true local bind rotations and the bones are mapped
124
+ * one-to-one (the common case for humanoid GLBs). It does NOT model differing bone *roll* beyond
125
+ * what the rest rotations capture, nor parent-chain reparametrization when intermediate bones
126
+ * (e.g. chest/upperChest) are present on one rig and absent on the other — those remain
127
+ * approximate. Step 2 corrects whole-body facing only via the root; per-limb axis remaps that
128
+ * aren't expressible as a single root rotation are not handled.
129
+ */
74
130
  export declare function retargetHumanoidPose(sourcePose: AnimationPose, map: HumanoidRetargetingMap, options?: RetargetHumanoidPoseOptions): AnimationPose;
75
131
  export declare function humanoidRetargetingDiagnostics(source: HumanoidRigDefinition, target: HumanoidRigDefinition, options?: HumanoidRetargetingOptions): readonly HumanoidRetargetingDiagnostic[];
132
+ export declare function analyzeAnimationHumanoidRetargeting(rig: HumanoidRigDefinition, options?: AnimationHumanoidRetargetingOptions): AnimationHumanoidRetargetingDiagnostics;
76
133
  //# sourceMappingURL=HumanoidRetargeting.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"HumanoidRetargeting.d.ts","sourceRoot":"","sources":["../../../../packages/animation/src/HumanoidRetargeting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAElC,eAAO,MAAM,cAAc,mTAuBjB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,aAAa,GAAG,SAAS,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEpF,eAAO,MAAM,uBAAuB,EAAE,SAAS,gBAAgB,EAgB9D,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAC5C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IACxC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,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,CA4Cf;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,qBAAqB,EAC7B,MAAM,EAAE,qBAAqB,EAC7B,OAAO,GAAE,0BAA+B,GACvC,SAAS,6BAA6B,EAAE,CAE1C;AAED,wBAAgB,mCAAmC,CACjD,GAAG,EAAE,qBAAqB,EAC1B,OAAO,GAAE,mCAAwC,GAChD,uCAAuC,CA4CzC"}
@@ -200,7 +200,9 @@ export function createHumanoidRetargetingMap(source, target, options = {}) {
200
200
  bone,
201
201
  source: sourceBinding,
202
202
  target: targetBinding,
203
- scale: estimateBoneScale(sourceBinding, targetBinding, source.scale, target.scale)
203
+ scale: estimateBoneScale(sourceBinding, targetBinding, source.scale, target.scale),
204
+ sourceRest: restRotationFor(source, bone, sourceBinding),
205
+ targetRest: restRotationFor(target, bone, targetBinding)
204
206
  };
205
207
  }
206
208
  const coverage = mappedBones / HUMANOID_BONES.length;
@@ -221,9 +223,43 @@ export function createHumanoidRetargetingMap(source, target, options = {}) {
221
223
  coverage,
222
224
  requiredCoverage,
223
225
  bindings,
224
- diagnostics
226
+ diagnostics,
227
+ sourceFacingAxis: source.facingAxis ?? "z",
228
+ targetFacingAxis: target.facingAxis ?? "z"
225
229
  };
226
230
  }
231
+ /**
232
+ * Retarget a source-rig {@link AnimationPose} onto the target rig described by `map`.
233
+ *
234
+ * This is NOT a 1:1 rotation copy. For each bone we reconcile differing rest/bind orientations and
235
+ * a differing facing axis, and scale translations by the per-bone length ratio:
236
+ *
237
+ * 1. Rest-pose reconciliation (per bone, local space). Let `Rs0` be the source rest local
238
+ * rotation and `Rt0` the target rest local rotation (both from the rigs' `restPose`/binding
239
+ * `rotation`, identity when unknown). An animation expresses a source local rotation `Ra`.
240
+ * The motion *away from rest* in the source's local frame is the delta `D = Rs0⁻¹ · Ra`. We
241
+ * re-anchor that delta onto the target rest: `Rt = Rt0 · D = Rt0 · Rs0⁻¹ · Ra`.
242
+ * When both rests are identity (or equal) this collapses to a straight copy, and an identity
243
+ * map (source rig === target rig) is therefore a no-op.
244
+ *
245
+ * 2. Facing-axis / coordinate-frame conversion. If the source faces a different cardinal axis
246
+ * than the target, the hips (root) rotation is pre-multiplied by the frame-alignment rotation
247
+ * `F` that carries the source facing axis onto the target facing axis: `Rt_hips = F · Rt_hips`.
248
+ * This only touches the root so child bones inherit the reframe through the hierarchy.
249
+ *
250
+ * 3. Position / hip-height scaling (unchanged from before): translations are scaled by the
251
+ * bone's length ratio (`binding.scale`), and optional root motion by the average bone scale.
252
+ *
253
+ * The signature and return type are unchanged.
254
+ *
255
+ * Honesty note: step 1 is the well-known "rest-delta" reconciliation. It is exact when the source
256
+ * and target rest orientations are the bones' true local bind rotations and the bones are mapped
257
+ * one-to-one (the common case for humanoid GLBs). It does NOT model differing bone *roll* beyond
258
+ * what the rest rotations capture, nor parent-chain reparametrization when intermediate bones
259
+ * (e.g. chest/upperChest) are present on one rig and absent on the other — those remain
260
+ * approximate. Step 2 corrects whole-body facing only via the root; per-limb axis remaps that
261
+ * aren't expressible as a single root rotation are not handled.
262
+ */
227
263
  export function retargetHumanoidPose(sourcePose, map, options = {}) {
228
264
  const bones = {};
229
265
  if (options.includeUnmappedSourceBones) {
@@ -231,6 +267,7 @@ export function retargetHumanoidPose(sourcePose, map, options = {}) {
231
267
  bones[boneName] = cloneTransform(transform);
232
268
  }
233
269
  }
270
+ const facing = facingAlignmentQuat(map.sourceFacingAxis ?? "z", map.targetFacingAxis ?? "z");
234
271
  for (const bone of HUMANOID_BONES) {
235
272
  const binding = map.bindings[bone];
236
273
  if (!binding)
@@ -238,7 +275,7 @@ export function retargetHumanoidPose(sourcePose, map, options = {}) {
238
275
  const sourceTransform = sourcePose.bones[binding.source.name] ?? sourcePose.bones[bone];
239
276
  if (!sourceTransform)
240
277
  continue;
241
- const retargeted = scaleTransform(sourceTransform, binding.scale);
278
+ const retargeted = retargetBoneTransform(sourceTransform, binding, bone === "hips" ? facing : undefined);
242
279
  bones[binding.target.name] = retargeted;
243
280
  if (options.includeSemanticBoneNames) {
244
281
  bones[bone] = retargeted;
@@ -266,6 +303,49 @@ export function retargetHumanoidPose(sourcePose, map, options = {}) {
266
303
  export function humanoidRetargetingDiagnostics(source, target, options = {}) {
267
304
  return createHumanoidRetargetingMap(source, target, options).diagnostics;
268
305
  }
306
+ export function analyzeAnimationHumanoidRetargeting(rig, options = {}) {
307
+ const base = analyzeHumanoidRig(rig, { minRequiredCoverage: 0.9, requireRestPose: true, ...options });
308
+ const diagnostics = [...base.diagnostics];
309
+ const requiredClips = options.requiredClips ?? ["Idle", "Talk", "Gesture", "Walk"];
310
+ const availableClips = new Set(options.availableClips ?? []);
311
+ const missingClips = requiredClips.filter((clip) => !availableClips.has(clip));
312
+ const mouthReady = (options.mouthBlendshapeNames?.length ?? 0) > 0
313
+ || Array.isArray(rig.metadata?.mouthBlendshapeNames) && rig.metadata.mouthBlendshapeNames.length > 0;
314
+ const retargetMapProvided = options.retargetMapProvided ?? Boolean(rig.metadata?.retargetMapProvided);
315
+ if (!mouthReady) {
316
+ diagnostics.push({
317
+ severity: "error",
318
+ code: "ANIMATION_MOUTH_METADATA_MISSING",
319
+ message: "Animation retargeting requires mouth blendshape or mouth-card metadata.",
320
+ rigId: rig.id
321
+ });
322
+ }
323
+ for (const clip of missingClips) {
324
+ diagnostics.push({
325
+ severity: "error",
326
+ code: "ANIMATION_REQUIRED_CLIP_MISSING",
327
+ message: `Animation retargeting requires clip "${clip}".`,
328
+ rigId: rig.id
329
+ });
330
+ }
331
+ if (!retargetMapProvided) {
332
+ diagnostics.push({
333
+ severity: "error",
334
+ code: "ANIMATION_RETARGET_MAP_MISSING",
335
+ message: "Animation retargeting requires external bone-map/retarget metadata.",
336
+ rigId: rig.id
337
+ });
338
+ }
339
+ return {
340
+ kind: "animation-humanoid-retargeting-diagnostics",
341
+ ...base,
342
+ ok: !diagnostics.some((diagnostic) => diagnostic.severity === "error"),
343
+ diagnostics,
344
+ mouthReady,
345
+ clipReady: missingClips.length === 0,
346
+ retargetMapProvided
347
+ };
348
+ }
269
349
  const HUMANOID_SIDE_PAIRS = [
270
350
  { left: "leftShoulder", right: "rightShoulder" },
271
351
  { left: "leftUpperArm", right: "rightUpperArm" },
@@ -304,13 +384,111 @@ function averageBindingScale(map) {
304
384
  return 1;
305
385
  return scales.reduce((sum, scale) => sum + scale, 0) / scales.length;
306
386
  }
307
- function scaleTransform(transform, scale) {
387
+ const IDENTITY_QUAT = { x: 0, y: 0, z: 0, w: 1 };
388
+ /**
389
+ * Extract the rest local rotation for a bone, preferring the rig's explicit `restPose` entry and
390
+ * falling back to the binding's own `rotation`. Returns identity when neither is present.
391
+ */
392
+ function restRotationFor(rig, bone, binding) {
393
+ const fromRestPose = rig.restPose?.[bone]?.rotation;
394
+ if (fromRestPose)
395
+ return normalizeQuatObj(fromRestPose);
396
+ if (binding.rotation)
397
+ return normalizeQuatObj(binding.rotation);
398
+ return IDENTITY_QUAT;
399
+ }
400
+ /**
401
+ * Apply rest-pose reconciliation + (root-only) facing alignment + length scaling to one bone.
402
+ * See {@link retargetHumanoidPose} for the math derivation.
403
+ */
404
+ function retargetBoneTransform(transform, binding, facing) {
405
+ const sourceRest = binding.sourceRest ?? IDENTITY_QUAT;
406
+ const targetRest = binding.targetRest ?? IDENTITY_QUAT;
407
+ let rotation = transform.rotation;
408
+ if (rotation) {
409
+ // Rt = Rt0 · Rs0⁻¹ · Ra
410
+ const delta = multiplyQuat(invertQuat(sourceRest), normalizeQuatObj(rotation));
411
+ rotation = multiplyQuat(targetRest, delta);
412
+ if (facing) {
413
+ // Whole-body facing correction, applied on the root before its local rotation.
414
+ rotation = multiplyQuat(facing, rotation);
415
+ }
416
+ rotation = normalizeQuatObj(rotation);
417
+ }
418
+ else if (facing) {
419
+ // No animated rotation but a facing delta still needs to reframe the root.
420
+ rotation = normalizeQuatObj(multiplyQuat(facing, targetRest));
421
+ }
308
422
  return {
309
- position: transform.position ? scaleVector(transform.position, scale) : undefined,
310
- rotation: transform.rotation,
423
+ position: transform.position ? scaleVector(transform.position, binding.scale) : undefined,
424
+ rotation,
311
425
  scale: transform.scale
312
426
  };
313
427
  }
428
+ /**
429
+ * Rotation that carries `from` cardinal axis onto `to` cardinal axis (shortest arc). Used to
430
+ * reconcile rigs that face different world axes (e.g. +Z forward vs -Z forward, or +X vs +Z).
431
+ */
432
+ function facingAlignmentQuat(from, to) {
433
+ if (from === to)
434
+ return undefined;
435
+ const a = axisVector(from);
436
+ const b = axisVector(to);
437
+ return shortestArcQuat(a, b);
438
+ }
439
+ function axisVector(axis) {
440
+ switch (axis) {
441
+ case "x": return { x: 1, y: 0, z: 0 };
442
+ case "-x": return { x: -1, y: 0, z: 0 };
443
+ case "y": return { x: 0, y: 1, z: 0 };
444
+ case "-y": return { x: 0, y: -1, z: 0 };
445
+ case "z": return { x: 0, y: 0, z: 1 };
446
+ case "-z": return { x: 0, y: 0, z: -1 };
447
+ default: return { x: 0, y: 0, z: 1 };
448
+ }
449
+ }
450
+ /** Quaternion of the shortest rotation from unit vector `a` to unit vector `b`. */
451
+ function shortestArcQuat(a, b) {
452
+ const dot = a.x * b.x + a.y * b.y + a.z * b.z;
453
+ if (dot >= 1 - 1e-8)
454
+ return IDENTITY_QUAT;
455
+ if (dot <= -1 + 1e-8) {
456
+ // Opposite vectors: rotate 180° about any axis orthogonal to a.
457
+ let ortho = Math.abs(a.x) < 0.9 ? { x: 1, y: 0, z: 0 } : { x: 0, y: 1, z: 0 };
458
+ ortho = crossVec(a, ortho);
459
+ const len = Math.hypot(ortho.x, ortho.y, ortho.z) || 1;
460
+ return normalizeQuatObj({ x: ortho.x / len, y: ortho.y / len, z: ortho.z / len, w: 0 });
461
+ }
462
+ const c = crossVec(a, b);
463
+ const w = 1 + dot;
464
+ return normalizeQuatObj({ x: c.x, y: c.y, z: c.z, w });
465
+ }
466
+ function crossVec(a, b) {
467
+ return {
468
+ x: a.y * b.z - a.z * b.y,
469
+ y: a.z * b.x - a.x * b.z,
470
+ z: a.x * b.y - a.y * b.x
471
+ };
472
+ }
473
+ function multiplyQuat(a, b) {
474
+ return {
475
+ x: a.w * b.x + a.x * b.w + a.y * b.z - a.z * b.y,
476
+ y: a.w * b.y - a.x * b.z + a.y * b.w + a.z * b.x,
477
+ z: a.w * b.z + a.x * b.y - a.y * b.x + a.z * b.w,
478
+ w: a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z
479
+ };
480
+ }
481
+ function invertQuat(q) {
482
+ // Unit quaternion inverse is its conjugate; normalize defensively first.
483
+ const n = normalizeQuatObj(q);
484
+ return { x: -n.x, y: -n.y, z: -n.z, w: n.w };
485
+ }
486
+ function normalizeQuatObj(q) {
487
+ const len = Math.hypot(q.x, q.y, q.z, q.w);
488
+ if (len <= 1e-9)
489
+ return IDENTITY_QUAT;
490
+ return { x: q.x / len, y: q.y / len, z: q.z / len, w: q.w / len };
491
+ }
314
492
  function cloneTransform(transform) {
315
493
  return {
316
494
  position: transform.position ? { ...transform.position } : undefined,