Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Add an import button and stub out event listener to handle it

Scott Petrovic66c3245112e2
diff --git a/src/index.html b/src/index.html
index f7194d3..b1c851c 100644
--- a/src/index.html
+++ b/src/index.html
@@ -135,7 +135,7 @@
<div id="animations-listing">
<div id="animations-listing-header">
- <div>Animations</div>
+ <span>Animations</span>
<div>Export</div>
</div>
@@ -143,8 +143,28 @@
that we get from the animations file(s) -->
<div id="animations-items"> </div>
- <button id="export-button">Export to GLB</button>
- <a id="download-hidden-link" href="#" style="display:none"></a>
+ <div style="display: flex; column-gap: 10px; justify-content: center;">
+
+ <button id="import-animations-button" class="secondary-button" style="margin: 0;">
+ <span class="button-icon-group">
+ <span class="material-symbols-outlined">add</span>
+ <span>Import</span>
+ </span>
+ </button>
+
+
+ <button id="export-button">
+ <span class="button-icon-group">
+ <span class="material-symbols-outlined">save_alt</span>
+ <span>Download</span>
+ </span>
+ </button>
+ <a id="download-hidden-link" href="#" style="display:none"></a>
+
+
+ </div>
+
+
</div>
diff --git a/src/lib/UI.js b/src/lib/UI.js
index 8656018..931d836 100644
--- a/src/lib/UI.js
+++ b/src/lib/UI.js
@@ -42,6 +42,7 @@ export class UI {
this.dom_animation_clip_list = document.querySelector('#animations-items')
this.dom_export_button = document.querySelector('#export-button')
this.dom_info_panel = document.querySelector('#info-messaging')
+ this.dom_import_animations_button = document.querySelector('#import-animations-button')
// UI for exporting the animation
this.dom_export_button_hidden_link = document.querySelector('#download-hidden-link')
diff --git a/src/lib/processes/StepAnimationsListing.js b/src/lib/processes/StepAnimationsListing.js
index d9de43d..80fc26d 100644
--- a/src/lib/processes/StepAnimationsListing.js
+++ b/src/lib/processes/StepAnimationsListing.js
@@ -35,7 +35,7 @@ export class StepAnimationsListing extends EventTarget
return `<div>Instructions</div>
<div>Test and export animations to GLB format</div>
<ol>
- <li>Only GLTF files can be exported</li>
+ <li>Only GLB files can be exported</li>
<li>Go back to edit skeleton if results don't look right</li>
<li>Select animations you want to export by checking them by animation</li>
</ol>`;
@@ -51,6 +51,21 @@ export class StepAnimationsListing extends EventTarget
this._play_animation(animation_index);
}
});
+
+
+ this.ui.dom_import_animations_button.addEventListener('click', () => {
+ console.log('Nbring up file dialog to import animations')
+
+ // bring up file dialog to import animattions file (just support GLB for now)
+
+ // parse through the file and extract the animations
+
+ // make sure the animations are compatible with the skeleton
+
+ // add the animations to the animation_clips_loaded
+
+ });
+
}
_play_animation(index = 0)
diff --git a/src/styles.css b/src/styles.css
index 9971442..9687163 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -207,6 +207,7 @@ option {
#animations-listing-header {
justify-content: space-between;
display: flex;
+ align-items: center;
}