Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Tighten up styling

Scott Petrovic0d042c38ba15
diff --git a/src/retarget/index.html b/src/retarget/index.html
index c3d142a..e8e9866 100644
--- a/src/retarget/index.html
+++ b/src/retarget/index.html
@@ -60,7 +60,7 @@
justify-content: center;
">
- <span data-tippy-content="This feature is still being developed. The only stable workflow is to use a Mesh2Motion rig that you 'skin' in another application like Blender. Other rig types currently have issues exporting." >
+ <span data-tippy-content="This feature is still being developed. The main stable workflow is to use a Mesh2Motion rig that you 'skin' in another application like Blender. Mixamo skeletons supported as long as there is only 1 skeleton in the file." >
<span class="button-icon-group">
<span>Experimental</span>
<span class="material-symbols-outlined" >help</span>
@@ -80,7 +80,7 @@
<span>Mesh2Motion Skeleton</span>
</h2>
<div class="bone-map-content">
- <div id="skeleton-selection-container" >
+ <div id="skeleton-selection-container" style="margin-bottom: 1.0rem;">
<select id="skeleton-type-select" class="button">
<option value="human" selected>Human</option>
<option value="quadraped">Quadruped (Fox)</option>
@@ -90,9 +90,10 @@
</select>
</div>
- <p>Source Bones <span id="source-bone-count">(0)</span></p>
-
- <input type="text" id="source-bones-filter" placeholder="Filter source bones..." >
+ <div style="display: flex; gap: 1.0rem; margin-bottom: 1rem;">
+ <input type="text" id="source-bones-filter" placeholder="Source bones filter" style="flex-grow: 1;">
+ <span><span id="source-bone-count">0</span> bones</span>
+ </div>
<div id="source-bones-list">
<p style="color: var(--text-secondary);">No source skeleton loaded</p>
@@ -110,25 +111,26 @@
<p class="bone-map-heading">
<span>Your 3D Rig Model</span>
<span id="auto-bone-map-match">✨Mixamo</span>
+ <span id="view-bone-tree-button" data-tippy-content="View bone hierarchy for for debugging purposes" style="display: none;">👓</span>
</p>
<div class="bone-map-content">
- <div style="display: flex; gap: 0.5rem;">
+ <div style="display: flex; gap: 0.5rem; margin-bottom: 1rem;">
<!-- there are some issues going on with scaling the skeleton for FBX and other formats so we will start simple for now with just GLB files -->
<input type="file" id="upload-file" accept=".glb, .fbx, .zip" style="display: none;" />
<label for="upload-file" class="button" id="load-model-button">Upload Rig</label>
- <button id="auto-map-button" class="secondary-button" style="display: none;">Auto-Map Bones</button>
+ <button id="auto-map-button" class="secondary-button" style="display: none;">Auto-Map</button>
<button id="clear-mappings-button" class="secondary-button" style="display: none;">Clear Mappings</button>
</div>
- <span id="target-bones-list-container">
- <p>
- Target Bones <span id="target-bone-count">(0)</span>
- <span id="view-bone-tree-button" style="display: none;">👓</span>
- </p>
+ <span id="target-bones-list-container" >
- <input type="text" id="target-bones-filter" placeholder="Filter target bones..." >
+ <div style="display: flex; gap: 1.0rem;" >
+ <input type="text" id="target-bones-filter" placeholder="Target bones filter" style="flex-grow: 1">
+ <span><span id="target-bone-count">0</span> bones</span>
+ </div>
+
<div id="target-bones-list">
<p style="color: var(--text-secondary);">No target skeleton loaded</p>
</div>
diff --git a/src/retarget/retarget.css b/src/retarget/retarget.css
index 651f128..2313ba8 100644
--- a/src/retarget/retarget.css
+++ b/src/retarget/retarget.css
@@ -24,7 +24,7 @@ h1 {
}
#source-bones-list, #target-bones-list {
- max-height: calc(100vh - 450px);
+ height: calc(100vh - 490px); /* Hard-code the height to keep the UI consistent when filtering the lists */
overflow-y: auto;
background-color: var(--bg-alternate);
border-radius: 0.25rem;
@@ -140,14 +140,6 @@ h1 {
/* Bone tree view */
-.bone-tree-modal .modal-dialog-content {
- width: min(900px, 92vw);
-}
-
-.bone-tree-modal .modal-dialog-body {
- max-height: 70vh;
-}
-
.bone-tree-dialog-summary {
display: flex;
gap: 1rem;
diff --git a/src/retarget/steps/StepBoneMapping.ts b/src/retarget/steps/StepBoneMapping.ts
index d7c748f..b18fe29 100644
--- a/src/retarget/steps/StepBoneMapping.ts
+++ b/src/retarget/steps/StepBoneMapping.ts
@@ -178,7 +178,7 @@ export class StepBoneMapping extends EventTarget {
// Update bone count display
if (this.source_bone_count !== null) {
- this.source_bone_count.textContent = `(${source_bone_names.length})`
+ this.source_bone_count.textContent = `${source_bone_names.length}`
}
if (source_bone_names.length === 0) {
@@ -222,7 +222,7 @@ export class StepBoneMapping extends EventTarget {
// Update bone count display
if (this.target_bone_count !== null) {
- this.target_bone_count.textContent = `(${target_bone_names.length})`
+ this.target_bone_count.textContent = `${target_bone_names.length}`
}
if (target_bone_names.length === 0) {
diff --git a/src/retarget/steps/StepLoadTargetModel.ts b/src/retarget/steps/StepLoadTargetModel.ts
index 4a54956..1ae1324 100644
--- a/src/retarget/steps/StepLoadTargetModel.ts
+++ b/src/retarget/steps/StepLoadTargetModel.ts
@@ -128,7 +128,7 @@ export class StepLoadTargetModel extends EventTarget {
const scale_factor = target_height / largest_dimension
console.log('scaling model down because of ', largest_dimension)
new ModalDialog('Large Rig Warning',
- `The model you imported is large (${largest_dimension.toFixed(1)} meters). Mesh2Motion expects 1 unit = 1 meter. Your model will be scaled down. This will affect the retargeted animation results. This warning will go away whenever the developer can figure out how to correctly handle issues with.`).show()
+ `The model you imported is large (${largest_dimension.toFixed(1)} meters). Mesh2Motion expects 1 unit = 1 meter. Your model will be scaled down. Mixamo rigs will work as long as they only have one skeleton in the model file.`).show()
retargetable_meshes.scale.set(scale_factor, scale_factor, scale_factor) // common case with 3d creation tools that use 1 cm = 1 unit
}
diff --git a/src/styles.css b/src/styles.css
index dacd335..b136da4 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -211,7 +211,7 @@ input[type="text"] {
border-radius: 4px;
margin-bottom: 0.5rem;
background-color: var(--bg-primary);
- border: 1px solid var(--text-primary);
+ border: 1px solid var(--bg-tertiary);
color: var(--text-primary);
}
input[type="text"]::placeholder {