Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Show friendly name for animations on UI

Scott Petrovic94433cd87875
diff --git a/src/lib/AnimationPlayer.ts b/src/lib/AnimationPlayer.ts
index 7999f0d..0a4282d 100644
--- a/src/lib/AnimationPlayer.ts
+++ b/src/lib/AnimationPlayer.ts
@@ -43,6 +43,10 @@ export class AnimationPlayer {
}
}
+ public animation_name_clean (input: string): string {
+ return input.replace(/_/g, ' ')
+ }
+
public set_animation (animation_clip: AnimationClip, animation_actions: AnimationAction[]): void {
this.current_animation_clip = animation_clip
this.current_animation_actions = animation_actions
@@ -53,7 +57,7 @@ export class AnimationPlayer {
// Update UI
if (this.ui.dom_current_animation_name !== null) {
- this.ui.dom_current_animation_name.textContent = animation_clip.name
+ this.ui.dom_current_animation_name.textContent = this.animation_name_clean(animation_clip.name)
}
if (this.ui.dom_total_time !== null) {
diff --git a/src/lib/AnimationSearch.ts b/src/lib/AnimationSearch.ts
index b43e08a..eb77444 100644
--- a/src/lib/AnimationSearch.ts
+++ b/src/lib/AnimationSearch.ts
@@ -103,7 +103,7 @@ export class AnimationSearch {
this.animation_list_container.innerHTML +=
`<div class="anim-item">
<button class="secondary-button play" data-index="${original_index}">
- ${animation_clip.name}
+ ${this.animation_name_clean(animation_clip.name)}
</button>
<div class="styled-checkbox">
@@ -113,6 +113,10 @@ export class AnimationSearch {
})
}
+ public animation_name_clean (input: string): string {
+ return input.replace(/_/g, ' ')
+ }
+
public get_selected_animations (): AnimationWithState[] {
return this.all_animations.filter(animation => animation.isChecked === true)
}