Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

small refactor. Fix t-rex file name for model variation

Scott Petrovicf50f7e69475d
diff --git a/src/lib/RigConfig.ts b/src/lib/RigConfig.ts
index 551bad5..a6380d2 100644
--- a/src/lib/RigConfig.ts
+++ b/src/lib/RigConfig.ts
@@ -1,5 +1,5 @@
import { SkeletonType } from './enums/SkeletonType'
-import { humanVariations, foxVariations, birdVariations, kaijuVariations, fishVariations } from './ModelVariations'
+import { humanVariations, foxVariations, birdVariations, kaijuVariations, fishVariations, ModelVariation } from './RigModelVariations'
export interface RigConfigEntry {
skeleton_type: SkeletonType // The SkeletonType enum member for this rig
@@ -14,15 +14,6 @@ export interface RigConfigEntry {
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'
- preview_image: string // Preview image path relative to the static root, shown in the variation selection dialog
- license: string // License string for this model variation, e.g. 'CC0', 'CC-SA 4.0'
-
-}
-
/**
* Single source of truth for every supported rig type.
* To add a new rig, append one entry to `RigConfig.all` and add the
diff --git a/src/lib/ModelVariations.ts b/src/lib/RigModelVariations.ts
similarity index 82%
rename from src/lib/ModelVariations.ts
rename to src/lib/RigModelVariations.ts
index d8dfb2d..3872073 100644
--- a/src/lib/ModelVariations.ts
+++ b/src/lib/RigModelVariations.ts
@@ -1,5 +1,3 @@
-import { ModelVariation } from './RigConfig'
-
interface VariationSpec {
variant: string
displayName: string
@@ -7,6 +5,15 @@ interface VariationSpec {
license?: string
}
+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'
+ preview_image: string // Preview image path relative to the static root, shown in the variation selection dialog
+ license: string // License string for this model variation, e.g. 'CC0', 'CC-SA 4.0'
+
+}
+
function createVariation(type: string, spec: VariationSpec): ModelVariation {
return {
model_file: `models-variation/${type}-${spec.variant}.glb`, // all variations are in the same folder for now
diff --git a/static/models-variation/kaiju-trex.glb b/static/models-variation/kaiju-t-rex.glb
similarity index 100%
rename from static/models-variation/kaiju-trex.glb
rename to static/models-variation/kaiju-t-rex.glb