Import a 3D Model and automatically assign and export animations
TypeScript
Small UX fixes for flow
Scott Petrovic631c00cbe073
diff --git a/src/index.html b/src/index.htmlindex 91f39d5..8d5fbb4 100644--- a/src/index.html+++ b/src/index.html@@ -21,44 +21,50 @@</div><div id="load-model-tools">++ <label for="model-upload" class="button" >+ <span class="button-icon-group">+ <span class="material-symbols-outlined" >upload</span>+ <span>Upload GLTF</span>+ </span>+ </label>+ <input id="model-upload" type="file" name="file-upload" accept=".glb, .gltf" />++ <div style="text-align: center; font-size: 1.5rem">or</div>+ <div style="background-color: #0f2f3d; padding: 1rem;">+ <label>Sample:</label><select id="model-selection"><option value="models/human-simple.glb">Human Cartoon</option><option value="models/fox.glb">Fox</option><option value="models/mesh-x-bot.glb">X Bot</option></select><button id="load-model-button">Load</button>+ </div>- <div style="text-align: center">or</div>-- <label for="model-upload" class="button" >- <span class="button-icon-group">- <span class="material-symbols-outlined" >upload</span>- <span>Upload GLTF</span>- </span>- </label>- <input id="model-upload" type="file" name="file-upload" accept=".glb, .gltf" />-- <div style="display: flex; flex-direction: row">- <input type="checkbox" id="load-model-debug-checkbox" name="load-model-debug-checkbox" >- <label for="load-model-debug-checkbox">Debug</label>- </div>+++ <div style="display: flex; flex-direction: row">+ <input type="checkbox" id="load-model-debug-checkbox" name="load-model-debug-checkbox" >+ <label for="load-model-debug-checkbox">Debug (load model as normals)</label>+ </div></div><div id="load-skeleton-tools">+ <label>Skeleton Type to use:</label><select id="skeleton-selection"><option value="bipedal-simple">Simplified Human</option><option value="quadraped">4 Leg Creature</option><option value="bipedal-full">Mixamo Human</option></select>- <button id="load-skeleton-button">Load</button>+<hr /><span>- <span>Rotate Model</span>+ <span>Rotate Model to face front</span><div style="display: flex; flex-direction: row"><button id="rotate-model-x-button">X</button><button id="rotate-model-y-button">Y</button>@@ -66,6 +72,10 @@</div></span>+ <hr />++ <button id="load-skeleton-button">Load Skeleton</button>+</div>@@ -88,7 +98,7 @@<div style="display: flex; flex-direction: row"><input type="checkbox" id="mirror-skeleton" name="mirror-skeleton" value="mirror" checked>- <label for="mirror-skeleton">Mirror</label>+ <label for="mirror-skeleton">Mirror Left/Right</label></div><hr />@@ -112,10 +122,11 @@<div style="display: flex; flex-direction: row; justify-content: space-evenly; align-items: center;"><input type="number" id="scale-input" name="scale-input" value="-3" min="-90" max="90" step="1.0"><span class="suffix-unit">%</span>- <button id="scale-skeleton-button" class="secondary-button" >Scale</button>+ <button id="scale-skeleton-button" class="secondary-button" >Scale entire skeleton</button></div>- <button id="action_move_to_origin" class="secondary-button" >Move to origin</button>+ <!-- hide this move to origin for now as is it seems to cause more trouble than it helps -->+ <!-- <button id="action_move_to_origin" class="secondary-button" >Move to origin</button> --><hr />@@ -139,7 +150,7 @@</span><span id="skinned-step-tools">- <button id="action_back_to_edit_skeleton" >Edit skeleton</button>+ <button id="action_back_to_edit_skeleton" >Back to edit skeleton</button><!-- checkbox option to show skeleton --><div style="display: flex; flex-direction: row">diff --git a/src/lib/processes/StepEditSkeleton.ts b/src/lib/processes/StepEditSkeleton.tsindex 6db48ef..760b12e 100644--- a/src/lib/processes/StepEditSkeleton.ts+++ b/src/lib/processes/StepEditSkeleton.ts@@ -24,7 +24,7 @@ export class StepEditSkeleton extends EventTarget {}if (this.ui.dom_current_step_element != null) {- this.ui.dom_current_step_element.innerHTML = 'Edit Skeleton'+ this.ui.dom_current_step_element.innerHTML = 'Move joints inside mesh'}if (this.ui.dom_transform_controls_switch != null) {diff --git a/src/lib/processes/StepLoadModel.ts b/src/lib/processes/StepLoadModel.tsindex 9902d13..e449f31 100644--- a/src/lib/processes/StepLoadModel.ts+++ b/src/lib/processes/StepLoadModel.ts@@ -117,7 +117,7 @@ export class StepLoadModel extends EventTarget {<div>Select existing models or upload your own.</div><ol><li>Only GLTF files can be loaded</li>- <li>Models with multiple objects won't be rigged correct</li>+ <li>Models with multiple objects won't be rigged correct. I need to work on this.</li><li>Mouse primary drag to move view</li><li>Mouse context drag to pan view</li><li>Debugging allows you to test odd material artifacts by using a 'Normal' material instead of what is included in the mesh</li>diff --git a/src/script.ts b/src/script.tsindex 6d865b0..c7c1d5c 100644--- a/src/script.ts+++ b/src/script.ts@@ -77,6 +77,11 @@ export class Bootstrap {this.renderer.setSize(window.innerWidth, window.innerHeight)this.renderer.shadowMap.enabled = true+ // Set default camera position for front view+ // this will help because we first want the user to rotate the model to face the front+ this.camera.position.set(0, 1.7, 15) // X:0 (centered), Y:1.7 (eye-level), Z:5 (front view)+ this.camera.lookAt(0, 1.7, 0) // Look at center at eye-level+Generators.create_window_resize_listener(this.renderer, this.camera)document.body.appendChild(this.renderer.domElement)@@ -97,6 +102,8 @@ export class Bootstrap {const fog_far = 80const fog_color = 0x0d2525this.scene.fog = new THREE.Fog(fog_color, fog_near, fog_far)++} // end setup_environment()private regenerate_skeleton_helper (new_skeleton: Skeleton, helper_name = 'Skeleton Helper'): void {