Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Start adding tooltip and put instructions in step instead of separate area

Scott Petrovic505d40045b0a
diff --git a/src/index.html b/src/index.html
index d561cd1..1dbed29 100644
--- a/src/index.html
+++ b/src/index.html
@@ -38,6 +38,8 @@
<div id="load-model-tools">
+ <p class="step-instructions">Only GLTF files can be loaded. Models with multiple objects won't be rigged correct.</p>
+
<label for="model-upload" class="button" >
<span class="button-icon-group">
<span class="material-symbols-outlined" >upload</span>
@@ -60,14 +62,21 @@
- <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 style="display: flex; flex-direction: row; align-items: center;">
+ <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 normal shaders for debugging</span>
+ </div>
</div>
</div>
<div id="load-skeleton-tools">
+
+ <p class="step-instructions">Pick base skeleton type to work with. You will modify joints to fit mesh in next step.</p>
+
<label>Skeleton Type to use:</label>
<select id="skeleton-selection">
<option value="bipedal-simple">Simplified Human</option>
@@ -111,10 +120,12 @@
</label>
</div> -->
+ <p class="step-instructions">Right click on a joint to select and move it with controls.</p>
+
<div style="display: flex; flex-direction: row">
<input type="checkbox" id="mirror-skeleton" name="mirror-skeleton" value="mirror" checked>
- <label for="mirror-skeleton">Mirror Left/Right</label>
+ <label for="mirror-skeleton">Mirror Left/Right Joints</label>
</div>
<hr />
@@ -160,12 +171,20 @@
<div style="display: flex; flex-direction: row">
<input type="checkbox" id="debug-skinning-checkbox" >
<label for="debug-skinning-checkbox">Debug Skinning</label>
+ <div class="tooltip">
+ <span class="material-symbols-outlined" style="font-size: 16px;">help</span>
+ <span class="tooltiptext">Preview skinning cage with bone envelope</span>
+ </div>
</div>
+
<button id="action_bind_pose" >Bind pose</button>
</span>
<span id="skinned-step-tools">
+
+ <p class="step-instructions">Select animations you want to export by checking them by animation</p>
+
<button id="action_back_to_edit_skeleton" >Back to edit skeleton</button>
<!-- checkbox option to show skeleton -->
@@ -247,7 +266,7 @@
<button id="export-button">
<span class="button-icon-group">
<span class="material-symbols-outlined">save_alt</span>
- <span>Download</span>
+ <span>Download GLB</span>
</span>
</button>
<a id="download-hidden-link" href="#" style="display:none"></a>
diff --git a/src/lib/processes/StepAnimationsListing.ts b/src/lib/processes/StepAnimationsListing.ts
index 4b9c786..6258b00 100644
--- a/src/lib/processes/StepAnimationsListing.ts
+++ b/src/lib/processes/StepAnimationsListing.ts
@@ -54,12 +54,7 @@ export class StepAnimationsListing extends EventTarget {
public instructions_text (): string {
return `<div>Instructions</div>
- <div>Test and export animations to GLB format</div>
- <ol>
- <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>`
+ <div>Test and export animations to GLB format</div>`
}
public mixer (): AnimationMixer {
diff --git a/src/lib/processes/StepEditSkeleton.ts b/src/lib/processes/StepEditSkeleton.ts
index 760b12e..48fa45f 100644
--- a/src/lib/processes/StepEditSkeleton.ts
+++ b/src/lib/processes/StepEditSkeleton.ts
@@ -46,14 +46,7 @@ export class StepEditSkeleton extends EventTarget {
public instructions_text (): string {
return `<div>Instructions</div>
- <div>Position skeleton into correct postion</div>
- <ol>
- <li>Context clicking in model will select bones</li>
- <li>Move and rotate bones into position with transform controls</li>
- <li>Use the "Mirror" option to help position symmetrical bones</li>
- <li>Debug skinning allows you to preview skinning results for testing</li>
- <li>Try a different skinning algorithm if you aren't getting the results you like</li>
- </ol>`
+ <div>Position skeleton into correct postion</div>`
}
private update_bind_button_text (): void {
@@ -215,7 +208,7 @@ export class StepEditSkeleton extends EventTarget {
const euler = new Euler(
selected_bone.rotation.x,
-selected_bone.rotation.y,
- -selected_bone.rotation.z,
+ -selected_bone.rotation.z
)
mirror_bone.quaternion.setFromEuler(euler)
}
diff --git a/src/lib/processes/StepLoadModel.ts b/src/lib/processes/StepLoadModel.ts
index 84e829a..9016a1a 100644
--- a/src/lib/processes/StepLoadModel.ts
+++ b/src/lib/processes/StepLoadModel.ts
@@ -115,11 +115,7 @@ export class StepLoadModel extends EventTarget {
public instructions_text (): string {
return `<div>Instructions</div>
<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. I need to work on this.</li>
- <li>Debugging allows you to test odd material artifacts by using a 'Normal' material instead of what is included in the mesh</li>
- </ol>`
+`
}
private load_model_file (model_file_path: string): void {
diff --git a/src/lib/processes/StepLoadSkeleton.ts b/src/lib/processes/StepLoadSkeleton.ts
index b47b06c..2b644a0 100644
--- a/src/lib/processes/StepLoadSkeleton.ts
+++ b/src/lib/processes/StepLoadSkeleton.ts
@@ -39,11 +39,7 @@ export class StepLoadSkeleton extends EventTarget {
public instructions_text (): string {
return `<div>Instructions</div>
<div>Select skeleton based off model type.</div>
- <ol>
- <li>Mixamo human has more bones in hands</li>
- <li>Four leg creature has a tail</li>
- <li>You will be able to resize or move bones after importing</li>
- </ol>`
+`
}
private add_event_listeners (): void {
diff --git a/src/styles.css b/src/styles.css
index 49ab061..ec87b13 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -339,4 +339,44 @@ input[type="file"] {
padding: 0 8px;
height: 50px;
z-index: 100;
+}
+
+/* Tooltip container */
+.tooltip {
+ position: relative;
+ display: inline-block;
+ margin-left: 4px;
+}
+
+
+
+/* Tooltip text */
+.tooltip .tooltiptext {
+ visibility: hidden;
+ width: 200px;
+ background-color: #0b1822;
+ color: #fff;
+ text-align: center;
+ padding: 5px;
+ border-radius: 4px;
+ border: 1px solid #5b8792;
+
+ /* 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: 250px;
}
\ No newline at end of file