Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

adding model variation to config as well as a couple human GLB files

Scott Petrovicf89484f05ef9
diff --git a/src/index.html b/src/index.html
index 2ab34fd..d2f95ee 100644
--- a/src/index.html
+++ b/src/index.html
@@ -126,6 +126,14 @@
</span>
+ <!-- model variation switcher-->
+ <div id="model-variation-switcher">
+ <span>Model variation:</span>
+ <select id="model-variation-selection">
+ <!-- populated dynamically from RigConfig -->
+ </select>
+ </div>
+
<span id="skinned-step-animation-export-options">
<div id="animations-listing">
diff --git a/src/lib/RigConfig.ts b/src/lib/RigConfig.ts
index f3c4872..cf66236 100644
--- a/src/lib/RigConfig.ts
+++ b/src/lib/RigConfig.ts
@@ -13,6 +13,13 @@ export interface RigConfigEntry {
// 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
+ model_variations?: ModelVariation[] // similar models (human, zombie, etc)
+}
+
+export interface ModelVariation {
+ model_file: string // Model file path relative to the static root, e.g. 'models/model-human-a-pose.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'
}
/**
@@ -34,6 +41,18 @@ export class RigConfig {
has_head_weight_correction: true,
has_arm_extension: true,
position_tracking_bone_name: 'pelvis',
+ model_variations: [
+ {
+ model_file: 'models-variation/human-base.glb',
+ display_name: 'Mannequin',
+ attribution: 'Model by Quaternius, CC0-licensed'
+ } satisfies ModelVariation,
+ {
+ model_file: 'models-variation/human-zombie.glb',
+ display_name: 'Zombie',
+ attribution: 'Model by Kenney.nl, CC0-licensed'
+ } satisfies ModelVariation
+ ]
} satisfies RigConfigEntry,
{
skeleton_type: SkeletonType.Fox,
diff --git a/static/models-variation/human-base.glb b/static/models-variation/human-base.glb
new file mode 100644
index 0000000..c9ce887
Binary files /dev/null and b/static/models-variation/human-base.glb differ
diff --git a/static/models-variation/human-zombie.glb b/static/models-variation/human-zombie.glb
new file mode 100644
index 0000000..55e9045
Binary files /dev/null and b/static/models-variation/human-zombie.glb differ