Import a 3D Model and automatically assign and export animations
TypeScript
Use tippy.js library for tooltips. Add tooltip about uploading ZIP file
Scott Petroviccc6727bb05a8
diff --git a/package-lock.json b/package-lock.jsonindex cc5466f..32cad82 100644--- a/package-lock.json+++ b/package-lock.json@@ -11,6 +11,7 @@"file-saver": "^2.0.5","jszip": "^3.10.1","three": "^0.179.1",+ "tippy.js": "^6.3.7","vite-plugin-glsl": "^1.1.2"},"devDependencies": {@@ -180,6 +181,16 @@"node": ">= 8"}},+ "node_modules/@popperjs/core": {+ "version": "2.11.8",+ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz",+ "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==",+ "license": "MIT",+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/popperjs"+ }+ },"node_modules/@rollup/pluginutils": {"version": "5.0.5","resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.5.tgz",@@ -2993,6 +3004,15 @@"resolved": "https://registry.npmjs.org/three/-/three-0.179.1.tgz","integrity": "sha512-5y/elSIQbrvKOISxpwXCR4sQqHtGiOI+MKLc3SsBdDXA2hz3Mdp3X59aUp8DyybMa34aeBwbFTpdoLJaUDEWSw=="},+ "node_modules/tippy.js": {+ "version": "6.3.7",+ "resolved": "https://registry.npmjs.org/tippy.js/-/tippy.js-6.3.7.tgz",+ "integrity": "sha512-E1d3oP2emgJ9dRQZdf3Kkn0qJgI6ZLpyS5z6ZkY1DF3kaQaBsGZsndEpHwx+eC+tYM41HaSNvNtLx8tU57FzTQ==",+ "license": "MIT",+ "dependencies": {+ "@popperjs/core": "^2.9.0"+ }+ },"node_modules/to-regex-range": {"version": "5.0.1","resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",diff --git a/package.json b/package.jsonindex 34b8dca..9a483e2 100644--- a/package.json+++ b/package.json@@ -22,6 +22,7 @@"file-saver": "^2.0.5","jszip": "^3.10.1","three": "^0.179.1",+ "tippy.js": "^6.3.7","vite-plugin-glsl": "^1.1.2"}}diff --git a/src/index.html b/src/index.htmlindex 9f3944c..1bd2e24 100644--- a/src/index.html+++ b/src/index.html@@ -65,6 +65,9 @@</label><input id="model-upload" type="file" name="file-upload" accept=".glb, .zip, .fbx" />+ <span class="material-symbols-outlined" data-tippy-content="GLB and FBX preferred. ZIP is for GLTF that includes BIN and textures separately.">help</span>++<div style="text-align: center; font-size: 1.5rem">or</div><div class="alternate-background-section">@@ -84,10 +87,8 @@<input type="checkbox" id="load-model-debug-checkbox" name="load-model-debug-checkbox"><label for="load-model-debug-checkbox">Debug</label>- <div class="tooltip">- <span class="material-symbols-outlined" style="font-size: 16px;">help</span>- <span class="tooltiptext">Replaces all materials with a 'normal' shader for debugging</span>- </div>+ <span class="material-symbols-outlined" data-tippy-content="Replaces all materials with a 'normal' shader for debugging">help</span>+</div></div>@@ -131,10 +132,7 @@<span>Hand Options:- <div class="tooltip" style="display: inline-block; margin-left: 0.5rem;">- <span class="material-symbols-outlined" style="font-size: 16px;">help</span>- <span class="tooltiptext">Variations on which finger bones you want to keep. Single Hand Bone removes all fingers and keeps only the hand bone.</span>- </div>+ <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">@@ -265,10 +263,7 @@<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="tooltip">- <span class="material-symbols-outlined" style="font-size: 16px;">help</span>- <span class="tooltiptext">If your model uses an A-Pose, this will help expand/contract arms for all animations</span>- </span>+ <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;">diff --git a/src/script.ts b/src/script.tsindex 8ca4a06..d5d5374 100644--- a/src/script.ts+++ b/src/script.ts@@ -3,6 +3,9 @@ import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'import { TransformControls } from 'three/examples/jsm/controls/TransformControls.js'import { CustomViewHelper } from './lib/CustomViewHelper.ts'+import tippy from 'tippy.js'+import 'tippy.js/dist/tippy.css' // optional for styling+import { Utility } from './lib/Utilities.ts'import { Generators } from './lib/Generators.ts'@@ -88,6 +91,12 @@ export class Bootstrap {this.process_step = this.process_step_changed(ProcessStep.LoadModel)this.animate() // start the render loop which will continue rendering the scenethis.inject_build_version()+ this.setup_tooltips()+ }++ /* Add this attribute to an HTML element to give it a tooltip */+ private setup_tooltips (): void {+ tippy('[data-tippy-content]', { theme: 'mesh2motion' })}private inject_build_version (): void {diff --git a/src/styles.css b/src/styles.cssindex 0b3ab8b..7f29b46 100644--- a/src/styles.css+++ b/src/styles.css@@ -455,45 +455,18 @@ position: fixed;position: fixed;}-/* Tooltip container */-.tooltip {- position: relative;- display: inline-block;-}----/* Tooltip text */-.tooltip .tooltiptext {- visibility: hidden;- width: 150px;- background-color: var(--bg-tertiary);- color: #fff;- text-align: center;- padding: 5px;- border-radius: 4px;- border: 1px solid var(--text-primary);-- /* Position the tooltip */- position: absolute;- z-index: 1;- bottom: 125%;- left: 50%;- margin-left: -100px;- opacity: 0;- transition: opacity 0.3s;-}--/* Show the tooltip text when you mouse over the tooltip container */-.tooltip:hover .tooltiptext {- visibility: visible;- opacity: 1;-}-.step-instructions {max-width: 220px;}+/* tooltip styles (tippy) */+.tippy-box[data-theme~='mesh2motion'] {+ background-color: var(--bg-primary); /* container background */+ color: var(--text-primary); /* text color */+ box-shadow: 3px 3px 6px #1420276b;+ padding: 0.5rem;+}+/* style checkbox */.styled-checkbox {display: flex;