Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Start building out new marketing page for using app with only reference models

Scott Petrovic880034a3330c
diff --git a/src/marketing/MarketingBootstrap.ts b/src/marketing/MarketingBootstrap.ts
new file mode 100644
index 0000000..544dad8
--- /dev/null
+++ b/src/marketing/MarketingBootstrap.ts
@@ -0,0 +1,46 @@
+export class MarketingBootstrap {
+ constructor () {
+ this.add_event_listners()
+ }
+
+ public setup_model_buttons (): void {
+ // add click events for each button type
+ const human_button = document.getElementById('load-human-model-button')
+ const fox_button = document.getElementById('load-fox-model-button')
+ const bird_button = document.getElementById('load-bird-model-button')
+ const dragon_button = document.getElementById('load-dragon-model-button')
+
+ // <option value="models/model-human.glb">Human</option>
+ // <option value="models/model-fox.glb">Fox</option>
+ // <option value="models/model-bird.glb">Bird</option>
+ // <option value="models/model-dragon.glb">Dragon</option>
+
+ if (human_button != null) {
+ human_button?.addEventListener('click', () => {
+ console.log('Human model button clicked')
+ })
+ }
+
+ fox_button?.addEventListener('click', () => {
+ console.log('Fox model button clicked')
+ })
+
+ bird_button?.addEventListener('click', () => {
+ console.log('Bird model button clicked')
+ })
+
+ dragon_button?.addEventListener('click', () => {
+ console.log('Dragon model button clicked')
+ })
+ }
+
+ public add_event_listners (): void {
+ // event after the DOM is fully loaded for HTML elements
+ document.addEventListener('DOMContentLoaded', () => {
+ this.setup_model_buttons()
+ })
+ }
+}
+
+// instantiate the class to setup event listeners
+const app = new MarketingBootstrap()
diff --git a/src/marketing/index.html b/src/marketing/index.html
new file mode 100644
index 0000000..c10e13c
--- /dev/null
+++ b/src/marketing/index.html
@@ -0,0 +1,349 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+ <title style="display: none">Mesh2Motion Introduction</title>
+ <link rel="icon" type="image/png" href="../images/favicon.png"/>
+ <link rel="shortcut icon" type="image/x-icon" href="../favicon.ico" />
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+</head>
+<body style="margin: 0">
+ <!-- Script files-->
+ <script type="module" src="../script.ts"></script>
+ <script type="module" src="./MarketingBootstrap.ts"></script>
+
+ <!-- Stylesheets-->
+ <link href="../styles.css" rel="stylesheet" crossorigin="anonymous" />
+ <link rel="stylesheet" href="../radio-button-group.css" crossorigin="anonymous" />
+ <link rel="stylesheet" href="../animation-player.css" crossorigin="anonymous" />
+ <link rel="stylesheet" href="../dialog.css" crossorigin="anonymous" />
+ <link rel="stylesheet" href="./marketing.css" crossorigin="anonymous" />
+
+ <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
+
+ <!-- Top toolbar with mouse controls -->
+ <div id="header-ui">
+
+
+ <div >
+ <a href="https://mesh2motion.org"><img src="../images/mesh2motion.svg" width="200" style="vertical-align: middle;"/></a>
+ </div>
+
+ <div style="margin-left: 3rem">
+ <img src="../images/mouse-left.svg" height="30" width="30" style="vertical-align: middle;"/> Rotate
+ </div>
+
+ <div>
+ <img src="../images/mouse-right.svg" height="30" width="30" style="vertical-align: middle;"/> Pan
+ </div>
+ <div>
+ <img src="../images/mouse-middle.svg" height="30" width="30" style="vertical-align: middle;"/> Zoom
+ </div>
+ </div>
+
+ <!-- Theme Toggle -->
+ <div id="theme-toggle-container">
+ <button id="theme-toggle">
+ <!-- icon will fill in here-->
+ <span class="theme-icon"></span>
+ </button>
+ </div>
+
+
+
+ <div class="model-selection-section">
+ <p style="margin: 0">Reference model:</p>
+ <button id="load-human-model-button">Human</button>
+ <button id="load-fox-model-button">Fox</button>
+ <button id="load-bird-model-button">Bird</button>
+ <button id="load-dragon-model-button">Dragon</button>
+ </div>
+
+
+ <div id="tool-panel">
+ <!-- create a radio button group. There are two options. Move Skeleton, Rotate Mesh -->
+ <div id="tool-selection-group">
+
+ <div style="margin-bottom: 1rem; padding: 0;">
+ <span id="current-step-index"></span>
+ <span id="current-step-label"></span>
+ </div>
+
+ <div id="load-model-tools">
+
+ <!-- <p class="step-instructions">Supports GLB, GLTF, FBX</p> -->
+
+ <label for="model-upload" class="button" data-tippy-content="GLB and FBX preferred. ZIP is for GLTF+BIN and textures separately. DAE+textures is also supported in ZIP format." >
+ <span class="button-icon-group">
+ <span class="material-symbols-outlined" >upload</span>
+ <span>Upload</span>
+ <span class="material-symbols-outlined" >help</span>
+ </span>
+ </label>
+ <input id="model-upload" type="file" name="file-upload" accept=".glb, .zip, .fbx" />
+
+
+ <div class="styled-checkbox">
+
+ <input type="checkbox" id="load-model-debug-checkbox" name="load-model-debug-checkbox">
+ <label for="load-model-debug-checkbox">Debug</label>
+
+ <span class="material-symbols-outlined" data-tippy-content="Replaces all materials with a 'normal' shader for debugging">help</span>
+
+ </div>
+
+ </div>
+
+ <div id="load-skeleton-tools">
+
+ <span>
+ <span style="max-width: 220px">Rotate Model to face front <br/> (blue origin line)</span>
+ <div style="display: flex; flex-direction: row">
+ <button class="secondary-button" id="rotate-model-x-button">X</button>
+ <button class="secondary-button" id="rotate-model-y-button">Y</button>
+ <button class="secondary-button" id="rotate-model-z-button">Z</button>
+ </div>
+ </span>
+
+ <hr />
+
+ <span style="max-width: 220px">
+ <span>If model is below the ground floor</span>
+ <div style="display: flex; flex-direction: row">
+ <button class="secondary-button" id="move-model-to-floor-button">Move</button>
+ </div>
+ </span>
+
+ <hr />
+
+
+ <div style="display: flex; flex-direction: column; gap: 1rem;">
+ <span>Skeleton template:</span>
+ <select id="skeleton-selection">
+ <option value="select-skeleton">Select a skeleton</option>
+ <option value="human">Human</option>
+ <option value="quadraped">4 Leg Creature</option>
+ <option value="bird">Bird</option>
+ <option value="dragon">Dragon</option>
+ </select>
+ </div>
+
+
+ <!-- Hand skeleton options for human skeleton -->
+ <div id="hand-skeleton-options" class="alternate-background-section" >
+
+ <span>
+ Hand Options:
+ <span class="material-symbols-outlined" data-tippy-content="Variations on which finger bones you want to keep. Single Hand Bone removes all fingers and keeps only the hand bone.">help</span>
+ </span>
+
+ <select id="hand-skeleton-selection">
+ <option value="all-fingers">All Fingers</option>
+ <option value="thumb-and-index">Thumb + Main Finger</option>
+ <option value="simplified-hand">All Fingers - Simplified</option>
+ <option value="single-bone">Single Hand Bone</option>
+ </select>
+ </div>
+
+
+ <!-- scale skeleton to get it close to the model size -->
+ <div id="scale-skeleton-controls" style="display: none; flex-direction: column;">
+ <div style="display: flex; flex-direction: row; align-items: center;">
+ <label style="display:inline-flex">Scale skeleton</label>
+ <span class="material-symbols-outlined" data-tippy-content="Adjust the overall scale of the skeleton">help</span>
+ </div>
+ <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">
+ <span id="scale-skeleton-percentage-display">100%</span>
+ <input id="scale-skeleton-input" style="flex-grow: 1;" type="range" min=".20" max="1.80" value="1.0" step="0.01" />
+ </div>
+ </div>
+
+
+ <div style="display: flex; gap: 0.5rem;">
+ <button class="secondary-button" id="action_back_to_load_model" >&#x2039; Back</button>
+ <button id="load-skeleton-button">Edit Skeleton &nbsp;&#x203a;</button>
+ </div>
+
+
+ </div>
+
+
+ <span id="skeleton-step-actions">
+
+ <!-- undo/redo system-->
+ <fieldset style="position: fixed; right: 240px; top: 20px;">
+ <div style="display: flex; gap: 2px;">
+ <button id="undo-button" class="secondary-button" title="Undo (Ctrl+Z)" disabled>
+ <img src="../images/icons/undo.png" alt="Undo" width="16" height="16" />
+ </button>
+ <button id="redo-button" class="secondary-button" title="Redo (Ctrl+Y)" disabled>
+ <img src="../images/icons/redo.png" alt="Redo" width="16" height="16" />
+ </button>
+ </div>
+ </fieldset>
+
+ <!-- <p class="step-instructions">Move bones into position.</p> -->
+
+ <p id="bone-selection-section">
+ <span>Selected Bone: <span id="edit-selected-bone-label">None</span></span>
+ </p>
+
+ <!-- controls to change transfrom mode between transform and rotation -->
+ <div style="display: flex; flex-direction: row;">
+
+ <!-- View mode between textured mesh and weight painted mesh preview -->
+ <fieldset>
+ <span>Preview</span>
+ <div id="mesh-preview-group" class="toggle">
+ <input id="preview-painted" type="radio" name="mesh-preview-type" value="weight-painted" checked="checked" />
+ <label for="preview-painted">
+ <img src="../images/icons/display-weight-painted.svg" alt="Weights" width="20" height="20" title="Weight painted mesh" />
+ </label>
+ <input id="preview-textured" type="radio" name="mesh-preview-type" value="textured" />
+ <label for="preview-textured">
+ <img src="../images/icons/display-textured.svg" alt="Textured" width="20" height="20" title="Textured Mesh" />
+ </label>
+
+ </div>
+ </fieldset>
+
+ <fieldset>
+ <span>Transform</span>
+ <div id="transform-control-type-group" class="toggle">
+ <input type="radio" name="transform-control-type" value="translate" id="transform-translate" checked="checked" />
+ <label for="transform-translate">
+ <img src="../images/icons/tool-move.svg" alt="Translate" width="20" height="20" title="Translation" />
+ </label>
+ <input type="radio" name="transform-control-type" value="rotation" id="transform-rotate" />
+ <label for="transform-rotate">
+ <img src="../images/icons/tool-rotate.svg" alt="Rotate" width="20" height="20" title="Rotation" />
+ </label>
+ </div>
+ </fieldset>
+ </div>
+
+
+
+
+ <div class="styled-checkbox">
+ <input type="checkbox" id="mirror-skeleton" name="mirror-skeleton" value="mirror" checked>
+ <label for="mirror-skeleton">Mirror Left/Right Joints</label>
+ </div>
+
+ <hr />
+
+ <!-- option to change out skinning algorithm -->
+ <label style="display: none" for="skinning-algorithm-options">Skinning algorithm:</label>
+ <select style="display: none" id="skinning-algorithm-options">
+ <option value="closest-distance-targeting">Closest Distance Targeting</option>
+ <option value="closest-bone">Closest Bone</option>
+ <option value="closest-bone-child">Closest Distance Child</option>
+ </select>
+
+
+ <!-- back to load skeleton -->
+ <div class="display: flex; gap: 0.5rem;">
+ <button class="secondary-button" id="action_back_to_load_skeleton" >&#x2039; Back</button>
+ <button id="action_bind_pose" >Bind pose</button>
+ </div>
+
+ </span>
+
+ <span id="skinned-step-animation-export-options">
+
+ <div id="animations-listing">
+
+ <!-- Filter textbox for animations -->
+ <div id="animation-listing-count">0</div>
+ <input type="text" id="animation-filter" placeholder="Filter animations...">
+
+
+ <!-- javascript will populate this item with animations
+ that we get from the animations file(s) -->
+ <div id="animations-items"> </div>
+
+
+ <!-- slider to control arm extension (hide this feature until the base functionality is more stable) -->
+ <div id="a-pose-correction-options">
+ <div style="display: flex; flex-direction: row; align-items: center;">
+ <label style="display:inline-flex">A-Pose Correction - Open Arms</label>
+ <span class="material-symbols-outlined" data-tippy-content="If your model uses an A-Pose, this will help expand/contract arms for all animations">help</span>
+ </div>
+
+ <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">
+ <input type="number" id="extend-arm-numeric-input" name="arm-extend-input" value="0" min="-50" max="75" step="1">
+ <span class="suffix-unit">%</span>
+ <input id="extend-arm-range-input" style="flex-grow: 1;" type="range" min="-50" max="75" value="0" />
+ </div>
+
+ <hr />
+
+ </div>
+
+ <!-- checkbox option to show skeleton -->
+ <div class="styled-checkbox icon-toggle">
+ <input type="checkbox" id="show-skeleton-checkbox" name="show-skeleton" value="show" style="display:none;">
+ <label for="show-skeleton-checkbox" title="Show skeleton" tabindex="0">
+ <img src="../images/icons/bone-display.svg" width="30" height="30" alt="Show skeleton" />
+ </label>
+ </div>
+
+
+
+ <div style="display: flex; gap: 0.5rem;">
+ <button class="secondary-button" id="action_back_to_edit_skeleton" >&#x2039; Back</button>
+
+ <button id="export-button" title="Export animations. Make sure to select the animations you want to export first.">
+ <span class="button-icon-group">
+ <span class="material-symbols-outlined">save_alt</span>
+ <span>Download <span id="animation-selection-count">0</span></span>
+ </span>
+ </button>
+ <a id="download-hidden-link" href="#" style="display:none"></a>
+ </div>
+
+
+
+ </div>
+
+
+ </span>
+
+
+ </div>
+
+ </div> <!-- end tool-panel-->
+
+ <!-- Free-floating Animation Player -->
+ <div id="animation-player">
+ <div id="current-animation-container">
+ <span id="current-animation-name">No animation selected</span>
+ </div>
+ <div id="play-controls">
+ <button id="play-pause-button" class="animation-control-button" disabled>
+ <span class="material-symbols-outlined">play_arrow</span>
+ </button>
+ <span>
+ <span id="current-time">0f</span> /
+ <span id="total-time">0f</span>
+ </span>
+ <input type="range" id="animation-scrubber" min="0" max="100" value="0" disabled>
+ </div>
+
+ </div>
+
+ <!-- github project link-->
+ <a id="github-logo" href="https://github.com/scottpetrovic/mesh2motion-app" target="_blank">
+ <img src="../images/GitHub_Logo_White.png" />
+ <!-- <span>0.1.<span id="build-version">0</span> -->
+ </span>
+ </a>
+
+ <!-- 3d view control hit box. It is just a container to help with 3d view controls. -->
+ <div id="view-control-hitbox"></div>
+
+ <!-- Attribution. clicking will open dialog with attribution information -->
+ <a href="#" id="attribution-link">Contributors</a>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/src/marketing/marketing.css b/src/marketing/marketing.css
new file mode 100644
index 0000000..8260d57
--- /dev/null
+++ b/src/marketing/marketing.css
@@ -0,0 +1,6 @@
+.model-selection-section {
+ display: flex;
+ flex-direction: row;
+ position: fixed;
+ right: 15%;
+}
\ No newline at end of file