Import a 3D Model and automatically assign and export animations
TypeScript
Have loading progress UI in the animation listing area
Scott Petrovic9cf736e60f4f
diff --git a/src/create.html b/src/create.htmlindex ee9410b..0d56a1d 100644--- a/src/create.html+++ b/src/create.html@@ -324,6 +324,13 @@<div id="animation-listing-count">0</div><input type="text" id="animation-filter" placeholder="Filter animations...">+ <!-- loading progress when animations start getting larger. -->+ <div id="animation-progress-loader-container" style="display: none">+ <div id="loading-status-text">Loading animation data</div>+ <div id="loading-progress-bar"></div>+ <div id="current-file-progress-bar"></div>+ </div>+<!-- javascript will populate this item with animationsthat we get from the animations file(s) -->diff --git a/src/index.html b/src/index.htmlindex f50e72c..c210623 100644--- a/src/index.html+++ b/src/index.html@@ -125,6 +125,13 @@<!-- Filter textbox for animations --><div id="animation-listing-count">0</div><input type="text" id="animation-filter" placeholder="Filter animations...">++ <!-- loading progress when animations start getting larger. -->+ <div id="animation-progress-loader-container" style="display: none">+ <div id="loading-status-text">Loading animation data</div>+ <div id="loading-progress-bar"></div>+ <div id="current-file-progress-bar"></div>+ </div><!-- javascript will populate this item with animations@@ -195,6 +202,7 @@<!-- 3d view control hit box. It is just a container to help with 3d view controls. --><div id="view-control-hitbox"></div>+<!-- build version information--><span id="build-version"></span>diff --git a/src/lib/UI.ts b/src/lib/UI.tsindex fad006e..2e83148 100644--- a/src/lib/UI.ts+++ b/src/lib/UI.ts@@ -64,6 +64,12 @@ export class UI {dom_mirror_animations_checkbox: HTMLInputElement | null = nulldom_reset_a_pose_button: HTMLButtonElement | null = null+ // loading progress UI controls for animations+ dom_animation_progress_loader_container: HTMLElement | null = null+ dom_loading_progress_bar: HTMLElement | null = null+ dom_current_file_progress_bar: HTMLElement | null = null+ dom_loading_status_text: HTMLElement | null = null+// Animation player controlsdom_animation_player: HTMLElement | null = nulldom_current_animation_name: HTMLElement | null = null@@ -166,6 +172,12 @@ export class UI {this.dom_mirror_animations_checkbox = document.querySelector('#mirror-animations-checkbox')this.dom_reset_a_pose_button = document.querySelector('#reset-a-pose-button')+ // loading progress UI controls for animations+ this.dom_animation_progress_loader_container = document.querySelector('#animation-progress-loader-container')+ this.dom_loading_progress_bar = document.querySelector('#loading-progress-bar')+ this.dom_current_file_progress_bar = document.querySelector('#current-file-progress-bar')+ this.dom_loading_status_text = document.querySelector('#loading-status-text')+// Animation player controlsthis.dom_animation_player = document.querySelector('#animation-player')this.dom_current_animation_name = document.querySelector('#current-animation-name')diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.tsindex 54f531c..3aa9aeb 100644--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts@@ -175,37 +175,35 @@ export class StepAnimationsListing extends EventTarget {}private onAnimationLoadProgress (progress: AnimationLoadProgress): void {- // Enhanced progress logging with granular information- console.log(`Loading animations: ${progress.percentage}% (${progress.loaded}/${progress.total} files completed)`)-- if (progress.currentFile !== '' && progress.currentFileTotal > 0) {- const file_name = progress.currentFile.split('/').pop() ?? progress.currentFile- console.log(` Current file: ${file_name} - ${progress.currentFileProgress}%`)- }-- if (progress.overallBytesTotal > 0) {- const mb_loaded = (progress.overallBytesLoaded / (1024 * 1024)).toFixed(1)- const mb_total = (progress.overallBytesTotal / (1024 * 1024)).toFixed(1)- console.log(` Bytes: ${mb_loaded}MB / ${mb_total}MB`)- }-- // TODO: Update UI progress bars if you have them- // You can add these DOM elements to your UI and uncomment these lines- /*- if (this.ui.dom_loading_progress_bar) {+ if (this.ui.dom_loading_progress_bar !== null) {this.ui.dom_loading_progress_bar.style.width = `${progress.percentage}%`- this.ui.dom_loading_progress_bar.textContent = `${progress.percentage}%`++ const mb_loaded: string = (progress.overallBytesLoaded / (1024 * 1024)).toFixed(1)+ const mb_total: string = (progress.overallBytesTotal / (1024 * 1024)).toFixed(1)+ this.ui.dom_loading_progress_bar.textContent = `${mb_loaded} / ${mb_total} MB`}- if (this.ui.dom_current_file_progress_bar) {+ if (this.ui.dom_current_file_progress_bar !== null) {this.ui.dom_current_file_progress_bar.style.width = `${progress.currentFileProgress}%`}- if (this.ui.dom_loading_status_text && progress.currentFile !== '') {- const file_name = progress.currentFile.split('/').pop() ?? progress.currentFile- this.ui.dom_loading_status_text.textContent = `Loading ${file_name}...`+ // if we are done loading, we can hide the container+ if (progress.percentage >= 100) {+ if (this.ui.dom_animation_progress_loader_container !== null) {+ this.ui.dom_animation_progress_loader_container.style.display = 'none'+ }+ } else {+ // make sure it is visible while loading+ if (this.ui.dom_animation_progress_loader_container !== null) {+ this.ui.dom_animation_progress_loader_container.style.display = 'flex'+ }}- */++ // can potentially shows file name loading...not sure if we need to actually show this.+ // if (this.ui.dom_loading_status_text !== null && progress.currentFile !== '') {+ // const file_name = progress.currentFile.split('/').pop() ?? progress.currentFile+ // this.ui.dom_loading_status_text.textContent = `Loading ${file_name}...`+ // }}private update_filtered_animation_listing_ui (): void {diff --git a/src/styles.css b/src/styles.cssindex b7456cc..d2dc4fb 100644--- a/src/styles.css+++ b/src/styles.css@@ -601,4 +601,35 @@ input[type="file"] {padding: 0.5rem 0.7rem;font-size: 0.8rem;color: var(--text-alternate);+}++/* loading progress bar for animations */+#animation-progress-loader-container {+ flex-direction: column;+ align-items: center;+ gap: 0;+ width: 100%;+ margin-bottom: 1rem;+}+#animation-progress-loader-container #loading-progress-bar {+ width: 0%;+ height: 8px;+ background-color: var(--button-primary-bg);+ transition: width 0.3s ease;+ justify-content: center;+ display: flex;+ height: auto;+ border: 1px solid grey;+}+#animation-progress-loader-container #current-file-progress-bar {+ width: 0%;+ height: 4px;+ background-color: var(--button-alternate-bg);+ transition: width 0.3s ease;+ margin-top: 2px;+ border: 1px solid grey;+}+#animation-progress-loader-container #loading-status-text {+ font-size: 1.1rem;+ color: var(--text-primary);}\ No newline at end of file