Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

fixed loading bar still showing when animation bones didnt match and loading exited prematurely

Lino Emmenegger22df25e0f890
diff --git a/src/lib/processes/animations-listing/AnimationLoader.ts b/src/lib/processes/animations-listing/AnimationLoader.ts
index d0a53de..9d2bca0 100644
--- a/src/lib/processes/animations-listing/AnimationLoader.ts
+++ b/src/lib/processes/animations-listing/AnimationLoader.ts
@@ -257,7 +257,7 @@ export class AnimationLoader extends EventTarget {
throw new NoAnimationsError('No animations found in the GLB file.')
}
- // Validate bones match target skeleton
+ // Validate bones match target skeleton throws error and exits loading if not compatible
this.validate_animation_bones_match(animations, skinned_meshes)
this.file_progress_map.set(file.name, { loaded: file_total, total: file_total })
@@ -267,6 +267,11 @@ export class AnimationLoader extends EventTarget {
const processed_clips = this.process_loaded_animations(animations, skeleton_scale)
resolve(processed_clips)
} catch (error) {
+ // Emit final progress to hide the loader UI
+ this.file_progress_map.set(file.name, { loaded: file_total, total: file_total })
+ this.completed_files = 1
+ this.emit_enhanced_progress(file.name, file_total, file_total)
+
const error_message = error instanceof Error ? error.message : String(error)
if (error instanceof NoAnimationsError || error instanceof IncompatibleSkeletonError) {
reject(error)