Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Only show skeleton scale once we have a skeleton selected

Scott Petrovicb0bf95e605b8
diff --git a/src/index.html b/src/index.html
index 8f73fb3..922d535 100644
--- a/src/index.html
+++ b/src/index.html
@@ -145,14 +145,15 @@
<!-- scale skeleton to get it close to the model size -->
- <div style="display: flex; flex-direction: row; align-items: center;">
- <label style="display:inline-flex">Scale skeleton</label>
- <span class="material-symbols-outlined" data-tippy-content="Adjust the overall scale of the skeleton">help</span>
- </div>
-
- <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">
- <span id="scale-skeleton-percentage-display">100%</span>
- <input id="scale-skeleton-input" style="flex-grow: 1;" type="range" min=".20" max="1.80" value="1.0" step="0.01" />
+ <div id="scale-skeleton-controls" style="display: none; flex-direction: column;">
+ <div style="display: flex; flex-direction: row; align-items: center;">
+ <label style="display:inline-flex">Scale skeleton</label>
+ <span class="material-symbols-outlined" data-tippy-content="Adjust the overall scale of the skeleton">help</span>
+ </div>
+ <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">
+ <span id="scale-skeleton-percentage-display">100%</span>
+ <input id="scale-skeleton-input" style="flex-grow: 1;" type="range" min=".20" max="1.80" value="1.0" step="0.01" />
+ </div>
</div>
diff --git a/src/lib/UI.ts b/src/lib/UI.ts
index addc4e8..cc9c35b 100644
--- a/src/lib/UI.ts
+++ b/src/lib/UI.ts
@@ -31,6 +31,7 @@ export class UI {
// scale skeleton contols
dom_scale_skeleton_input: HTMLInputElement | null = null
dom_scale_skeleton_percentage_display: HTMLElement | null = null
+ dom_scale_skeleton_controls: HTMLElement | null = null
// edit skeleton UI step controls
dom_selected_bone_label: HTMLElement | null = null
@@ -125,6 +126,7 @@ export class UI {
// scaling the skeleton option
this.dom_scale_skeleton_input = document.querySelector('#scale-skeleton-input')
this.dom_scale_skeleton_percentage_display = document.querySelector('#scale-skeleton-percentage-display')
+ this.dom_scale_skeleton_controls = document.querySelector('#scale-skeleton-controls')
// UI controls for working with skinned mesh
this.dom_skinned_mesh_tools = document.querySelector('#skinned-step-tools')
diff --git a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
index 684de8a..ba64532 100644
--- a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
+++ b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
@@ -120,8 +120,8 @@ export class StepLoadSkeleton extends EventTarget {
if (this.ui.dom_skeleton_drop_type !== null) {
this.ui.dom_skeleton_drop_type.addEventListener('change', () => {
// get selected value from skeleton options
- const skeleton_selection = this.ui.dom_skeleton_drop_type.options
- this.skeleton_t = skeleton_selection[skeleton_selection.selectedIndex].value as SkeletonType
+ // const skeleton_selection = this.ui.dom_skeleton_drop_type.options
+ // this.skeleton_t = skeleton_selection[skeleton_selection.selectedIndex].value as SkeletonType
// hand options only apply to human skeletons, so we need to show/hide when skeleton type changes
this.toggle_ui_hand_skeleton_options()
@@ -131,6 +131,9 @@ export class StepLoadSkeleton extends EventTarget {
this.ui.dom_skeleton_drop_type?.options.remove(0)
}
+ // show the scale skeleton options in case they are hidden
+ this.ui.dom_scale_skeleton_controls!.style.display = 'flex'
+
// load the preview skeleton
// need to get the file name for the correct skeleton
// we pass the skeleton scale in the case where we set a skeleton, change scale, then change the skeleton