Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

have more fine grained controls for arm plane

Scott Petrovica1a2e70658ce
diff --git a/src/create.html b/src/create.html
index d77532a..2f40c64 100644
--- a/src/create.html
+++ b/src/create.html
@@ -308,8 +308,8 @@
</div>
<div id="arm-plane-setting-container" style="display: flex; align-items: center; gap: 0.5rem;">
<label for="arm-plane-offset-input">Distance:</label>
- <input type="range" id="arm-plane-offset-input" min="-0.50" max="0.50" step="0.01" value="0.00" />
- <span id="arm-plane-offset-label" style="width: 2rem;">0.00</span>
+ <input type="range" id="arm-plane-offset-input" min="-0.10" max="0.10" step="0.01" value="0.00" />
+ <span id="arm-plane-offset-label" style="width: 3rem;">0%</span>
</div>
<hr />
</div>
diff --git a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
index 2ad2ae6..c4e45e2 100644
--- a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
+++ b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
@@ -236,7 +236,7 @@ export class StepEditSkeleton extends EventTarget {
// set default value (and label) for arm plane offset on UI
if (this.ui.dom_arm_plane_offset_input !== null && this.ui.dom_arm_plane_offset_label !== null) {
this.ui.dom_arm_plane_offset_input.value = this.arm_plane_offset.toString()
- this.ui.dom_arm_plane_offset_label.textContent = this.arm_plane_offset.toFixed(2)
+ this.ui.dom_arm_plane_offset_label.textContent = this.format_arm_plane_offset_label()
}
// the checkbox is forced off for non-human rigs, so keep the DOM in sync
@@ -246,6 +246,14 @@ export class StepEditSkeleton extends EventTarget {
}
}
+ /**
+ * The offset is a decimal in scene units, but a percentage reads better on a
+ * range this small (-0.10 to 0.10 shows as -10% to 10%).
+ */
+ private format_arm_plane_offset_label (): string {
+ return `${(this.arm_plane_offset * 100).toFixed(0)}%`
+ }
+
/**
* Move the arm planes to wherever the shoulder joint currently is, plus the
* user's offset. The solver derives its plane the same way at skin time, so
@@ -536,7 +544,7 @@ export class StepEditSkeleton extends EventTarget {
// Update the label to show current value
if (this.ui.dom_arm_plane_offset_label !== null) {
- this.ui.dom_arm_plane_offset_label.textContent = this.arm_plane_offset.toFixed(2)
+ this.ui.dom_arm_plane_offset_label.textContent = this.format_arm_plane_offset_label()
}
})