Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Update src/lib/processes/animations-listing/StepAnimationsListing.ts

Lino Emmeneggere01106029fdc
diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.ts
index 35d2489..5670a8b 100644
--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts
+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts
@@ -415,23 +415,17 @@ export class StepAnimationsListing extends EventTarget {
this.animation_clips_loaded = []
this.animation_mixer = new AnimationMixer(new Object3D())
- // Process the custom animations through the same pipeline
- const cloned_anims: AnimationClip[] = AnimationUtility.deep_clone_animation_clips(animations)
-
- // Clean track data
- AnimationUtility.clean_track_data(cloned_anims)
-
- // Apply skeleton scaling
- AnimationUtility.apply_skeleton_scale_to_position_keyframes(cloned_anims, this.skeleton_scale)
-
- // Add to animation clips loaded
- this.animation_clips_loaded.push(...cloned_anims.map(clip => ({
- original_animation_clip: clip,
- display_animation_clip: AnimationUtility.deep_clone_animation_clip(clip)
- })))
+ // Process the custom animations through the same centralized pipeline
+ const processed_animations = this.animation_loader.process_loaded_animations(
+ animations,
+ this.skeleton_scale
+ )
- console.log(`Loaded ${this.animation_clips_loaded.length} custom animations`)
+ this.animation_clips_loaded.push(...processed_animations)
+ // Ensure custom animations go through the same post-processing steps
+ this.apply_rest_pose_rotation_corrections()
+ this.rebuild_warped_animations()
this.onAllAnimationsLoaded()
this.play_animation(0)
}