Import a 3D Model and automatically assign and export animations
TypeScript
Allow ability to see selected animations before exporting
Scott Petrovicb6537fbf9082
diff --git a/src/create.html b/src/create.htmlindex 62bfde4..a5a38ed 100644--- a/src/create.html+++ b/src/create.html@@ -303,11 +303,24 @@<span id="skinned-step-animation-export-options"><div id="animations-listing">- <!-- Filter textbox for animations -->- <span style="position: relative">- <input type="text" id="animation-filter" placeholder="Filter animations...">- <div id="animation-listing-count">0</div>- </span>+ <!-- Filter textbox and tab switcher side by side -->+ <div style="display: flex; gap: 1rem; align-items: flex-start;">+ <!-- Tab switcher for Library vs Selected animations -->+ <div class="pill-switch-group" aria-label="Animation view mode" style="margin: 0;">+ <div class="pill-switch">+ <input type="radio" id="animation-view-library" name="animation-view-mode" value="library" checked />+ <label for="animation-view-library">Library</label>+ <input type="radio" id="animation-view-selected" name="animation-view-mode" value="selected" />+ <label for="animation-view-selected">Selected</label>+ </div>+ </div>++ <!-- Filter textbox for animations -->+ <span style="position: relative; flex: 1;">+ <input type="text" id="animation-filter" placeholder="Filter">+ <div id="animation-listing-count">0</div>+ </span>+ </div><!-- loading progress when animations start getting larger. -->diff --git a/src/index.html b/src/index.htmlindex dec21a0..fd78749 100644--- a/src/index.html+++ b/src/index.html@@ -106,13 +106,25 @@<span id="skinned-step-animation-export-options"><div id="animations-listing">-- <!-- Filter textbox for animations -->-- <span style="position: relative">- <input type="text" id="animation-filter" placeholder="Filter animations...">- <div id="animation-listing-count">0</div>- </span>++ <!-- Filter textbox and tab switcher side by side -->+ <div style="display: flex; gap: 1rem; align-items: flex-start;">+ <!-- Tab switcher for Library vs Selected animations -->+ <div class="pill-switch-group" aria-label="Animation view mode" style="margin: 0;">+ <div class="pill-switch">+ <input type="radio" id="animation-view-library" name="animation-view-mode" value="library" checked />+ <label for="animation-view-library">Library</label>+ <input type="radio" id="animation-view-selected" name="animation-view-mode" value="selected" />+ <label for="animation-view-selected">Selected</label>+ </div>+ </div>++ <!-- Filter textbox for animations -->+ <span style="position: relative; flex: 1;">+ <input type="text" id="animation-filter" placeholder="Filter">+ <div id="animation-listing-count">0</div>+ </span>+ </div><!-- loading progress when animations start getting larger. -->diff --git a/src/lib/processes/animations-listing/AnimationSearch.ts b/src/lib/processes/animations-listing/AnimationSearch.tsindex 27c6274..3293454 100644--- a/src/lib/processes/animations-listing/AnimationSearch.ts+++ b/src/lib/processes/animations-listing/AnimationSearch.ts@@ -14,6 +14,7 @@ export class AnimationSearch extends EventTarget {private readonly skeleton_type: SkeletonTypeprivate custom_event: CustomEvent | null = null+ private show_selected_only: boolean = falseconstructor (filter_input_id: string, animation_list_container_id: string, theme_manager: ThemeManager, skeleton_type: SkeletonType) {super()@@ -93,6 +94,12 @@ export class AnimationSearch extends EventTarget {const target = event.target as HTMLInputElementif (target?.type === 'checkbox') {this.save_current_checkbox_states()++ // If in "selected only" mode, re-render to remove unchecked animations immediately+ if (this.show_selected_only) {+ const filter_text = this.filter_input?.value.toLowerCase() ?? ''+ this.render_filtered_animations(filter_text)+ }}// emit an event to notify other parts of the application that export options have changed@@ -122,14 +129,24 @@ export class AnimationSearch extends EventTarget {return this.filtered_animations_list}+ public set_show_selected_only (show_selected: boolean): void {+ this.show_selected_only = show_selected+ const filter_text = this.filter_input?.value.toLowerCase() ?? ''+ this.render_filtered_animations(filter_text)+ }+private render_filtered_animations (filter_text: string): void {if (this.animation_list_container === null) {return}- // Filter animations based on search text+ // Filter animations based on search text and selected-only modethis.filtered_animations_list = this.all_animations.filter(animation => {- return animation.name.toLowerCase().includes(filter_text)+ const matches_search = animation.name.toLowerCase().includes(filter_text)+ if (this.show_selected_only) {+ return matches_search && animation.isChecked === true+ }+ return matches_search})// Clear and rebuild the animation listdiff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.tsindex 2b499e9..b34503d 100644--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts@@ -477,6 +477,16 @@ export class StepAnimationsListing extends EventTarget {this.play_animation(this.current_playing_index)})+ // event listener for animation view mode tabs (Library vs Selected)+ const animation_view_radios = document.querySelectorAll('input[name="animation-view-mode"]')+ animation_view_radios.forEach((radio) => {+ radio.addEventListener('change', (event) => {+ const target = event.target as HTMLInputElement+ const show_selected_only = target.value === 'selected'+ this.animation_search?.set_show_selected_only(show_selected_only)+ })+ })+// helps ensure we don't add event listeners multiple timesthis.has_added_event_listeners = true}diff --git a/src/retarget/RetargetAnimationListing.ts b/src/retarget/RetargetAnimationListing.tsindex 98439cd..7498c74 100644--- a/src/retarget/RetargetAnimationListing.ts+++ b/src/retarget/RetargetAnimationListing.ts@@ -234,6 +234,16 @@ export class RetargetAnimationListing extends EventTarget {// configure the export out step with retargeting infothis.step_export_retargeted_animations.export('retargeted_animations')})++ // event listener for animation view mode tabs (Library vs Selected)+ const animation_view_radios = document.querySelectorAll('input[name="animation-view-mode"]')+ animation_view_radios.forEach((radio) => {+ radio.addEventListener('change', (event) => {+ const target = event.target as HTMLInputElement+ const show_selected_only = target.value === 'selected'+ this.animation_search?.set_show_selected_only(show_selected_only)+ })+ })}public get_animation_player (): AnimationPlayer {diff --git a/src/retarget/index.html b/src/retarget/index.htmlindex 36af4df..b36dd8a 100644--- a/src/retarget/index.html+++ b/src/retarget/index.html@@ -140,16 +140,29 @@</div></span>- <!-- animation listings area -->+ <!-- animation listings area --><span id="skinned-step-animation-export-options"><div id="animations-listing">-- <!-- Filter textbox for animations -->- <span style="position: relative">- <input type="text" id="animation-filter" placeholder="Filter animations...">- <div id="animation-listing-count">0</div>- </span>++ <!-- Filter textbox and tab switcher side by side -->+ <div style="display: flex; gap: 1rem; align-items: flex-start;">+ <!-- Tab switcher for Library vs Selected animations -->+ <div class="pill-switch-group" aria-label="Animation view mode" style="margin: 0;">+ <div class="pill-switch">+ <input type="radio" id="animation-view-library" name="animation-view-mode" value="library" checked />+ <label for="animation-view-library">Library</label>+ <input type="radio" id="animation-view-selected" name="animation-view-mode" value="selected" />+ <label for="animation-view-selected">Selected</label>+ </div>+ </div>++ <!-- Filter textbox for animations -->+ <span style="position: relative; flex: 1;">+ <input type="text" id="animation-filter" placeholder="Filter">+ <div id="animation-listing-count">0</div>+ </span>+ </div><!-- loading progress when animations start getting larger. --><div id="animation-progress-loader-container" style="display: none">diff --git a/src/styles.css b/src/styles.cssindex 9893072..ab9036e 100644--- a/src/styles.css+++ b/src/styles.css@@ -322,7 +322,7 @@ button:disabled {display: flex;flex-wrap: wrap;align-items: center;- gap: 0.5rem;+ gap: 0;}.download-combo {@@ -457,7 +457,7 @@ option {top: var(--navigation-height);right: 0;border-left: 1px solid var(--bg-tertiary);- padding: 1.0rem;+ padding: 0.5rem;height: 100%;overflow-y: auto;overflow-x: hidden;