Import a 3D Model and automatically assign and export animations
TypeScript
refactor interfaces out. a few cleanup tasks for animation previews
Scott Petrovicd4d57171a06f
diff --git a/src/api/ApiRoutes.ts b/src/api/ApiRoutes.tsindex edd84a2..febc01b 100644--- a/src/api/ApiRoutes.ts+++ b/src/api/ApiRoutes.ts@@ -1,18 +1,7 @@-import { RigConfig, type ModelVariation, type RigConfigEntry } from '../lib/RigConfig'--/**- * Read-only public API served by the Cloudflare worker under /api.- * Data comes straight from RigConfig so the API always matches what the app uses.- *- * GET /api/rigs list of rigs- * GET /api/rigs/:rig_id a single rig- * GET /api/rigs/:rig_id/variations 3D model variations for a rig- */--export interface ApiResult {- body: unknown- status: number-}+import { RigConfig } from '../lib/RigConfig'+import { type ModelVariation } from '../lib/interfaces/ModelVariation'+import { type RigConfigEntry } from '../lib/interfaces/RigConfigEntry'+import { type ApiResult } from './interfaces/ApiResult'export const API_PREFIX = '/api/'diff --git a/src/api/interfaces/ApiResult.ts b/src/api/interfaces/ApiResult.tsnew file mode 100644index 0000000..481b7b8--- /dev/null+++ b/src/api/interfaces/ApiResult.ts@@ -0,0 +1,13 @@+/**+ * Read-only public API served by the Cloudflare worker under /api.+ * Data comes straight from RigConfig so the API always matches what the app uses.+ *+ * GET /api/rigs list of rigs+ * GET /api/rigs/:rig_id a single rig+ * GET /api/rigs/:rig_id/variations 3D model variations for a rig+ */++export interface ApiResult {+ body: unknown+ status: number+}diff --git a/src/composer/ComposerClipBuilder.ts b/src/composer/ComposerClipBuilder.tsindex 2b629b3..d02d192 100644--- a/src/composer/ComposerClipBuilder.ts+++ b/src/composer/ComposerClipBuilder.ts@@ -2,32 +2,9 @@ import {AnimationClip, type Bone, type Interpolant, type KeyframeTrack, type Object3D, PropertyBinding,Quaternion, QuaternionKeyframeTrack, type Skeleton} from 'three'--export interface ComposeClipOptions {- upper_clip: AnimationClip- lower_clip: AnimationClip- // bones driven by the upper clip. every other bone is driven by the lower clip- upper_body_bone_names: Set<string>- // frames per second the combined clip is baked at- fps: number- name: string- // when set, the upper body keeps the orientation it had in the upper clip instead of following the lower clip's hips- upright_upper_body?: UprightUpperBodyRig-}--export interface BoneRestRotation {- name: string- rest_quaternion: Quaternion-}--/**- * Bones needed to keep the upper body upright. Bones without a rotation track in a clip use their rest rotation.- */-export interface UprightUpperBodyRig {- upper_body_root: BoneRestRotation // e.g. spine_01- // bones between the skeleton root and the upper body root, top first (e.g. pelvis)- parent_chain: BoneRestRotation[]-}+import { type ComposeClipOptions } from './interfaces/ComposeClipOptions'+import { type BoneRestRotation } from './interfaces/BoneRestRotation'+import { type UprightUpperBodyRig } from './interfaces/UprightUpperBodyRig'type KeyframeTrackConstructor = new (name: string, times: ArrayLike<number>, values: ArrayLike<number>) => KeyframeTracktype InterpolatableTrack = KeyframeTrack & { createInterpolant: () => Interpolant }diff --git a/src/composer/ComposerExport.ts b/src/composer/ComposerExport.tsindex df0e0e0..f6f076a 100644--- a/src/composer/ComposerExport.ts+++ b/src/composer/ComposerExport.ts@@ -3,11 +3,7 @@ import { type DownloadSettings } from '../lib/processes/export-to-file/DownloadSimport { type StepExportToFile } from '../lib/processes/export-to-file/StepExportToFile.ts'import { DownloadSuccessDialog } from '../lib/components/download-success/DownloadSuccessDialog.ts'import { ModalDialog } from '../lib/ModalDialog.ts'--export interface ComposerExportData {- clip: AnimationClip- skinned_meshes: SkinnedMesh[]-}+import { type ComposerExportData } from './interfaces/ComposerExportData'/*** The download button on the Composer page. The file is named after the animations in the slots.diff --git a/src/composer/ComposerSlots.ts b/src/composer/ComposerSlots.tsindex f692eb9..68ea732 100644--- a/src/composer/ComposerSlots.ts+++ b/src/composer/ComposerSlots.ts@@ -1,16 +1,7 @@import { ComposerLibraryList } from './ComposerLibraryList.ts'--export type ComposerSlotName = 'upper' | 'lower'--export interface SlotAnimationDroppedDetail {- slot: ComposerSlotName- animation_id: string-}--export interface SlotDisplay {- animation_name: string- is_loading: boolean-}+import { type ComposerSlotName } from './interfaces/ComposerSlotName'+import { type SlotAnimationDroppedDetail } from './interfaces/SlotAnimationDroppedDetail'+import { type SlotDisplay } from './interfaces/SlotDisplay'/*** The upper body and lower body slots on the Composer page. Library tiles are dropped onto them.diff --git a/src/composer/composer.ts b/src/composer/composer.tsindex c95446e..b6baa9b 100644--- a/src/composer/composer.ts+++ b/src/composer/composer.ts@@ -14,7 +14,9 @@ import { ComposerConfig } from './ComposerConfig.ts'import { ComposerModelLoader } from './ComposerModelLoader.ts'import { ComposerPreview } from './ComposerPreview.ts'import { ComposerLibraryList } from './ComposerLibraryList.ts'-import { ComposerSlots, type ComposerSlotName, type SlotAnimationDroppedDetail } from './ComposerSlots.ts'+import { ComposerSlots } from './ComposerSlots.ts'+import { type ComposerSlotName } from './interfaces/ComposerSlotName'+import { type SlotAnimationDroppedDetail } from './interfaces/SlotAnimationDroppedDetail'import { ComposerExport } from './ComposerExport.ts'/**diff --git a/src/composer/interfaces/BoneRestRotation.ts b/src/composer/interfaces/BoneRestRotation.tsnew file mode 100644index 0000000..5131603--- /dev/null+++ b/src/composer/interfaces/BoneRestRotation.ts@@ -0,0 +1,6 @@+import { type Quaternion } from 'three'++export interface BoneRestRotation {+ name: string+ rest_quaternion: Quaternion+}diff --git a/src/composer/interfaces/ComposeClipOptions.ts b/src/composer/interfaces/ComposeClipOptions.tsnew file mode 100644index 0000000..19b4bc0--- /dev/null+++ b/src/composer/interfaces/ComposeClipOptions.ts@@ -0,0 +1,14 @@+import { type AnimationClip } from 'three'+import { type UprightUpperBodyRig } from './UprightUpperBodyRig'++export interface ComposeClipOptions {+ upper_clip: AnimationClip+ lower_clip: AnimationClip+ // bones driven by the upper clip. every other bone is driven by the lower clip+ upper_body_bone_names: Set<string>+ // frames per second the combined clip is baked at+ fps: number+ name: string+ // when set, the upper body keeps the orientation it had in the upper clip instead of following the lower clip's hips+ upright_upper_body?: UprightUpperBodyRig+}diff --git a/src/composer/interfaces/ComposerExportData.ts b/src/composer/interfaces/ComposerExportData.tsnew file mode 100644index 0000000..4110146--- /dev/null+++ b/src/composer/interfaces/ComposerExportData.ts@@ -0,0 +1,6 @@+import { type AnimationClip, type SkinnedMesh } from 'three'++export interface ComposerExportData {+ clip: AnimationClip+ skinned_meshes: SkinnedMesh[]+}diff --git a/src/composer/interfaces/ComposerSlotName.ts b/src/composer/interfaces/ComposerSlotName.tsnew file mode 100644index 0000000..ad9a79f--- /dev/null+++ b/src/composer/interfaces/ComposerSlotName.ts@@ -0,0 +1 @@+export type ComposerSlotName = 'upper' | 'lower'diff --git a/src/composer/interfaces/SlotAnimationDroppedDetail.ts b/src/composer/interfaces/SlotAnimationDroppedDetail.tsnew file mode 100644index 0000000..10b053d--- /dev/null+++ b/src/composer/interfaces/SlotAnimationDroppedDetail.ts@@ -0,0 +1,6 @@+import { type ComposerSlotName } from './ComposerSlotName'++export interface SlotAnimationDroppedDetail {+ slot: ComposerSlotName+ animation_id: string+}diff --git a/src/composer/interfaces/SlotDisplay.ts b/src/composer/interfaces/SlotDisplay.tsnew file mode 100644index 0000000..373fa01--- /dev/null+++ b/src/composer/interfaces/SlotDisplay.ts@@ -0,0 +1,4 @@+export interface SlotDisplay {+ animation_name: string+ is_loading: boolean+}diff --git a/src/composer/interfaces/UprightUpperBodyRig.ts b/src/composer/interfaces/UprightUpperBodyRig.tsnew file mode 100644index 0000000..3073763--- /dev/null+++ b/src/composer/interfaces/UprightUpperBodyRig.ts@@ -0,0 +1,10 @@+import { type BoneRestRotation } from './BoneRestRotation'++/**+ * Bones needed to keep the upper body upright. Bones without a rotation track in a clip use their rest rotation.+ */+export interface UprightUpperBodyRig {+ upper_body_root: BoneRestRotation // e.g. spine_01+ // bones between the skeleton root and the upper body root, top first (e.g. pelvis)+ parent_chain: BoneRestRotation[]+}diff --git a/src/lib/AssetManifest.ts b/src/lib/AssetManifest.tsindex e676559..1bc6416 100644--- a/src/lib/AssetManifest.ts+++ b/src/lib/AssetManifest.ts@@ -1,5 +1,7 @@import manifest_json from '../../static/assets/manifest.json'import props_manifest_json from '../../static/assets/props_manifest.json'+import { type AssetManifest } from './interfaces/AssetManifest'+import { type PropsManifest } from './interfaces/PropsManifest'/*** Typed access to the manifests generated by the external assets repository.@@ -12,59 +14,6 @@ import props_manifest_json from '../../static/assets/props_manifest.json'export const ASSETS_FOLDER = 'assets/'-export interface ManifestFile {- file: string // relative to the assets folder, e.g. 'human/model.glb'- hash: string-}--export interface ManifestVariation extends ManifestFile {- name: string // unique per rig, e.g. 'psx-05'- source: string-}--export interface ManifestAnimation extends ManifestFile {- name: string // clip name inside the GLB, e.g. 'Walk'- tags: string[]- loop: boolean- root_motion: boolean- frame_count: number- duration: number // seconds- source: string-}--export interface ManifestRig {- fps: number- model: ManifestFile- skeleton: ManifestFile- variations: ManifestVariation[]- animations: ManifestAnimation[]-}--export interface AssetManifest {- version: number- generated: string- rigs: Record<string, ManifestRig>-}--export interface ManifestProp extends ManifestFile {- name: string- display_name: string- preview: ManifestFile- category: string- tags: string[]- dimensions: { width: number, depth: number, height: number }- vertices: number- triangles: number- materials: string[]-}--export interface PropsManifest {- version: number- generated: string- categories: string[]- props: ManifestProp[]-}-export const asset_manifest: AssetManifest = manifest_jsonexport const props_manifest: PropsManifest = props_manifest_jsondiff --git a/src/lib/RigConfig.ts b/src/lib/RigConfig.tsindex 42954df..4e96f3e 100644--- a/src/lib/RigConfig.ts+++ b/src/lib/RigConfig.ts@@ -1,76 +1,12 @@import { SkeletonType } from './enums/SkeletonType'-import { asset_manifest, asset_path, type ManifestRig, type ManifestVariation } from './AssetManifest'--/**- * App-specific settings for a model variation. The model file itself comes from the asset manifest.- * Variations in the manifest without settings are still shown, using their manifest name and a CC0 license.- */-interface VariationSettings {- display_name: string // Display name shown in the model dropdown, e.g. 'Police Female'- attribution?: string // only needed for CC-SA and CC-BY- license?: string // defaults to CC0- expand_arms?: number // Explore page arm expansion value, defaults to 0- // Multiplier applied to the position keyframes of the rig's position tracking bone (e.g. pelvis/hips).- // Taller variations need a value above 1.0 so their feet stay on the ground instead of sinking below it.- pelvis_position_scale?: number-}--/**- * App-specific settings for a rig. Everything about which files exist (model, skeleton,- * variations, animations) comes from the asset manifest, looked up with manifest_key.- */-interface RigSettings {- skeleton_type: SkeletonType // The SkeletonType enum member for this rig- manifest_key: string // key of this rig in the asset manifest, e.g. 'human'- rig_display_name: string // Display name shown in both the model and skeleton dropdowns- animation_preview_folder: string // Sub-folder name used when referencing animation preview thumbnails- skeleton_template_image_url: string // URL for the skeleton template image shown in the edit skeleton step- // The bone used for position tracking (e.g., 'hips' or 'head').- // we only have one bone per rig that we allow position keyframes (besides root)- position_tracking_bone_name: string- // Camera used by the preview generator for this rig's animation preview videos. Set by hand from the- // camera position readout on the preview generator page. Without it, the camera is fit to the animations- preview_camera?: PreviewCamera- // keyed by the variation name in the asset manifest. Variations listed here are shown first, in this order- variations?: Record<string, VariationSettings>- // manifest variations to leave out of the app. The manifest is generated by the external assets repo,- // so it can't be edited here- excluded_variations?: string[]-}--export interface PreviewCamera {- position: [number, number, number] // where the camera sits- target: [number, number, number] // the point the camera looks at-}--export interface ModelVariation {- name: string // variation name in the asset manifest, e.g. 'psx-05'- model_file: string // Model file path relative to the static root, e.g. 'assets/human/variations/psx-05.glb'- display_name: string // Display name shown in the model dropdown, e.g. 'Human (A-Pose)'- attribution: string // Free-form attribution text to be shown in the UI when this model variation is selected, e.g. 'Model by Artist Name'- preview_image: string // Preview image path relative to the static root, e.g. 'variation-previews/human/psx-05.png'- license: string // License string for this model variation, e.g. 'CC0', 'CC-SA 4.0'- expandArms: number // Explore page arm expansion value, default 0 for human rigs- pelvis_position_scale: number-}--export interface RigAnimation {- name: string // clip name inside the GLB, e.g. 'Walk'- file: string // GLB file path relative to the static root, e.g. 'assets/human/animations/walk.glb'- tags: string[]- loop: boolean- root_motion: boolean- frame_count: number- duration: number // seconds-}--export interface RigConfigEntry extends Omit<RigSettings, 'variations'> {- model_file: string // Model file path relative to the static root, e.g. 'assets/human/model.glb'- rig_file: string // Rig/skeleton GLB file path relative to the static root, e.g. 'assets/human/skeleton.glb'- fps: number- animations: RigAnimation[]- model_variations: ModelVariation[] // similar models (human, zombie, etc)-}+import { asset_manifest, asset_path } from './AssetManifest'+import { type ManifestRig } from './interfaces/ManifestRig'+import { type ManifestVariation } from './interfaces/ManifestVariation'+import { type VariationSettings } from './interfaces/VariationSettings'+import { type RigSettings } from './interfaces/RigSettings'+import { type ModelVariation } from './interfaces/ModelVariation'+import { type RigAnimation } from './interfaces/RigAnimation'+import { type RigConfigEntry } from './interfaces/RigConfigEntry'const rig_settings: RigSettings[] = [{@@ -84,6 +20,7 @@ const rig_settings: RigSettings[] = [variations: {base: { display_name: 'Male', attribution: 'Quaternius' },zombie: { display_name: 'Zombie', attribution: 'Kenney.nl' },+ 'mannequin-female': { display_name: 'Female Mannequin', attribution: 'Quaternius' },'psx-female-08': { display_name: 'Female 8', attribution: 'elbolilloduro' },'psx-female-09': { display_name: 'Female 9', attribution: 'elbolilloduro', pelvis_position_scale: 1.02 },'psx-31-female': { display_name: 'Female 31', attribution: 'elbolilloduro', pelvis_position_scale: 0.92 },diff --git a/src/lib/VariationLicenseInfo.ts b/src/lib/VariationLicenseInfo.tsindex 40ea85b..6e42ae7 100644--- a/src/lib/VariationLicenseInfo.ts+++ b/src/lib/VariationLicenseInfo.ts@@ -1,6 +1,5 @@-export interface VariationLicenseInfo {- description: string-}+import { type VariationLicenseInfo } from './interfaces/VariationLicenseInfo'+// eslint-disable-next-line @typescript-eslint/no-extraneous-classexport class VariationLicenseCatalog {diff --git a/src/lib/components/CustomTransformControls.ts b/src/lib/components/CustomTransformControls.tsindex 92ca551..be5d5b3 100644--- a/src/lib/components/CustomTransformControls.ts+++ b/src/lib/components/CustomTransformControls.ts@@ -35,31 +35,7 @@ import {TorusGeometry,Vector3,} from 'three'--// ─── Options interface ────────────────────────────────────────────────────────--export interface CustomTransformControlsOptions {- /** Length of each axis arm. Default: 0.25 (stock three.js: 0.5) */- armLength?: number- /** Base radius of the arrow cone tip. Default: 0.035 (stock: 0.04) */- arrowBaseRadius?: number- /** Height of the arrow cone tip. Default: 0.065 (stock: 0.1) */- arrowHeight?: number- /** Radius of invisible picker cylinders along each axis arm. Default: 0.1 (stock: 0.2) */- pickerCylinderRadius?: number- /** Height of invisible picker cylinders along each axis arm. Default: 0.35 (stock: 0.6) */- pickerCylinderHeight?: number- /** Tube radius of invisible torus pickers for rotation rings. Default: 0.05 (stock: 0.1) */- pickerTorusTube?: number- /** Radius of invisible sphere picker for free-rotate. Default: 0.15 (stock: 0.25) */- pickerSphereRadius?: number- /** Side length of invisible box pickers for plane handles. Default: 0.13 (stock: 0.2) */- pickerBox?: number- /** Radius of the arm shaft cylinder. Default: 0.012 (stock three.js: 0.0075) */- armCylinderRadius?: number- /** Size and offset of the visible plane handle squares (XY/YZ/XZ). Default: 0.1 (stock three.js: 0.15) */- planeSize?: number-}+import { type CustomTransformControlsOptions } from './interfaces/CustomTransformControlsOptions'// ─── Shared module-level helpers ──────────────────────────────────────────────diff --git a/src/lib/components/interfaces/CustomTransformControlsOptions.ts b/src/lib/components/interfaces/CustomTransformControlsOptions.tsnew file mode 100644index 0000000..51b8ac4--- /dev/null+++ b/src/lib/components/interfaces/CustomTransformControlsOptions.ts@@ -0,0 +1,24 @@+// ─── Options interface ────────────────────────────────────────────────────────++export interface CustomTransformControlsOptions {+ /** Length of each axis arm. Default: 0.25 (stock three.js: 0.5) */+ armLength?: number+ /** Base radius of the arrow cone tip. Default: 0.035 (stock: 0.04) */+ arrowBaseRadius?: number+ /** Height of the arrow cone tip. Default: 0.065 (stock: 0.1) */+ arrowHeight?: number+ /** Radius of invisible picker cylinders along each axis arm. Default: 0.1 (stock: 0.2) */+ pickerCylinderRadius?: number+ /** Height of invisible picker cylinders along each axis arm. Default: 0.35 (stock: 0.6) */+ pickerCylinderHeight?: number+ /** Tube radius of invisible torus pickers for rotation rings. Default: 0.05 (stock: 0.1) */+ pickerTorusTube?: number+ /** Radius of invisible sphere picker for free-rotate. Default: 0.15 (stock: 0.25) */+ pickerSphereRadius?: number+ /** Side length of invisible box pickers for plane handles. Default: 0.13 (stock: 0.2) */+ pickerBox?: number+ /** Radius of the arm shaft cylinder. Default: 0.012 (stock three.js: 0.0075) */+ armCylinderRadius?: number+ /** Size and offset of the visible plane handle squares (XY/YZ/XZ). Default: 0.1 (stock three.js: 0.15) */+ planeSize?: number+}diff --git a/src/lib/interfaces/AssetManifest.ts b/src/lib/interfaces/AssetManifest.tsnew file mode 100644index 0000000..1aeb830--- /dev/null+++ b/src/lib/interfaces/AssetManifest.ts@@ -0,0 +1,7 @@+import { type ManifestRig } from './ManifestRig'++export interface AssetManifest {+ version: number+ generated: string+ rigs: Record<string, ManifestRig>+}diff --git a/src/lib/interfaces/ManifestAnimation.ts b/src/lib/interfaces/ManifestAnimation.tsnew file mode 100644index 0000000..5f6a9f1--- /dev/null+++ b/src/lib/interfaces/ManifestAnimation.ts@@ -0,0 +1,11 @@+import { type ManifestFile } from './ManifestFile'++export interface ManifestAnimation extends ManifestFile {+ name: string // clip name inside the GLB, e.g. 'Walk'+ tags: string[]+ loop: boolean+ root_motion: boolean+ frame_count: number+ duration: number // seconds+ source: string+}diff --git a/src/lib/interfaces/ManifestFile.ts b/src/lib/interfaces/ManifestFile.tsnew file mode 100644index 0000000..9e96089--- /dev/null+++ b/src/lib/interfaces/ManifestFile.ts@@ -0,0 +1,4 @@+export interface ManifestFile {+ file: string // relative to the assets folder, e.g. 'human/model.glb'+ hash: string+}diff --git a/src/lib/interfaces/ManifestProp.ts b/src/lib/interfaces/ManifestProp.tsnew file mode 100644index 0000000..ddb7e6f--- /dev/null+++ b/src/lib/interfaces/ManifestProp.ts@@ -0,0 +1,13 @@+import { type ManifestFile } from './ManifestFile'++export interface ManifestProp extends ManifestFile {+ name: string+ display_name: string+ preview: ManifestFile+ category: string+ tags: string[]+ dimensions: { width: number, depth: number, height: number }+ vertices: number+ triangles: number+ materials: string[]+}diff --git a/src/lib/interfaces/ManifestRig.ts b/src/lib/interfaces/ManifestRig.tsnew file mode 100644index 0000000..0a10895--- /dev/null+++ b/src/lib/interfaces/ManifestRig.ts@@ -0,0 +1,11 @@+import { type ManifestFile } from './ManifestFile'+import { type ManifestVariation } from './ManifestVariation'+import { type ManifestAnimation } from './ManifestAnimation'++export interface ManifestRig {+ fps: number+ model: ManifestFile+ skeleton: ManifestFile+ variations: ManifestVariation[]+ animations: ManifestAnimation[]+}diff --git a/src/lib/interfaces/ManifestVariation.ts b/src/lib/interfaces/ManifestVariation.tsnew file mode 100644index 0000000..642cce9--- /dev/null+++ b/src/lib/interfaces/ManifestVariation.ts@@ -0,0 +1,6 @@+import { type ManifestFile } from './ManifestFile'++export interface ManifestVariation extends ManifestFile {+ name: string // unique per rig, e.g. 'psx-05'+ source: string+}diff --git a/src/lib/interfaces/ModelVariation.ts b/src/lib/interfaces/ModelVariation.tsnew file mode 100644index 0000000..e53f2bf--- /dev/null+++ b/src/lib/interfaces/ModelVariation.ts@@ -0,0 +1,10 @@+export interface ModelVariation {+ name: string // variation name in the asset manifest, e.g. 'psx-05'+ model_file: string // Model file path relative to the static root, e.g. 'assets/human/variations/psx-05.glb'+ display_name: string // Display name shown in the model dropdown, e.g. 'Human (A-Pose)'+ attribution: string // Free-form attribution text to be shown in the UI when this model variation is selected, e.g. 'Model by Artist Name'+ preview_image: string // Preview image path relative to the static root, e.g. 'variation-previews/human/psx-05.png'+ license: string // License string for this model variation, e.g. 'CC0', 'CC-SA 4.0'+ expandArms: number // Explore page arm expansion value, default 0 for human rigs+ pelvis_position_scale: number+}diff --git a/src/lib/interfaces/PreviewCamera.ts b/src/lib/interfaces/PreviewCamera.tsnew file mode 100644index 0000000..542d220--- /dev/null+++ b/src/lib/interfaces/PreviewCamera.ts@@ -0,0 +1,4 @@+export interface PreviewCamera {+ position: [number, number, number] // where the camera sits+ target: [number, number, number] // the point the camera looks at+}diff --git a/src/lib/interfaces/PropsManifest.ts b/src/lib/interfaces/PropsManifest.tsnew file mode 100644index 0000000..cb7d033--- /dev/null+++ b/src/lib/interfaces/PropsManifest.ts@@ -0,0 +1,8 @@+import { type ManifestProp } from './ManifestProp'++export interface PropsManifest {+ version: number+ generated: string+ categories: string[]+ props: ManifestProp[]+}diff --git a/src/lib/interfaces/RigAnimation.ts b/src/lib/interfaces/RigAnimation.tsnew file mode 100644index 0000000..b34de8b--- /dev/null+++ b/src/lib/interfaces/RigAnimation.ts@@ -0,0 +1,9 @@+export interface RigAnimation {+ name: string // clip name inside the GLB, e.g. 'Walk'+ file: string // GLB file path relative to the static root, e.g. 'assets/human/animations/walk.glb'+ tags: string[]+ loop: boolean+ root_motion: boolean+ frame_count: number+ duration: number // seconds+}diff --git a/src/lib/interfaces/RigConfigEntry.ts b/src/lib/interfaces/RigConfigEntry.tsnew file mode 100644index 0000000..c988dc0--- /dev/null+++ b/src/lib/interfaces/RigConfigEntry.ts@@ -0,0 +1,11 @@+import { type RigSettings } from './RigSettings'+import { type RigAnimation } from './RigAnimation'+import { type ModelVariation } from './ModelVariation'++export interface RigConfigEntry extends Omit<RigSettings, 'variations'> {+ model_file: string // Model file path relative to the static root, e.g. 'assets/human/model.glb'+ rig_file: string // Rig/skeleton GLB file path relative to the static root, e.g. 'assets/human/skeleton.glb'+ fps: number+ animations: RigAnimation[]+ model_variations: ModelVariation[] // similar models (human, zombie, etc)+}diff --git a/src/lib/interfaces/RigSettings.ts b/src/lib/interfaces/RigSettings.tsnew file mode 100644index 0000000..f15fb4b--- /dev/null+++ b/src/lib/interfaces/RigSettings.ts@@ -0,0 +1,26 @@+import { type SkeletonType } from '../enums/SkeletonType'+import { type PreviewCamera } from './PreviewCamera'+import { type VariationSettings } from './VariationSettings'++/**+ * App-specific settings for a rig. Everything about which files exist (model, skeleton,+ * variations, animations) comes from the asset manifest, looked up with manifest_key.+ */+export interface RigSettings {+ skeleton_type: SkeletonType // The SkeletonType enum member for this rig+ manifest_key: string // key of this rig in the asset manifest, e.g. 'human'+ rig_display_name: string // Display name shown in both the model and skeleton dropdowns+ animation_preview_folder: string // Sub-folder name used when referencing animation preview thumbnails+ skeleton_template_image_url: string // URL for the skeleton template image shown in the edit skeleton step+ // The bone used for position tracking (e.g., 'hips' or 'head').+ // we only have one bone per rig that we allow position keyframes (besides root)+ position_tracking_bone_name: string+ // Camera used by the preview generator for this rig's animation preview videos. Set by hand from the+ // camera position readout on the preview generator page. Without it, the camera is fit to the animations+ preview_camera?: PreviewCamera+ // keyed by the variation name in the asset manifest. Variations listed here are shown first, in this order+ variations?: Record<string, VariationSettings>+ // manifest variations to leave out of the app. The manifest is generated by the external assets repo,+ // so it can't be edited here+ excluded_variations?: string[]+}diff --git a/src/lib/interfaces/VariationLicenseInfo.ts b/src/lib/interfaces/VariationLicenseInfo.tsnew file mode 100644index 0000000..5a1681f--- /dev/null+++ b/src/lib/interfaces/VariationLicenseInfo.ts@@ -0,0 +1,3 @@+export interface VariationLicenseInfo {+ description: string+}diff --git a/src/lib/interfaces/VariationSettings.ts b/src/lib/interfaces/VariationSettings.tsnew file mode 100644index 0000000..291d17b--- /dev/null+++ b/src/lib/interfaces/VariationSettings.ts@@ -0,0 +1,13 @@+/**+ * App-specific settings for a model variation. The model file itself comes from the asset manifest.+ * Variations in the manifest without settings are still shown, using their manifest name and a CC0 license.+ */+export interface VariationSettings {+ display_name: string // Display name shown in the model dropdown, e.g. 'Police Female'+ attribution?: string // only needed for CC-SA and CC-BY+ license?: string // defaults to CC0+ expand_arms?: number // Explore page arm expansion value, defaults to 0+ // Multiplier applied to the position keyframes of the rig's position tracking bone (e.g. pelvis/hips).+ // Taller variations need a value above 1.0 so their feet stay on the ground instead of sinking below it.+ pelvis_position_scale?: number+}diff --git a/src/lib/processes/animations-listing/AnimationLibrary.ts b/src/lib/processes/animations-listing/AnimationLibrary.tsindex 3228fed..b3dd750 100644--- a/src/lib/processes/animations-listing/AnimationLibrary.ts+++ b/src/lib/processes/animations-listing/AnimationLibrary.ts@@ -4,11 +4,7 @@ import { type AnimationLoader } from './AnimationLoader.ts'import { AnimationUtility } from './AnimationUtility.ts'import { type AnimationEntry } from './interfaces/AnimationEntry.ts'import { type TransformedAnimationClipPair } from './interfaces/TransformedAnimationClipPair.ts'--export interface AnimationLibraryLoadProgress {- loaded: number- total: number-}+import { type AnimationLibraryLoadProgress } from './interfaces/AnimationLibraryLoadProgress'/*** Every animation available for the current rig. Library animations are listed from thediff --git a/src/lib/processes/animations-listing/AnimationLibraryProgressBar.ts b/src/lib/processes/animations-listing/AnimationLibraryProgressBar.tsindex db50a1d..f1157c0 100644--- a/src/lib/processes/animations-listing/AnimationLibraryProgressBar.ts+++ b/src/lib/processes/animations-listing/AnimationLibraryProgressBar.ts@@ -1,5 +1,5 @@import { UI } from '../../UI.ts'-import { type AnimationLibraryLoadProgress } from './AnimationLibrary.ts'+import { type AnimationLibraryLoadProgress } from './interfaces/AnimationLibraryLoadProgress'export class AnimationLibraryProgressBar {/**diff --git a/src/lib/processes/animations-listing/AnimationLoader.ts b/src/lib/processes/animations-listing/AnimationLoader.tsindex 5942f3d..ed0eb75 100644--- a/src/lib/processes/animations-listing/AnimationLoader.ts+++ b/src/lib/processes/animations-listing/AnimationLoader.ts@@ -7,24 +7,8 @@ import { type SkeletonType } from '../../enums/SkeletonType.ts'import { RigConfig } from '../../RigConfig.ts'import { type AnimationClipMetadata, type TransformedAnimationClipPair } from './interfaces/TransformedAnimationClipPair.ts'import { LoadError, NoAnimationsError } from './AnimationImportErrors.ts'--export interface AnimationLoadProgress {- loaded: number- total: number- percentage: number- currentFile: string- currentFileProgress: number- currentFileLoaded: number- currentFileTotal: number- overallBytesLoaded: number- overallBytesTotal: number-}--export interface LoadedAnimationSource {- animations: AnimationClip[]- // scene the animations came with. Holds the rig they were authored on- scene: Object3D-}+import { type AnimationLoadProgress } from './interfaces/AnimationLoadProgress'+import { type LoadedAnimationSource } from './interfaces/LoadedAnimationSource'export class AnimationLoader extends EventTarget {// animation GLBs from the asset library are meshopt compresseddiff --git a/src/lib/processes/animations-listing/CustomAnimationImporter.ts b/src/lib/processes/animations-listing/CustomAnimationImporter.tsindex bddcd02..b1484b7 100644--- a/src/lib/processes/animations-listing/CustomAnimationImporter.ts+++ b/src/lib/processes/animations-listing/CustomAnimationImporter.ts@@ -1,17 +1,13 @@import { ModalDialog } from '../../ModalDialog.ts'import { type AnimationClip, type SkinnedMesh } from 'three'-import { type AnimationLoader, type LoadedAnimationSource } from './AnimationLoader.ts'+import { type AnimationLoader } from './AnimationLoader.ts'+import { type LoadedAnimationSource } from './interfaces/LoadedAnimationSource'import CustomAnimationValidation from './CustomAnimationValidation.ts'import { IncompatibleSkeletonError } from './AnimationImportErrors.ts'import { ImportedAnimationRetargeter } from './ImportedAnimationRetargeter.ts'import { type AnimationClipMetadata, type TransformedAnimationClipPair } from './interfaces/TransformedAnimationClipPair.ts'import { SkeletonType } from '../../enums/SkeletonType.ts'--export interface AnimationImportContext {- skinned_meshes_to_animate: SkinnedMesh[]- skeleton_scale: number- skeleton_type: SkeletonType-}+import { type AnimationImportContext } from './interfaces/AnimationImportContext'/*** Imports custom animations from GLB and FBX files.diff --git a/src/lib/processes/animations-listing/ImportedAnimationRetargeter.ts b/src/lib/processes/animations-listing/ImportedAnimationRetargeter.tsindex ed8f326..f5dd099 100644--- a/src/lib/processes/animations-listing/ImportedAnimationRetargeter.ts+++ b/src/lib/processes/animations-listing/ImportedAnimationRetargeter.ts@@ -4,7 +4,8 @@ import { type TargetBoneMappingType } from '../../../retarget/bone-automap/Targeimport { HumanChainConfig } from '../../../retarget/human-retargeting/HumanChainConfig.ts'import { HumanClipRetargeter } from '../../../retarget/human-retargeting/HumanClipRetargeter.ts'import { Rig } from '../../../retarget/human-retargeting/Rig.ts'-import { RetargetUtils, type BoneRestTransform } from '../../../retarget/RetargetUtils.ts'+import { RetargetUtils } from '../../../retarget/RetargetUtils.ts'+import { type BoneRestTransform } from '../../../retarget/interfaces/BoneRestTransform'import { IncompatibleSkeletonError } from './AnimationImportErrors.ts'/**diff --git a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts b/src/lib/processes/animations-listing/ModelVariationSwitcher.tsindex 935f6b5..9502388 100644--- a/src/lib/processes/animations-listing/ModelVariationSwitcher.ts+++ b/src/lib/processes/animations-listing/ModelVariationSwitcher.ts@@ -2,7 +2,9 @@ import { SkinnedMesh } from 'three'import { Utility } from '../../Utilities'import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'import tippy from 'tippy.js'-import { RigConfig, type ModelVariation, type RigConfigEntry } from '../../RigConfig'+import { RigConfig } from '../../RigConfig'+import { type ModelVariation } from '../../interfaces/ModelVariation'+import { type RigConfigEntry } from '../../interfaces/RigConfigEntry'import { type SkeletonType } from '../../enums/SkeletonType'import { VariationLicenseCatalog } from '../../VariationLicenseInfo'diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.tsindex b19f2b9..e7d5cb4 100644--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts@@ -8,8 +8,10 @@ import {import { AnimationUtility } from './AnimationUtility.ts'import { ArmExtensionControl } from './ArmExtensionControl.ts'-import { AnimationLoader, type AnimationLoadProgress } from './AnimationLoader.ts'-import { AnimationLibrary, type AnimationLibraryLoadProgress } from './AnimationLibrary.ts'+import { AnimationLoader } from './AnimationLoader.ts'+import { type AnimationLoadProgress } from './interfaces/AnimationLoadProgress'+import { AnimationLibrary } from './AnimationLibrary.ts'+import { type AnimationLibraryLoadProgress } from './interfaces/AnimationLibraryLoadProgress'import { AnimationLibraryProgressBar } from './AnimationLibraryProgressBar.ts'import { CustomAnimationImporter } from './CustomAnimationImporter.ts'import { ImportAnimationsButton } from './ImportAnimationsButton.ts'diff --git a/src/lib/processes/animations-listing/interfaces/AnimationImportContext.ts b/src/lib/processes/animations-listing/interfaces/AnimationImportContext.tsnew file mode 100644index 0000000..5b81fc0--- /dev/null+++ b/src/lib/processes/animations-listing/interfaces/AnimationImportContext.ts@@ -0,0 +1,8 @@+import { type SkinnedMesh } from 'three'+import { type SkeletonType } from '../../../enums/SkeletonType'++export interface AnimationImportContext {+ skinned_meshes_to_animate: SkinnedMesh[]+ skeleton_scale: number+ skeleton_type: SkeletonType+}diff --git a/src/lib/processes/animations-listing/interfaces/AnimationLibraryLoadProgress.ts b/src/lib/processes/animations-listing/interfaces/AnimationLibraryLoadProgress.tsnew file mode 100644index 0000000..9ee1916--- /dev/null+++ b/src/lib/processes/animations-listing/interfaces/AnimationLibraryLoadProgress.ts@@ -0,0 +1,4 @@+export interface AnimationLibraryLoadProgress {+ loaded: number+ total: number+}diff --git a/src/lib/processes/animations-listing/interfaces/AnimationLoadProgress.ts b/src/lib/processes/animations-listing/interfaces/AnimationLoadProgress.tsnew file mode 100644index 0000000..1e03eeb--- /dev/null+++ b/src/lib/processes/animations-listing/interfaces/AnimationLoadProgress.ts@@ -0,0 +1,11 @@+export interface AnimationLoadProgress {+ loaded: number+ total: number+ percentage: number+ currentFile: string+ currentFileProgress: number+ currentFileLoaded: number+ currentFileTotal: number+ overallBytesLoaded: number+ overallBytesTotal: number+}diff --git a/src/lib/processes/animations-listing/interfaces/LoadedAnimationSource.ts b/src/lib/processes/animations-listing/interfaces/LoadedAnimationSource.tsnew file mode 100644index 0000000..c9c853d--- /dev/null+++ b/src/lib/processes/animations-listing/interfaces/LoadedAnimationSource.ts@@ -0,0 +1,7 @@+import { type AnimationClip, type Object3D } from 'three'++export interface LoadedAnimationSource {+ animations: AnimationClip[]+ // scene the animations came with. Holds the rig they were authored on+ scene: Object3D+}diff --git a/src/lib/processes/animations-listing/props/PropCatalog.ts b/src/lib/processes/animations-listing/props/PropCatalog.tsindex 0a8ce0e..f8f9c1b 100644--- a/src/lib/processes/animations-listing/props/PropCatalog.ts+++ b/src/lib/processes/animations-listing/props/PropCatalog.ts@@ -1,29 +1,12 @@import { Euler, Group, Mesh, type Object3D } from 'three'import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'import { SkeletonType } from '../../../enums/SkeletonType.ts'-import { asset_path, props_manifest, type ManifestProp } from '../../../AssetManifest.ts'+import { asset_path, props_manifest } from '../../../AssetManifest.ts'+import { type ManifestProp } from '../../../interfaces/ManifestProp'import { type PropId } from './PropId.ts'import { PropSide } from './PropSide.ts'--export interface PropMountOffset {- // meters for a rig at skeleton scale 1.0, along the hand bone toward the fingers- along_hand: number- // meters for a rig at skeleton scale 1.0, along world down in the bind pose- below_palm: number- // applied after the prop's +Y is aligned with the grip axis (world forward)- rotation: Euler-}--export interface PropDefinition {- id: PropId- display_name: string- category: string // group shown in the prop picker, e.g. 'Swords'- asset_path: string // relative to the static root- preview_path: string // relative to the static root- model_offset_y: number- default_mount_offsets: Record<PropSide, PropMountOffset>- rig_mount_offsets: Partial<Record<SkeletonType, Record<PropSide, PropMountOffset>>>-}+import { type PropMountOffset } from './interfaces/PropMountOffset'+import { type PropDefinition } from './interfaces/PropDefinition'/*** App-specific settings for a prop. The model and preview files come from the props manifest.diff --git a/src/lib/processes/animations-listing/props/PropPicker.ts b/src/lib/processes/animations-listing/props/PropPicker.tsindex b4e155f..26700fb 100644--- a/src/lib/processes/animations-listing/props/PropPicker.ts+++ b/src/lib/processes/animations-listing/props/PropPicker.ts@@ -1,4 +1,5 @@-import { PropCatalog, type PropDefinition } from './PropCatalog.ts'+import { PropCatalog } from './PropCatalog.ts'+import { type PropDefinition } from './interfaces/PropDefinition'import { NO_PROP, type PropId } from './PropId.ts'/**diff --git a/src/lib/processes/animations-listing/props/PropsManager.ts b/src/lib/processes/animations-listing/props/PropsManager.tsindex bdb73ce..b70fc0f 100644--- a/src/lib/processes/animations-listing/props/PropsManager.ts+++ b/src/lib/processes/animations-listing/props/PropsManager.ts@@ -3,7 +3,7 @@ import { SkeletonType } from '../../../enums/SkeletonType.ts'import { PropCatalog } from './PropCatalog.ts'import { PropSide } from './PropSide.ts'import { NO_PROP, type PropId } from './PropId.ts'-import { type PropSelection } from './PropSelection.ts'+import { type PropSelection } from './interfaces/PropSelection'import { PropsPanel } from './PropsPanel.ts'import { HandBoneResolver } from './HandBoneResolver.ts'import { PROP_USER_DATA_KEY } from './PropsExportFilter.ts'diff --git a/src/lib/processes/animations-listing/props/PropsPanel.ts b/src/lib/processes/animations-listing/props/PropsPanel.tsindex 1d9b254..6876253 100644--- a/src/lib/processes/animations-listing/props/PropsPanel.ts+++ b/src/lib/processes/animations-listing/props/PropsPanel.ts@@ -2,7 +2,7 @@ import { UI } from '../../../UI.ts'import { PropPicker } from './PropPicker.ts'import { PropSide } from './PropSide.ts'import { NO_PROP } from './PropId.ts'-import { type PropSelection } from './PropSelection.ts'+import { type PropSelection } from './interfaces/PropSelection'export class PropsPanel extends EventTarget {private readonly ui: UI = UI.getInstance()diff --git a/src/lib/processes/animations-listing/props/interfaces/PropDefinition.ts b/src/lib/processes/animations-listing/props/interfaces/PropDefinition.tsnew file mode 100644index 0000000..d98ced4--- /dev/null+++ b/src/lib/processes/animations-listing/props/interfaces/PropDefinition.ts@@ -0,0 +1,15 @@+import { type PropId } from '../PropId'+import { type PropSide } from '../PropSide'+import { type SkeletonType } from '../../../../enums/SkeletonType'+import { type PropMountOffset } from './PropMountOffset'++export interface PropDefinition {+ id: PropId+ display_name: string+ category: string // group shown in the prop picker, e.g. 'Swords'+ asset_path: string // relative to the static root+ preview_path: string // relative to the static root+ model_offset_y: number+ default_mount_offsets: Record<PropSide, PropMountOffset>+ rig_mount_offsets: Partial<Record<SkeletonType, Record<PropSide, PropMountOffset>>>+}diff --git a/src/lib/processes/animations-listing/props/interfaces/PropMountOffset.ts b/src/lib/processes/animations-listing/props/interfaces/PropMountOffset.tsnew file mode 100644index 0000000..5976b41--- /dev/null+++ b/src/lib/processes/animations-listing/props/interfaces/PropMountOffset.ts@@ -0,0 +1,10 @@+import { type Euler } from 'three'++export interface PropMountOffset {+ // meters for a rig at skeleton scale 1.0, along the hand bone toward the fingers+ along_hand: number+ // meters for a rig at skeleton scale 1.0, along world down in the bind pose+ below_palm: number+ // applied after the prop's +Y is aligned with the grip axis (world forward)+ rotation: Euler+}diff --git a/src/lib/processes/animations-listing/props/PropSelection.ts b/src/lib/processes/animations-listing/props/interfaces/PropSelection.tssimilarity index 61%rename from src/lib/processes/animations-listing/props/PropSelection.tsrename to src/lib/processes/animations-listing/props/interfaces/PropSelection.tsindex 86d2baa..add6e41 100644--- a/src/lib/processes/animations-listing/props/PropSelection.ts+++ b/src/lib/processes/animations-listing/props/interfaces/PropSelection.ts@@ -1,4 +1,4 @@-import { type PropId } from './PropId.ts'+import { type PropId } from '../PropId'export interface PropSelection {left: PropIddiff --git a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts b/src/lib/processes/edit-skeleton/StepEditSkeleton.tsindex 3d4086d..2db84fd 100644--- a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts+++ b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts@@ -1,4 +1,5 @@-import { type ManualWeightOverrides, type WeightPaintManager } from '../weight-painting/WeightPaintManager.ts'+import { type WeightPaintManager } from '../weight-painting/WeightPaintManager.ts'+import { type ManualWeightOverrides } from '../weight-painting/interfaces/ManualWeightOverrides'import { WeightPaintEditTools } from '../weight-painting/WeightPaintEditTools.ts'import { UI } from '../../UI.ts'import { Generators } from '../../Generators.ts'diff --git a/src/lib/processes/load-model/CustomFBXLoader.ts b/src/lib/processes/load-model/CustomFBXLoader.tsindex b576861..9b3ae3e 100644--- a/src/lib/processes/load-model/CustomFBXLoader.ts+++ b/src/lib/processes/load-model/CustomFBXLoader.ts@@ -1,11 +1,7 @@import { EventDispatcher, type Object3DEventMap, type Group } from 'three'import { FBXLoader } from '../../../lib/io/FBXLoader'import { ModalDialog } from '../../ModalDialog'--export interface FBXResults {- fbx_scene: Group<Object3DEventMap>- is_missing_dependencies: boolean-}+import { type FBXResults } from './interfaces/FBXResults'export class CustomFBXLoader extends EventDispatcher {private readonly loader: FBXLoaderdiff --git a/src/lib/processes/load-model/ModelAnalysisReport.test.ts b/src/lib/processes/load-model/ModelAnalysisReport.test.tsindex 6bef1cf..6a1f0e4 100644--- a/src/lib/processes/load-model/ModelAnalysisReport.test.ts+++ b/src/lib/processes/load-model/ModelAnalysisReport.test.ts@@ -1,6 +1,7 @@import { describe, it, expect } from 'vitest'import { BoxGeometry, Group, Mesh, MeshPhongMaterial, MeshStandardMaterial, Scene } from 'three'-import { ModelAnalysisReport, type SceneSnapshot } from './ModelAnalysisReport'+import { ModelAnalysisReport } from './ModelAnalysisReport'+import { type SceneSnapshot } from './interfaces/SceneSnapshot'/** A 1x1x1 box mesh with a name, so snapshots have something real to measure. */function make_mesh (name: string): Mesh {diff --git a/src/lib/processes/load-model/ModelAnalysisReport.ts b/src/lib/processes/load-model/ModelAnalysisReport.tsindex d0b6014..9a22ddd 100644--- a/src/lib/processes/load-model/ModelAnalysisReport.ts+++ b/src/lib/processes/load-model/ModelAnalysisReport.ts@@ -1,6 +1,10 @@import { Box3, SRGBColorSpace, Vector3, type BufferGeometry, type Material, type Mesh, type MeshPhongMaterial, type MeshStandardMaterial, type Object3D, type Texture } from 'three'import { ModalDialog } from '../../ModalDialog.ts'import { MODEL_HEIGHT_LIMIT } from './ModelCleanupUtility.ts'+import { type MaterialInfo } from './interfaces/MaterialInfo'+import { type AnalyzedObject } from './interfaces/AnalyzedObject'+import { type SceneSnapshot } from './interfaces/SceneSnapshot'+import { type ModelImportAnalysis } from './interfaces/ModelImportAnalysis'/*** Materials arrive as whatever type the file's loader picked, so read them@@ -23,90 +27,6 @@ const TEXTURE_SLOTS: Array<[keyof InspectableMaterial, string]> = [['displacementMap', 'displacement']]-/**- * What one material on one mesh looked like at import time. Emissive gets its- * own fields because it is the property most likely to come in wrong from an- * FBX and then follow the model all the way out to a GLB export.- */-export interface MaterialInfo {- name: string- type: string- color_hex: string | null- emissive_hex: string | null- emissive_intensity: number- /**- * Brightest channel of the emissive color on its own. A GLB export writes the- * color straight into emissiveFactor whenever this is above zero, so this is- * the number that decides whether the exported model glows.- */- emissive_strength: number- /**- * Whether emissive intensity survives an export. Only MeshStandardMaterial- * carries it, through the KHR_materials_emissive_strength extension. FBX files- * usually load as MeshPhongMaterial, where the intensity dims the model in the- * viewport but is dropped on export, leaving the full emissive color behind.- */- exports_emissive_intensity: boolean- specular_hex: string | null- metalness: number | null- roughness: number | null- shininess: number | null- opacity: number- transparent: boolean- vertex_colors: boolean- side: string- texture_slots: string[]-}--/**- * Snapshot of a single mesh-bearing object, taken at a point in time so later- * processing steps cannot change the numbers we are reporting on.- */-export interface AnalyzedObject {- name: string- type: string- parent_name: string- depth: number- position: Vector3- rotation_degrees: Vector3- scale: Vector3- world_scale: Vector3- world_size: Vector3- // parent objects between this mesh and the scene root that carry their own transform- transformed_ancestors: string[]- vertex_count: number- triangle_count: number- materials: MaterialInfo[]- has_uvs: boolean- has_normals: boolean- has_skin_weights: boolean- warnings: string[]-}--/** Everything we can say about one scene graph at one moment. */-export interface SceneSnapshot {- objects: AnalyzedObject[]- type_counts: Record<string, number>- mesh_count: number- skinned_mesh_count: number- vertex_count: number- triangle_count: number- world_size: Vector3- world_min: Vector3- world_max: Vector3-}--/**- * Before/after pair for one import. `imported` is what came out of the file- * loader and `processed` is the mesh data the rest of the app actually works- * with, which makes it possible to see what import processing changed.- */-export interface ModelImportAnalysis {- source_name: string- imported: SceneSnapshot- processed: SceneSnapshot-}-/** A warning message plus the objects it applies to, for grouped display. */interface GroupedWarning {message: stringdiff --git a/src/lib/processes/load-model/ModelZipLoader.ts b/src/lib/processes/load-model/ModelZipLoader.tsindex 1a16e9f..da8abd9 100644--- a/src/lib/processes/load-model/ModelZipLoader.ts+++ b/src/lib/processes/load-model/ModelZipLoader.ts@@ -4,15 +4,8 @@ import { CustomGLTFLoader } from './CustomGLTFLoader'import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'import { ColladaLoader } from 'three/examples/jsm/loaders/ColladaLoader.js'import { CustomDAELoader } from './CustomDAELoader'--// things that might be in the ZIP file-export type ModelFormat = 'gltf' | 'dae' | 'unknown'--export interface ZipModelInfo {- format: ModelFormat- fileName: string- fileData: ArrayBuffer-}+import { type ModelFormat } from './interfaces/ModelFormat'+import { type ZipModelInfo } from './interfaces/ZipModelInfo'export class ModelZipLoader {/**diff --git a/src/lib/processes/load-model/StepLoadModel.ts b/src/lib/processes/load-model/StepLoadModel.tsindex d764f06..b46ff10 100644--- a/src/lib/processes/load-model/StepLoadModel.ts+++ b/src/lib/processes/load-model/StepLoadModel.ts@@ -1,6 +1,7 @@import { UI } from '../../UI.ts'import { ModelZipLoader } from './ModelZipLoader.ts'-import { CustomFBXLoader, type FBXResults } from './CustomFBXLoader.ts'+import { CustomFBXLoader } from './CustomFBXLoader.ts'+import { type FBXResults } from './interfaces/FBXResults'import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'import { DOMUtilities } from '../../DOMUtilities.ts'@@ -10,7 +11,9 @@ import { BufferGeometry, Group, type Material, type Object3D } from 'three'import { ModalDialog } from '../../ModalDialog.ts'import { Utility } from '../../Utilities.ts'import { ModelCleanupUtility } from './ModelCleanupUtility.ts'-import { ModelAnalysisReport, type ModelImportAnalysis, type SceneSnapshot } from './ModelAnalysisReport.ts'+import { ModelAnalysisReport } from './ModelAnalysisReport.ts'+import { type ModelImportAnalysis } from './interfaces/ModelImportAnalysis'+import { type SceneSnapshot } from './interfaces/SceneSnapshot'import { PlatformUtils } from '../../PlatformUtils.ts'// Note: EventTarget is a built-ininterface and do not need to import itdiff --git a/src/lib/processes/load-model/interfaces/AnalyzedObject.ts b/src/lib/processes/load-model/interfaces/AnalyzedObject.tsnew file mode 100644index 0000000..c3c72a1--- /dev/null+++ b/src/lib/processes/load-model/interfaces/AnalyzedObject.ts@@ -0,0 +1,27 @@+import { type Vector3 } from 'three'+import { type MaterialInfo } from './MaterialInfo'++/**+ * Snapshot of a single mesh-bearing object, taken at a point in time so later+ * processing steps cannot change the numbers we are reporting on.+ */+export interface AnalyzedObject {+ name: string+ type: string+ parent_name: string+ depth: number+ position: Vector3+ rotation_degrees: Vector3+ scale: Vector3+ world_scale: Vector3+ world_size: Vector3+ // parent objects between this mesh and the scene root that carry their own transform+ transformed_ancestors: string[]+ vertex_count: number+ triangle_count: number+ materials: MaterialInfo[]+ has_uvs: boolean+ has_normals: boolean+ has_skin_weights: boolean+ warnings: string[]+}diff --git a/src/lib/processes/load-model/interfaces/FBXResults.ts b/src/lib/processes/load-model/interfaces/FBXResults.tsnew file mode 100644index 0000000..2ed9dc7--- /dev/null+++ b/src/lib/processes/load-model/interfaces/FBXResults.ts@@ -0,0 +1,6 @@+import { type Group, type Object3DEventMap } from 'three'++export interface FBXResults {+ fbx_scene: Group<Object3DEventMap>+ is_missing_dependencies: boolean+}diff --git a/src/lib/processes/load-model/interfaces/MaterialInfo.ts b/src/lib/processes/load-model/interfaces/MaterialInfo.tsnew file mode 100644index 0000000..3127ce2--- /dev/null+++ b/src/lib/processes/load-model/interfaces/MaterialInfo.ts@@ -0,0 +1,34 @@+/**+ * What one material on one mesh looked like at import time. Emissive gets its+ * own fields because it is the property most likely to come in wrong from an+ * FBX and then follow the model all the way out to a GLB export.+ */+export interface MaterialInfo {+ name: string+ type: string+ color_hex: string | null+ emissive_hex: string | null+ emissive_intensity: number+ /**+ * Brightest channel of the emissive color on its own. A GLB export writes the+ * color straight into emissiveFactor whenever this is above zero, so this is+ * the number that decides whether the exported model glows.+ */+ emissive_strength: number+ /**+ * Whether emissive intensity survives an export. Only MeshStandardMaterial+ * carries it, through the KHR_materials_emissive_strength extension. FBX files+ * usually load as MeshPhongMaterial, where the intensity dims the model in the+ * viewport but is dropped on export, leaving the full emissive color behind.+ */+ exports_emissive_intensity: boolean+ specular_hex: string | null+ metalness: number | null+ roughness: number | null+ shininess: number | null+ opacity: number+ transparent: boolean+ vertex_colors: boolean+ side: string+ texture_slots: string[]+}diff --git a/src/lib/processes/load-model/interfaces/ModelFormat.ts b/src/lib/processes/load-model/interfaces/ModelFormat.tsnew file mode 100644index 0000000..6dbd1ea--- /dev/null+++ b/src/lib/processes/load-model/interfaces/ModelFormat.ts@@ -0,0 +1,2 @@+// things that might be in the ZIP file+export type ModelFormat = 'gltf' | 'dae' | 'unknown'diff --git a/src/lib/processes/load-model/interfaces/ModelImportAnalysis.ts b/src/lib/processes/load-model/interfaces/ModelImportAnalysis.tsnew file mode 100644index 0000000..7b69164--- /dev/null+++ b/src/lib/processes/load-model/interfaces/ModelImportAnalysis.ts@@ -0,0 +1,12 @@+import { type SceneSnapshot } from './SceneSnapshot'++/**+ * Before/after pair for one import. `imported` is what came out of the file+ * loader and `processed` is the mesh data the rest of the app actually works+ * with, which makes it possible to see what import processing changed.+ */+export interface ModelImportAnalysis {+ source_name: string+ imported: SceneSnapshot+ processed: SceneSnapshot+}diff --git a/src/lib/processes/load-model/interfaces/SceneSnapshot.ts b/src/lib/processes/load-model/interfaces/SceneSnapshot.tsnew file mode 100644index 0000000..2fd8c74--- /dev/null+++ b/src/lib/processes/load-model/interfaces/SceneSnapshot.ts@@ -0,0 +1,15 @@+import { type Vector3 } from 'three'+import { type AnalyzedObject } from './AnalyzedObject'++/** Everything we can say about one scene graph at one moment. */+export interface SceneSnapshot {+ objects: AnalyzedObject[]+ type_counts: Record<string, number>+ mesh_count: number+ skinned_mesh_count: number+ vertex_count: number+ triangle_count: number+ world_size: Vector3+ world_min: Vector3+ world_max: Vector3+}diff --git a/src/lib/processes/load-model/interfaces/ZipModelInfo.ts b/src/lib/processes/load-model/interfaces/ZipModelInfo.tsnew file mode 100644index 0000000..db3c0ed--- /dev/null+++ b/src/lib/processes/load-model/interfaces/ZipModelInfo.ts@@ -0,0 +1,7 @@+import { type ModelFormat } from './ModelFormat'++export interface ZipModelInfo {+ format: ModelFormat+ fileName: string+ fileData: ArrayBuffer+}diff --git a/src/lib/processes/weight-painting/StepWeightPainting.ts b/src/lib/processes/weight-painting/StepWeightPainting.tsindex 524e559..587229c 100644--- a/src/lib/processes/weight-painting/StepWeightPainting.ts+++ b/src/lib/processes/weight-painting/StepWeightPainting.ts@@ -1,9 +1,11 @@import { UI } from '../../UI.ts'import { AnimationLoader } from '../animations-listing/AnimationLoader.ts'import { type AnimationPlayer } from '../animations-listing/AnimationPlayer.ts'-import { WeightPaintManager, type WeightPaintMode } from './WeightPaintManager.ts'+import { WeightPaintManager } from './WeightPaintManager.ts'+import { type WeightPaintMode } from './interfaces/WeightPaintMode'import { WeightPaintBrush } from './WeightPaintBrush.ts'-import { RigConfig, type RigAnimation } from '../../RigConfig.ts'+import { RigConfig } from '../../RigConfig.ts'+import { type RigAnimation } from '../../interfaces/RigAnimation'import { Utility } from '../../Utilities.ts'import {AnimationMixer, BufferGeometry, Float32BufferAttribute, LoopRepeat, MeshBasicMaterial,diff --git a/src/lib/processes/weight-painting/WeightPaintBrush.test.ts b/src/lib/processes/weight-painting/WeightPaintBrush.test.tsindex 90f7060..747b12f 100644--- a/src/lib/processes/weight-painting/WeightPaintBrush.test.ts+++ b/src/lib/processes/weight-painting/WeightPaintBrush.test.ts@@ -4,7 +4,8 @@ import {PlaneGeometry, Vector3, type Intersection} from 'three'import { WeightPaintBrush } from './WeightPaintBrush'-import { WeightPaintManager, type BrushVertex } from './WeightPaintManager'+import { WeightPaintManager } from './WeightPaintManager'+import { type BrushVertex } from './interfaces/BrushVertex'class RecordingManager {public readonly calls: BrushVertex[][] = []diff --git a/src/lib/processes/weight-painting/WeightPaintBrush.ts b/src/lib/processes/weight-painting/WeightPaintBrush.tsindex f5b97b5..c6adcef 100644--- a/src/lib/processes/weight-painting/WeightPaintBrush.ts+++ b/src/lib/processes/weight-painting/WeightPaintBrush.ts@@ -1,6 +1,8 @@import { MathUtils, Matrix3, Mesh, SkinnedMesh, Triangle, Vector3, type Bone, type Intersection, type PerspectiveCamera } from 'three'import { vertex_adjacency } from '../../geometry/VertexAdjacency.ts'-import { WeightPaintManager, type BrushVertex, type WeightPaintMode } from './WeightPaintManager.ts'+import { WeightPaintManager } from './WeightPaintManager.ts'+import { type BrushVertex } from './interfaces/BrushVertex'+import { type WeightPaintMode } from './interfaces/WeightPaintMode'/*** Shared brush mechanics for the paint tools in the Position Joints step anddiff --git a/src/lib/processes/weight-painting/WeightPaintEditTools.ts b/src/lib/processes/weight-painting/WeightPaintEditTools.tsindex 9774b3c..ca74f7f 100644--- a/src/lib/processes/weight-painting/WeightPaintEditTools.ts+++ b/src/lib/processes/weight-painting/WeightPaintEditTools.ts@@ -1,7 +1,9 @@import { type Bone, type Intersection, type PerspectiveCamera } from 'three'import { Utility } from '../../Utilities.ts'import { WeightPaintBrush } from './WeightPaintBrush.ts'-import { WeightPaintManager, type ManualWeightOverrides, type WeightPaintMode } from './WeightPaintManager.ts'+import { WeightPaintManager } from './WeightPaintManager.ts'+import { type ManualWeightOverrides } from './interfaces/ManualWeightOverrides'+import { type WeightPaintMode } from './interfaces/WeightPaintMode'/*** Weight painting controls shown while positioning the joints.diff --git a/src/lib/processes/weight-painting/WeightPaintManager.ts b/src/lib/processes/weight-painting/WeightPaintManager.tsindex 2c180c7..e2ca1f6 100644--- a/src/lib/processes/weight-painting/WeightPaintManager.ts+++ b/src/lib/processes/weight-painting/WeightPaintManager.ts@@ -2,21 +2,11 @@ import { Vector3, type Bone, type BufferGeometry, type Mesh } from 'three'import { Generators } from '../../Generators'import { Utility } from '../../Utilities.js'import { vertex_adjacency } from '../../geometry/VertexAdjacency.ts'--export interface PaintedInfluence {- bone_name: string- weight: number-}--export type GeometryWeightOverrides = Map<number, PaintedInfluence[]>-export type ManualWeightOverrides = Map<number, GeometryWeightOverrides>-export type WeightPaintMode = 'add' | 'subtract' | 'smooth'--/** One vertex touched by a brush, with the brush falloff at that vertex. */-export interface BrushVertex {- vertex_index: number- falloff: number-}+import { type PaintedInfluence } from './interfaces/PaintedInfluence'+import { type GeometryWeightOverrides } from './interfaces/GeometryWeightOverrides'+import { type ManualWeightOverrides } from './interfaces/ManualWeightOverrides'+import { type WeightPaintMode } from './interfaces/WeightPaintMode'+import { type BrushVertex } from './interfaces/BrushVertex'interface SkinBackup {indices: number[]diff --git a/src/lib/processes/weight-painting/interfaces/BrushVertex.ts b/src/lib/processes/weight-painting/interfaces/BrushVertex.tsnew file mode 100644index 0000000..1195159--- /dev/null+++ b/src/lib/processes/weight-painting/interfaces/BrushVertex.ts@@ -0,0 +1,5 @@+/** One vertex touched by a brush, with the brush falloff at that vertex. */+export interface BrushVertex {+ vertex_index: number+ falloff: number+}diff --git a/src/lib/processes/weight-painting/interfaces/GeometryWeightOverrides.ts b/src/lib/processes/weight-painting/interfaces/GeometryWeightOverrides.tsnew file mode 100644index 0000000..296c29d--- /dev/null+++ b/src/lib/processes/weight-painting/interfaces/GeometryWeightOverrides.ts@@ -0,0 +1,3 @@+import { type PaintedInfluence } from './PaintedInfluence'++export type GeometryWeightOverrides = Map<number, PaintedInfluence[]>diff --git a/src/lib/processes/weight-painting/interfaces/ManualWeightOverrides.ts b/src/lib/processes/weight-painting/interfaces/ManualWeightOverrides.tsnew file mode 100644index 0000000..89be301--- /dev/null+++ b/src/lib/processes/weight-painting/interfaces/ManualWeightOverrides.ts@@ -0,0 +1,3 @@+import { type GeometryWeightOverrides } from './GeometryWeightOverrides'++export type ManualWeightOverrides = Map<number, GeometryWeightOverrides>diff --git a/src/lib/processes/weight-painting/interfaces/PaintedInfluence.ts b/src/lib/processes/weight-painting/interfaces/PaintedInfluence.tsnew file mode 100644index 0000000..09f2426--- /dev/null+++ b/src/lib/processes/weight-painting/interfaces/PaintedInfluence.ts@@ -0,0 +1,4 @@+export interface PaintedInfluence {+ bone_name: string+ weight: number+}diff --git a/src/lib/processes/weight-painting/interfaces/WeightPaintMode.ts b/src/lib/processes/weight-painting/interfaces/WeightPaintMode.tsnew file mode 100644index 0000000..bb69252--- /dev/null+++ b/src/lib/processes/weight-painting/interfaces/WeightPaintMode.ts@@ -0,0 +1 @@+export type WeightPaintMode = 'add' | 'subtract' | 'smooth'diff --git a/src/lib/processes/weight-skin/StepWeightSkin.ts b/src/lib/processes/weight-skin/StepWeightSkin.tsindex 9641635..53e94b0 100644--- a/src/lib/processes/weight-skin/StepWeightSkin.ts+++ b/src/lib/processes/weight-skin/StepWeightSkin.ts@@ -1,7 +1,8 @@import { UI } from '../../UI.ts'import SkinningAlgorithm from '../../solvers/SkinningAlgorithm.ts'import { Utility } from '../../Utilities.ts'-import { WeightPaintManager, type ManualWeightOverrides } from '../weight-painting/WeightPaintManager.ts'+import { WeightPaintManager } from '../weight-painting/WeightPaintManager.ts'+import { type ManualWeightOverrides } from '../weight-painting/interfaces/ManualWeightOverrides'import { Generators } from '../../Generators.ts'diff --git a/src/preview-generator/preview-generator.ts b/src/preview-generator/preview-generator.tsindex 8af5c3d..c267242 100644--- a/src/preview-generator/preview-generator.ts+++ b/src/preview-generator/preview-generator.ts@@ -14,7 +14,9 @@ import { ThemeManager } from '../lib/ThemeManager.ts'import { AnimationUtility } from '../lib/processes/animations-listing/AnimationUtility.ts'import { DOMUtilities } from '../lib/DOMUtilities.ts'import { SkeletonType } from '../lib/enums/SkeletonType.ts'-import { RigConfig, type PreviewCamera, type RigAnimation } from '../lib/RigConfig.ts'+import { RigConfig } from '../lib/RigConfig.ts'+import { type PreviewCamera } from '../lib/interfaces/PreviewCamera'+import { type RigAnimation } from '../lib/interfaces/RigAnimation'type ThemeName = 'light' | 'dark'diff --git a/src/retarget/AnimationRetargetService.ts b/src/retarget/AnimationRetargetService.tsindex 5e4ae5b..3c87e59 100644--- a/src/retarget/AnimationRetargetService.ts+++ b/src/retarget/AnimationRetargetService.ts@@ -3,13 +3,16 @@ import {VectorKeyframeTrack, Scene, Group, type SkinnedMesh,type Skeleton} from 'three'-import { RetargetUtils, type TrackNameParts, type BoneRestTransform } from './RetargetUtils.ts'+import { RetargetUtils } from './RetargetUtils.ts'+import { type TrackNameParts } from './interfaces/TrackNameParts'+import { type BoneRestTransform } from './interfaces/BoneRestTransform'import { TargetBoneMappingType } from './bone-automap/TargetBoneMappingType.ts'import { SkeletonType } from '../lib/enums/SkeletonType.ts'import { HumanClipRetargeter } from './human-retargeting/HumanClipRetargeter.ts'import { Rig } from './human-retargeting/Rig.ts'import { HumanChainConfig } from './human-retargeting/HumanChainConfig.ts'-import { RetargetDiagnostics, type RestPoseSnapshot } from './RetargetDiagnostics.ts'+import { RetargetDiagnostics } from './RetargetDiagnostics.ts'+import { type RestPoseSnapshot } from './interfaces/RestPoseSnapshot'// AnimationRetargetService - Shared service for retargeting animations from one skeleton to another// Used by both RetargetAnimationPreview and RetargetAnimationListingdiff --git a/src/retarget/MultiRootSkeletonResolver.ts b/src/retarget/MultiRootSkeletonResolver.tsindex b996ea4..14e9a3e 100644--- a/src/retarget/MultiRootSkeletonResolver.ts+++ b/src/retarget/MultiRootSkeletonResolver.ts@@ -1,15 +1,5 @@import { Bone, Matrix4, Skeleton, type Object3D, type Scene, type SkinnedMesh } from 'three'--/**- * Information about a single disconnected bone hierarchy (root bone chain)- * found inside an imported model.- */-export interface RootBoneChain {- root_bone: Bone- bone_count: number- skinned_meshes: SkinnedMesh[]- vertex_count: number-}+import { type RootBoneChain } from './interfaces/RootBoneChain'/*** Resolves FBX imports that contain multiple disconnected bone hierarchiesdiff --git a/src/retarget/RetargetAnimationListing.ts b/src/retarget/RetargetAnimationListing.tsindex d96e082..eb95dff 100644--- a/src/retarget/RetargetAnimationListing.ts+++ b/src/retarget/RetargetAnimationListing.ts@@ -1,7 +1,8 @@import { AnimationPlayer } from '../lib/processes/animations-listing/AnimationPlayer.ts'import { AnimationSearch } from '../lib/processes/animations-listing/AnimationSearch.ts'import { AnimationLoader } from '../lib/processes/animations-listing/AnimationLoader.ts'-import { AnimationLibrary, type AnimationLibraryLoadProgress } from '../lib/processes/animations-listing/AnimationLibrary.ts'+import { AnimationLibrary } from '../lib/processes/animations-listing/AnimationLibrary.ts'+import { type AnimationLibraryLoadProgress } from '../lib/processes/animations-listing/interfaces/AnimationLibraryLoadProgress'import { AnimationLibraryProgressBar } from '../lib/processes/animations-listing/AnimationLibraryProgressBar.ts'import { AnimationUtility } from '../lib/processes/animations-listing/AnimationUtility.ts'import { ArmExtensionControl } from '../lib/processes/animations-listing/ArmExtensionControl.ts'diff --git a/src/retarget/RetargetDiagnostics.harness.test.ts b/src/retarget/RetargetDiagnostics.harness.test.tsindex 7ded819..757965b 100644--- a/src/retarget/RetargetDiagnostics.harness.test.ts+++ b/src/retarget/RetargetDiagnostics.harness.test.ts@@ -6,7 +6,8 @@ import { readFileSync } from 'node:fs'import { Object3D, Quaternion, SkinnedMesh, type Skeleton } from 'three'import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'import { RetargetUtils } from './RetargetUtils.ts'-import { RetargetDiagnostics, type RestPoseSnapshot } from './RetargetDiagnostics.ts'+import { RetargetDiagnostics } from './RetargetDiagnostics.ts'+import { type RestPoseSnapshot } from './interfaces/RestPoseSnapshot'import { Rig } from './human-retargeting/Rig.ts'import { HumanChainConfig } from './human-retargeting/HumanChainConfig.ts'diff --git a/src/retarget/RetargetDiagnostics.ts b/src/retarget/RetargetDiagnostics.tsindex 07cca71..7e1eb04 100644--- a/src/retarget/RetargetDiagnostics.ts+++ b/src/retarget/RetargetDiagnostics.ts@@ -1,17 +1,9 @@import { Quaternion, Vector3, type Bone, type Object3D, type Skeleton, type QuaternionKeyframeTrack, type VectorKeyframeTrack } from 'three'import { type Rig } from './human-retargeting/Rig.ts'import { type Joint } from './human-retargeting/Joint.ts'-import { RetargetUtils, type BoneRestTransform } from './RetargetUtils.ts'--/**- * Rest-pose snapshot of a live skeleton, taken before any cloning or retargeting- * happens. Used as the reference every consistency check is measured against.- */-export interface RestPoseSnapshot {- bone_names: string[]- local_rotations: Quaternion[]- world_rotations: Quaternion[]-}+import { RetargetUtils } from './RetargetUtils.ts'+import { type BoneRestTransform } from './interfaces/BoneRestTransform'+import { type RestPoseSnapshot } from './interfaces/RestPoseSnapshot'interface QuatDelta {angle_degrees: numberdiff --git a/src/retarget/RetargetUtils.ts b/src/retarget/RetargetUtils.tsindex d0bcca2..7f917ef 100644--- a/src/retarget/RetargetUtils.ts+++ b/src/retarget/RetargetUtils.ts@@ -1,17 +1,7 @@import { type Scene, Group, Matrix4, Skeleton, Vector3, Quaternion, type SkinnedMesh, type Bone, type Object3D } from 'three'import { ModalDialog } from '../lib/ModalDialog.ts'--export interface TrackNameParts {- bone_name: string- property: string-}--/** A single bone's local transform, captured while the skeleton is known to be at rest. */-export interface BoneRestTransform {- position: Vector3- quaternion: Quaternion- scale: Vector3-}+import { type TrackNameParts } from './interfaces/TrackNameParts'+import { type BoneRestTransform } from './interfaces/BoneRestTransform'// eslint-disable-next-line @typescript-eslint/no-extraneous-classexport class RetargetUtils {diff --git a/src/retarget/RootBoneSelectionDialog.ts b/src/retarget/RootBoneSelectionDialog.tsindex bd21e83..41692e1 100644--- a/src/retarget/RootBoneSelectionDialog.ts+++ b/src/retarget/RootBoneSelectionDialog.ts@@ -1,4 +1,4 @@-import type { RootBoneChain } from './MultiRootSkeletonResolver.ts'+import { type RootBoneChain } from './interfaces/RootBoneChain'/*** Modal dialog that asks the user which root bone is the main skeleton whendiff --git a/src/retarget/bone-automap/BoneAutoMapper.ts b/src/retarget/bone-automap/BoneAutoMapper.tsindex 70d296e..da64540 100644--- a/src/retarget/bone-automap/BoneAutoMapper.ts+++ b/src/retarget/bone-automap/BoneAutoMapper.ts@@ -1,6 +1,7 @@import { type Bone, type Object3D, type SkinnedMesh } from 'three'import { BoneCategoryMapper } from './BoneCategoryMapper'-import { BoneChainResolver, type RawBoneRecord } from './BoneChainResolver'+import { BoneChainResolver } from './BoneChainResolver'+import { type RawBoneRecord } from './interfaces/RawBoneRecord'import { CanonicalSlotMapper } from './CanonicalSlotMapper'import { Mesh2MotionMapper } from './Mesh2MotionMapper'import { MixamoMapper } from './MixamoMapper'diff --git a/src/retarget/bone-automap/BoneAutoMapping.test.ts b/src/retarget/bone-automap/BoneAutoMapping.test.tsindex 3d66e95..ea8a74c 100644--- a/src/retarget/bone-automap/BoneAutoMapping.test.ts+++ b/src/retarget/bone-automap/BoneAutoMapping.test.ts@@ -1,6 +1,7 @@import { describe, it, expect } from 'vitest'import { BoneAutoMapper } from './BoneAutoMapper'-import { BoneChainResolver, type RawBoneRecord } from './BoneChainResolver'+import { BoneChainResolver } from './BoneChainResolver'+import { type RawBoneRecord } from './interfaces/RawBoneRecord'import { MixamoMapper } from './MixamoMapper'import { RigifyMapper } from './RigifyMapper'import { type BoneMetadata, BoneSlot } from './BoneTypes'diff --git a/src/retarget/bone-automap/BoneCategoryMapper.test.ts b/src/retarget/bone-automap/BoneCategoryMapper.test.tsindex 7c663c7..b13d709 100644--- a/src/retarget/bone-automap/BoneCategoryMapper.test.ts+++ b/src/retarget/bone-automap/BoneCategoryMapper.test.ts@@ -1,6 +1,7 @@import { describe, it, expect } from 'vitest'import { BoneCategoryMapper } from './BoneCategoryMapper'-import { BoneChainResolver, type RawBoneRecord } from './BoneChainResolver'+import { BoneChainResolver } from './BoneChainResolver'+import { type RawBoneRecord } from './interfaces/RawBoneRecord'import { type BoneMetadata } from './BoneTypes'/**diff --git a/src/retarget/bone-automap/BoneChainResolver.ts b/src/retarget/bone-automap/BoneChainResolver.tsindex 3660f01..55bed0f 100644--- a/src/retarget/bone-automap/BoneChainResolver.ts+++ b/src/retarget/bone-automap/BoneChainResolver.ts@@ -1,28 +1,10 @@import { type BoneMetadata, BoneSide, BoneSlot } from './BoneTypes'-import { normalized_lookup_key, parse_bone_name, type ParsedBoneName } from './BoneNameTokenizer'+import { normalized_lookup_key, parse_bone_name } from './BoneNameTokenizer'+import { type ParsedBoneName } from './interfaces/ParsedBoneName'import {is_arm_ambiguous_slot, is_finger_slot, is_leg_ambiguous_slot, resolve_slot, slot_to_category} from './BoneSlotVocabulary'--/**- * BoneChainResolver - builds BoneMetadata from a flat list of (bone, parent) pairs- * and resolves each bone to a canonical slot.- *- * Names alone cannot settle every joint. The two that matter in practice:- * - Mixamo calls the clavicle "LeftShoulder" and the upper arm "LeftArm";- * DAZ calls the upper arm "lShldr" and the clavicle "lCollar".- * - Mixamo calls the calf "LeftLeg"; plenty of rigs call the thigh "leg_l".- * Both are settled by walking up from the hand and the foot, where the terminal- * joint is named unambiguously in every rig we care about.- *- * Deliberately takes plain records rather than three.js Bones so it can be unit- * tested with nothing more than a list of names and parents.- */--export interface RawBoneRecord {- name: string- parent_name: string | null-}+import { type RawBoneRecord } from './interfaces/RawBoneRecord'export class BoneChainResolver {/**diff --git a/src/retarget/bone-automap/BoneNameTokenizer.ts b/src/retarget/bone-automap/BoneNameTokenizer.tsindex 62961a8..cd004c5 100644--- a/src/retarget/bone-automap/BoneNameTokenizer.ts+++ b/src/retarget/bone-automap/BoneNameTokenizer.ts@@ -1,26 +1,5 @@import { BoneSide } from './BoneTypes'--/**- * BoneNameTokenizer - turns a raw bone name from any rig into structured tokens.- *- * The old normalize_bone_name() worked on the raw string with substring/suffix- * regexes, which is what made "shoulder" end in "r" (detected as right side) and- * "tail" end in "l" (detected as left, and stripped down to "tai"). Splitting the- * name into whole word tokens first removes that entire class of bug: a side- * marker only counts when it stands alone as a token.- *- * This module stays purely mechanical - it splits and cleans names but knows- * nothing about anatomy. All synonym knowledge lives in BoneSlotVocabulary.- *- * Pure functions, no three.js - directly unit testable.- */--export interface ParsedBoneName {- tokens: string[] // canonical lowercase word tokens, prefixes and side/index removed- side: BoneSide // Unknown when the name carried no side marker- index: number | null // numeric segment index found in the name, null if absent- is_leaf: boolean // name carried an end/tip/leaf/nub marker-}+import { type ParsedBoneName } from './interfaces/ParsedBoneName'/*** Rig namespace prefixes that appear as a single glued-on chunk. Stripped from thediff --git a/src/retarget/bone-automap/BoneSlotVocabulary.ts b/src/retarget/bone-automap/BoneSlotVocabulary.tsindex 494577b..96c7d13 100644--- a/src/retarget/bone-automap/BoneSlotVocabulary.ts+++ b/src/retarget/bone-automap/BoneSlotVocabulary.ts@@ -1,5 +1,5 @@import { BoneCategory, BoneSide, BoneSlot } from './BoneTypes'-import { type ParsedBoneName } from './BoneNameTokenizer'+import { type ParsedBoneName } from './interfaces/ParsedBoneName'/*** BoneSlotVocabulary - the synonym table that turns tokenized bone names intodiff --git a/src/retarget/bone-automap/interfaces/ParsedBoneName.ts b/src/retarget/bone-automap/interfaces/ParsedBoneName.tsnew file mode 100644index 0000000..c68539a--- /dev/null+++ b/src/retarget/bone-automap/interfaces/ParsedBoneName.ts@@ -0,0 +1,23 @@+import { type BoneSide } from '../BoneTypes'++/**+ * BoneNameTokenizer - turns a raw bone name from any rig into structured tokens.+ *+ * The old normalize_bone_name() worked on the raw string with substring/suffix+ * regexes, which is what made "shoulder" end in "r" (detected as right side) and+ * "tail" end in "l" (detected as left, and stripped down to "tai"). Splitting the+ * name into whole word tokens first removes that entire class of bug: a side+ * marker only counts when it stands alone as a token.+ *+ * This module stays purely mechanical - it splits and cleans names but knows+ * nothing about anatomy. All synonym knowledge lives in BoneSlotVocabulary.+ *+ * Pure functions, no three.js - directly unit testable.+ */++export interface ParsedBoneName {+ tokens: string[] // canonical lowercase word tokens, prefixes and side/index removed+ side: BoneSide // Unknown when the name carried no side marker+ index: number | null // numeric segment index found in the name, null if absent+ is_leaf: boolean // name carried an end/tip/leaf/nub marker+}diff --git a/src/retarget/bone-automap/interfaces/RawBoneRecord.ts b/src/retarget/bone-automap/interfaces/RawBoneRecord.tsnew file mode 100644index 0000000..39223ec--- /dev/null+++ b/src/retarget/bone-automap/interfaces/RawBoneRecord.ts@@ -0,0 +1,19 @@+/**+ * BoneChainResolver - builds BoneMetadata from a flat list of (bone, parent) pairs+ * and resolves each bone to a canonical slot.+ *+ * Names alone cannot settle every joint. The two that matter in practice:+ * - Mixamo calls the clavicle "LeftShoulder" and the upper arm "LeftArm";+ * DAZ calls the upper arm "lShldr" and the clavicle "lCollar".+ * - Mixamo calls the calf "LeftLeg"; plenty of rigs call the thigh "leg_l".+ * Both are settled by walking up from the hand and the foot, where the terminal+ * joint is named unambiguously in every rig we care about.+ *+ * Deliberately takes plain records rather than three.js Bones so it can be unit+ * tested with nothing more than a list of names and parents.+ */++export interface RawBoneRecord {+ name: string+ parent_name: string | null+}diff --git a/src/retarget/bone-automap/rig-fixtures.ts b/src/retarget/bone-automap/rig-fixtures.tsindex f9e8cf6..555ec4c 100644--- a/src/retarget/bone-automap/rig-fixtures.ts+++ b/src/retarget/bone-automap/rig-fixtures.ts@@ -1,4 +1,4 @@-import { type RawBoneRecord } from './BoneChainResolver'+import { type RawBoneRecord } from './interfaces/RawBoneRecord'/*** Skeleton fixtures for the auto-mapping tests.diff --git a/src/retarget/human-retargeting/HumanClipRetargeter.ts b/src/retarget/human-retargeting/HumanClipRetargeter.tsindex 710f307..b553340 100644--- a/src/retarget/human-retargeting/HumanClipRetargeter.ts+++ b/src/retarget/human-retargeting/HumanClipRetargeter.ts@@ -1,15 +1,7 @@import { AnimationClip, type QuaternionKeyframeTrack, type VectorKeyframeTrack } from 'three'import { Retargeter } from './Retargeter'import { type Rig } from './Rig'--export interface HumanClipRetargetOptions {- // name for the baked clip. Defaults to the source clip name- clip_name?: string- // corrective X-axis rotation (degrees) applied to the whole target rig. See Retargeter.set_root_correction_x- root_correction_x_degrees?: number- // 30 fps for input animations is usually sufficient for now- fps?: number-}+import { type HumanClipRetargetOptions } from './interfaces/HumanClipRetargetOptions'/*** Bakes a swing-twist retarget of one clip from a source rig onto a target rig.diff --git a/src/retarget/human-retargeting/interfaces/HumanClipRetargetOptions.ts b/src/retarget/human-retargeting/interfaces/HumanClipRetargetOptions.tsnew file mode 100644index 0000000..5d12a67--- /dev/null+++ b/src/retarget/human-retargeting/interfaces/HumanClipRetargetOptions.ts@@ -0,0 +1,8 @@+export interface HumanClipRetargetOptions {+ // name for the baked clip. Defaults to the source clip name+ clip_name?: string+ // corrective X-axis rotation (degrees) applied to the whole target rig. See Retargeter.set_root_correction_x+ root_correction_x_degrees?: number+ // 30 fps for input animations is usually sufficient for now+ fps?: number+}diff --git a/src/retarget/interfaces/BoneRestTransform.ts b/src/retarget/interfaces/BoneRestTransform.tsnew file mode 100644index 0000000..35da9ba--- /dev/null+++ b/src/retarget/interfaces/BoneRestTransform.ts@@ -0,0 +1,8 @@+import { type Vector3, type Quaternion } from 'three'++/** A single bone's local transform, captured while the skeleton is known to be at rest. */+export interface BoneRestTransform {+ position: Vector3+ quaternion: Quaternion+ scale: Vector3+}diff --git a/src/retarget/interfaces/RestPoseSnapshot.ts b/src/retarget/interfaces/RestPoseSnapshot.tsnew file mode 100644index 0000000..015c071--- /dev/null+++ b/src/retarget/interfaces/RestPoseSnapshot.ts@@ -0,0 +1,11 @@+import { type Quaternion } from 'three'++/**+ * Rest-pose snapshot of a live skeleton, taken before any cloning or retargeting+ * happens. Used as the reference every consistency check is measured against.+ */+export interface RestPoseSnapshot {+ bone_names: string[]+ local_rotations: Quaternion[]+ world_rotations: Quaternion[]+}diff --git a/src/retarget/interfaces/RootBoneChain.ts b/src/retarget/interfaces/RootBoneChain.tsnew file mode 100644index 0000000..7ac5e27--- /dev/null+++ b/src/retarget/interfaces/RootBoneChain.ts@@ -0,0 +1,12 @@+import { type Bone, type SkinnedMesh } from 'three'++/**+ * Information about a single disconnected bone hierarchy (root bone chain)+ * found inside an imported model.+ */+export interface RootBoneChain {+ root_bone: Bone+ bone_count: number+ skinned_meshes: SkinnedMesh[]+ vertex_count: number+}diff --git a/src/retarget/interfaces/TrackNameParts.ts b/src/retarget/interfaces/TrackNameParts.tsnew file mode 100644index 0000000..85e2cd3--- /dev/null+++ b/src/retarget/interfaces/TrackNameParts.ts@@ -0,0 +1,4 @@+export interface TrackNameParts {+ bone_name: string+ property: string+}diff --git a/src/retarget/steps/StepLoadTargetModel.ts b/src/retarget/steps/StepLoadTargetModel.tsindex b4dacb1..d11ba5e 100644--- a/src/retarget/steps/StepLoadTargetModel.ts+++ b/src/retarget/steps/StepLoadTargetModel.ts@@ -1,7 +1,8 @@import { type Bone, Box3, type Scene, type SkinnedMesh, Vector3 } from 'three'import { type Mesh2MotionEngine } from '../../Mesh2MotionEngine.ts'import { ModalDialog } from '../../lib/ModalDialog.ts'-import { MultiRootSkeletonResolver, type RootBoneChain } from '../MultiRootSkeletonResolver.ts'+import { MultiRootSkeletonResolver } from '../MultiRootSkeletonResolver.ts'+import { type RootBoneChain } from '../interfaces/RootBoneChain'import { RetargetUtils } from '../RetargetUtils.ts'import { RootBoneSelectionDialog } from '../RootBoneSelectionDialog.ts'import { TargetBoneTreeDialog } from '../TargetBoneTreeDialog.ts'diff --git a/static/animpreviews/bird/dark_Death.mp4 b/static/animpreviews/bird/dark_Death.mp4new file mode 100644index 0000000..5bec54bBinary files /dev/null and b/static/animpreviews/bird/dark_Death.mp4 differdiff --git a/static/animpreviews/bird/dark_Flap.mp4 b/static/animpreviews/bird/dark_Flap.mp4index 2bf39ed..14bac30 100644Binary files a/static/animpreviews/bird/dark_Flap.mp4 and b/static/animpreviews/bird/dark_Flap.mp4 differdiff --git a/static/animpreviews/bird/dark_Glide.mp4 b/static/animpreviews/bird/dark_Glide.mp4index 79be325..0489ac7 100644Binary files a/static/animpreviews/bird/dark_Glide.mp4 and b/static/animpreviews/bird/dark_Glide.mp4 differdiff --git a/static/animpreviews/bird/dark_Hop.mp4 b/static/animpreviews/bird/dark_Hop.mp4new file mode 100644index 0000000..37ed9ebBinary files /dev/null and b/static/animpreviews/bird/dark_Hop.mp4 differdiff --git a/static/animpreviews/bird/dark_Idle.mp4 b/static/animpreviews/bird/dark_Idle.mp4index 81ff975..be154bf 100644Binary files a/static/animpreviews/bird/dark_Idle.mp4 and b/static/animpreviews/bird/dark_Idle.mp4 differdiff --git a/static/animpreviews/bird/dark_Land.mp4 b/static/animpreviews/bird/dark_Land.mp4new file mode 100644index 0000000..195ba80Binary files /dev/null and b/static/animpreviews/bird/dark_Land.mp4 differdiff --git a/static/animpreviews/bird/dark_Rest Pose.mp4 b/static/animpreviews/bird/dark_Rest Pose.mp4index 31e27a9..252a4a7 100644Binary files a/static/animpreviews/bird/dark_Rest Pose.mp4 and b/static/animpreviews/bird/dark_Rest Pose.mp4 differdiff --git a/static/animpreviews/bird/dark_Take_Off.mp4 b/static/animpreviews/bird/dark_Take_Off.mp4new file mode 100644index 0000000..8193f40Binary files /dev/null and b/static/animpreviews/bird/dark_Take_Off.mp4 differdiff --git a/static/animpreviews/bird/dark_Walk.mp4 b/static/animpreviews/bird/dark_Walk.mp4index 34375bf..a3acb26 100644Binary files a/static/animpreviews/bird/dark_Walk.mp4 and b/static/animpreviews/bird/dark_Walk.mp4 differdiff --git a/static/animpreviews/bird/light_Death.mp4 b/static/animpreviews/bird/light_Death.mp4new file mode 100644index 0000000..00be8c7Binary files /dev/null and b/static/animpreviews/bird/light_Death.mp4 differdiff --git a/static/animpreviews/bird/light_Flap.mp4 b/static/animpreviews/bird/light_Flap.mp4index d89243e..54a30a7 100644Binary files a/static/animpreviews/bird/light_Flap.mp4 and b/static/animpreviews/bird/light_Flap.mp4 differdiff --git a/static/animpreviews/bird/light_Glide.mp4 b/static/animpreviews/bird/light_Glide.mp4index 59e1176..13da66b 100644Binary files a/static/animpreviews/bird/light_Glide.mp4 and b/static/animpreviews/bird/light_Glide.mp4 differdiff --git a/static/animpreviews/bird/light_Hop.mp4 b/static/animpreviews/bird/light_Hop.mp4new file mode 100644index 0000000..9ec7ecdBinary files /dev/null and b/static/animpreviews/bird/light_Hop.mp4 differdiff --git a/static/animpreviews/bird/light_Idle.mp4 b/static/animpreviews/bird/light_Idle.mp4index 3358efa..24a3cad 100644Binary files a/static/animpreviews/bird/light_Idle.mp4 and b/static/animpreviews/bird/light_Idle.mp4 differdiff --git a/static/animpreviews/bird/light_Land.mp4 b/static/animpreviews/bird/light_Land.mp4new file mode 100644index 0000000..710c4a3Binary files /dev/null and b/static/animpreviews/bird/light_Land.mp4 differdiff --git a/static/animpreviews/bird/light_Rest Pose.mp4 b/static/animpreviews/bird/light_Rest Pose.mp4index bde7c90..fb03872 100644Binary files a/static/animpreviews/bird/light_Rest Pose.mp4 and b/static/animpreviews/bird/light_Rest Pose.mp4 differdiff --git a/static/animpreviews/bird/light_Take_Off.mp4 b/static/animpreviews/bird/light_Take_Off.mp4new file mode 100644index 0000000..515176aBinary files /dev/null and b/static/animpreviews/bird/light_Take_Off.mp4 differdiff --git a/static/animpreviews/bird/light_Walk.mp4 b/static/animpreviews/bird/light_Walk.mp4index c5057c7..7fd83f0 100644Binary files a/static/animpreviews/bird/light_Walk.mp4 and b/static/animpreviews/bird/light_Walk.mp4 differdiff --git a/static/animpreviews/spider/dark_Threat.mp4 b/static/animpreviews/spider/dark_Threat.mp4new file mode 100644index 0000000..117e592Binary files /dev/null and b/static/animpreviews/spider/dark_Threat.mp4 differdiff --git a/static/animpreviews/spider/light_Threat.mp4 b/static/animpreviews/spider/light_Threat.mp4new file mode 100644index 0000000..944bcdcBinary files /dev/null and b/static/animpreviews/spider/light_Threat.mp4 differdiff --git a/static/assets/bird/animations/hop.glb b/static/assets/bird/animations/hop.glbindex 94ab802..700f72c 100644Binary files a/static/assets/bird/animations/hop.glb and b/static/assets/bird/animations/hop.glb differdiff --git a/static/assets/human/animations/sword-attack-rm.glb b/static/assets/human/animations/sword-attack-rm.glbindex 421445d..dd550ca 100644Binary files a/static/assets/human/animations/sword-attack-rm.glb and b/static/assets/human/animations/sword-attack-rm.glb differ