Import a 3D Model and automatically assign and export animations
TypeScript
Reduce items being set in import constructor since we set elsewhere
Scott Petrovicf88bfbd4a953
diff --git a/src/lib/processes/animations-listing/CustomAnimationImporter.ts b/src/lib/processes/animations-listing/CustomAnimationImporter.tsindex 12c4645..0d94943 100644--- a/src/lib/processes/animations-listing/CustomAnimationImporter.ts+++ b/src/lib/processes/animations-listing/CustomAnimationImporter.ts@@ -13,22 +13,16 @@ import { type TransformedAnimationClipPair } from './interfaces/TransformedAnimaexport class CustomAnimationImporter extends EventTarget {private readonly ui: UIprivate readonly animation_loader: AnimationLoader- private skinned_meshes_to_animate: SkinnedMesh[]- private skeleton_scale: number+ private skinned_meshes_to_animate: SkinnedMesh[] = []+ private skeleton_scale: number = 1.0private import_context_provider: (() => { skinned_meshes_to_animate: SkinnedMesh[], skeleton_scale: number }) | null = nullprivate enabled: boolean = trueprivate has_added_event_listeners: boolean = false- constructor (- animation_loader: AnimationLoader,- skinned_meshes_to_animate: SkinnedMesh[],- skeleton_scale: number- ) {+ constructor (animation_loader: AnimationLoader) {super()this.ui = UI.getInstance()this.animation_loader = animation_loader- this.skinned_meshes_to_animate = skinned_meshes_to_animate- this.skeleton_scale = skeleton_scalethis.add_event_listeners()}@@ -120,6 +114,7 @@ export class CustomAnimationImporter extends EventTarget {)// Validate custom animations against our target skeleton+ const animation_clip_names_imported = new_animation_clips.map(clip_pair => clip_pair.display_animation_clip.name).join(', ')const clips_to_validate: AnimationClip[] = new_animation_clips.map((clip_pair) => clip_pair.display_animation_clip)CustomAnimationValidation.validate_animation_bones_match(clips_to_validate, this.skinned_meshes_to_animate)@@ -131,7 +126,7 @@ export class CustomAnimationImporter extends EventTarget {const animation_word = animation_count === 1 ? 'animation' : 'animations'new ModalDialog('Import Success',- `${animation_count} ${animation_word} Imported successfully`+ `${animation_count} ${animation_word} Imported successfully: ${animation_clip_names_imported}`).show()return { success: true, clipCount: new_animation_clips.length }@@ -171,8 +166,4 @@ export class CustomAnimationImporter extends EventTarget {return 'Bone names don\'t match'}-- private validate_loaded_animation_clips (new_animation_clips: TransformedAnimationClipPair[]): void {-- }}diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.tsindex 42f0bd1..ac154fd 100644--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts@@ -62,11 +62,7 @@ export class StepAnimationsListing extends EventTarget {this.animation_player = new AnimationPlayer()this.theme_manager = theme_manager- this.custom_animation_importer = new CustomAnimationImporter(- this.animation_loader,- this.skinned_meshes_to_animate,- this.skeleton_scale- )+ this.custom_animation_importer = new CustomAnimationImporter(this.animation_loader)// fancy way to bind the import context by implementing the function// from the CustomAnimationImporter and passing in the current context values. this allows