Import a 3D Model and automatically assign and export animations
TypeScript
many rig config options only relate to human, so just check those directly instead of being in config
Scott Petrovic45a7bd5e68c7
diff --git a/src/Mesh2MotionEngine.ts b/src/Mesh2MotionEngine.tsindex e599dc4..3cb2c59 100644--- a/src/Mesh2MotionEngine.ts+++ b/src/Mesh2MotionEngine.ts@@ -218,8 +218,7 @@ export class Mesh2MotionEngine {public update_a_pose_options_visibility (): void {if (this.ui.dom_arm_extension_options != null) {- const config = RigConfig.by_skeleton_type(this.load_skeleton_step.skeleton_type())- if (config?.has_arm_extension === true) {+ if (this.load_skeleton_step.skeleton_type() === SkeletonType.Human) {this.ui.dom_arm_extension_options.style.display = 'block'} else {this.ui.dom_arm_extension_options.style.display = 'none'diff --git a/src/lib/RigConfig.ts b/src/lib/RigConfig.tsindex ffa3326..823bd54 100644--- a/src/lib/RigConfig.ts+++ b/src/lib/RigConfig.ts@@ -8,10 +8,7 @@ export interface RigConfigEntry {rig_display_name: string // Display name shown in both the model and skeleton dropdownsanimation_files: string[] // Animation filenames (no base path) loaded for this rig typeanimation_preview_folder: string // Sub-folder name used when referencing animation preview thumbnails- has_hand_options: boolean // Only Human has per-finger hand skeleton options- has_head_weight_correction: boolean // Only Human shows the head weight correction panel- has_arm_extension: boolean // Only Human shows the arm expand/contract slider- // The bone used for position tracking (e.g., 'hips' or 'head').+ // 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: stringmodel_variations?: ModelVariation[] // similar models (human, zombie, etc)@@ -41,9 +38,6 @@ export class RigConfig {rig_display_name: 'Human',animation_files: ['../animations/human-base-animations.glb', '../animations/human-addon-animations.glb'],animation_preview_folder: 'human',- has_hand_options: true,- has_head_weight_correction: true,- has_arm_extension: true,position_tracking_bone_name: 'pelvis',model_variations: humanVariations} satisfies RigConfigEntry,@@ -54,9 +48,6 @@ export class RigConfig {rig_display_name: 'Fox',animation_files: ['../animations/fox-animations.glb'],animation_preview_folder: 'fox',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'hips',model_variations: foxVariations} satisfies RigConfigEntry,@@ -67,9 +58,6 @@ export class RigConfig {rig_display_name: 'Bird',animation_files: ['../animations/bird-animations.glb'],animation_preview_folder: 'bird',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'hips',model_variations: birdVariations} satisfies RigConfigEntry,@@ -80,9 +68,6 @@ export class RigConfig {rig_display_name: 'Dragon',animation_files: ['../animations/dragon-animations.glb'],animation_preview_folder: 'dragon',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'hips',} satisfies RigConfigEntry,{@@ -92,9 +77,6 @@ export class RigConfig {rig_display_name: 'Kaiju',animation_files: ['../animations/kaiju-animations.glb'],animation_preview_folder: 'kaiju',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'hips',model_variations: kaijuVariations} satisfies RigConfigEntry,@@ -105,9 +87,6 @@ export class RigConfig {rig_display_name: 'Spider',animation_files: ['../animations/spider-animations.glb'],animation_preview_folder: 'spider',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'hips',} satisfies RigConfigEntry,{@@ -117,9 +96,6 @@ export class RigConfig {rig_display_name: 'Snake',animation_files: ['../animations/snake-animations.glb'],animation_preview_folder: 'snake',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'head', // snake doesn't have hips, so we track position from the head instead} satisfies RigConfigEntry,{@@ -129,9 +105,6 @@ export class RigConfig {rig_display_name: 'Fish',animation_files: ['../animations/shark-animations.glb'],animation_preview_folder: 'shark',- has_hand_options: false,- has_head_weight_correction: false,- has_arm_extension: false,position_tracking_bone_name: 'pelvis',model_variations: fishVariations} satisfies RigConfigEntrydiff --git a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts b/src/lib/processes/edit-skeleton/StepEditSkeleton.tsindex 019e665..12d0de5 100644--- a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts+++ b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts@@ -104,8 +104,7 @@ export class StepEditSkeleton extends EventTarget {// keep track of skeleton type to show/hide certain UI elements// only human skeletons have the head weight correction optionif (this.ui.dom_use_head_weight_correction_container != null) {- const config = RigConfig.by_skeleton_type(skeleton_type)- if (config?.has_head_weight_correction === true) {+ if (skeleton_type === SkeletonType.Human) {this.ui.dom_use_head_weight_correction_container.style.display = 'block'} else {this.ui.dom_use_head_weight_correction_container.style.display = 'none'diff --git a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts b/src/lib/processes/load-skeleton/StepLoadSkeleton.tsindex d5d6b9b..fed2aa2 100644--- a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts+++ b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts@@ -290,8 +290,7 @@ export class StepLoadSkeleton extends EventTarget {return}- const config = RigConfig.by_skeleton_type(this.skeleton_file_path())- if (config?.has_hand_options === true) {+ if (this.skeleton_file_path() === SkeletonType.Human) {this.ui.dom_hand_skeleton_options.style.display = 'flex'} else {this.ui.dom_hand_skeleton_options.style.display = 'none'