Import a 3D Model and automatically assign and export animations
TypeScript
try to play walk animation if possible for retarget preview. if not found, play first one
Scott Petrovic67cc5600feff
diff --git a/src/retarget/RetargetAnimationPreview.ts b/src/retarget/RetargetAnimationPreview.tsindex 61760b9..45ac50e 100644--- a/src/retarget/RetargetAnimationPreview.ts+++ b/src/retarget/RetargetAnimationPreview.ts@@ -114,7 +114,10 @@ export class RetargetAnimationPreview extends EventTarget {animation_file_path,(gltf: any) => {if (gltf.animations !== null && gltf.animations !== undefined && gltf.animations.length > 0) {- this.current_animation_clip = gltf.animations[0]+ // find the "walk animation clip". every rig should have one of those.+ const walk_animation = gltf.animations.find((clip: AnimationClip) => clip.name.toLowerCase().includes('walk'))+ this.current_animation_clip = walk_animation ?? gltf.animations[0]+if (this.current_animation_clip !== null) {console.log('Loaded animation:', this.current_animation_clip.name)