Import a 3D Model and automatically assign and export animations
TypeScript
Only show A-Pose UI options for human skeleton
Scott Petrovic919555a31b81
diff --git a/src/index.html b/src/index.htmlindex 544dcdd..2cdef35 100644--- a/src/index.html+++ b/src/index.html@@ -288,21 +288,26 @@<!-- slider to control arm extension (hide this feature until the base functionality is more stable) -->- <div style="display: flex; flex-direction: row; align-items: center;">- <label style="display:inline-flex">A-Pose Correction</label>- <span class="tooltip">- <span class="material-symbols-outlined" style="font-size: 16px;">help</span>- <span class="tooltiptext">If your model uses an A-Pose, this will help expand/contract arms for all animations</span>- </span>- </div>+ <div id="a-pose-correction-options">+ <div style="display: flex; flex-direction: row; align-items: center;">+ <label style="display:inline-flex">A-Pose Correction</label>+ <span class="tooltip">+ <span class="material-symbols-outlined" style="font-size: 16px;">help</span>+ <span class="tooltiptext">If your model uses an A-Pose, this will help expand/contract arms for all animations</span>+ </span>+ </div>++ <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">+ <input type="number" id="extend-arm-input" name="arm-extend-input" value="3" min="-25" max="25" step="1">+ <span class="suffix-unit">%</span>+ <button id="extend-arm-button" class="secondary-button" >Open Arms</button>+ </div>- <div style="display: flex; flex-direction: row; gap: 1rem; justify-content: flex-start; align-items: center;">- <input type="number" id="extend-arm-input" name="arm-extend-input" value="3" min="-25" max="25" step="1">- <span class="suffix-unit">%</span>- <button id="extend-arm-button" class="secondary-button" >Open Arms</button>+ <hr />+</div>- <hr />+<!-- checkbox option to show skeleton --><div class="styled-checkbox">diff --git a/src/lib/UI.ts b/src/lib/UI.tsindex 7cdfa96..dbdd07a 100644--- a/src/lib/UI.ts+++ b/src/lib/UI.ts@@ -57,6 +57,7 @@ export class UI {dom_import_animations_button: HTMLButtonElement | null = nulldom_extend_arm_input: HTMLElement | null = nulldom_extend_arm_button: HTMLButtonElement | null = null+ dom_a_pose_correction_options: HTMLElement | null = nulldom_export_button_hidden_link: HTMLElement | null = nulldom_build_version: HTMLElement | null = null@@ -134,6 +135,7 @@ export class UI {this.dom_extend_arm_input = document.querySelector('#extend-arm-input')this.dom_extend_arm_button = document.querySelector('#extend-arm-button')+ this.dom_a_pose_correction_options = document.querySelector('#a-pose-correction-options')this.dom_build_version = document.querySelector('#build-version')diff --git a/src/script.ts b/src/script.tsindex bf3c60c..13448cb 100644--- a/src/script.ts+++ b/src/script.ts@@ -139,7 +139,7 @@ export class Bootstrap {let light_strength: number = 12if (this.theme_manager.get_current_theme() === 'light') {grid_color = 0xaaaaaa // light theme color- floor_color = 0xe3eef0 // light theme color+ floor_color = 0xecf0f1 // light theme colorlight_strength = 12}@@ -163,6 +163,16 @@ export class Bootstrap {this.scene.add(this.skeleton_helper)}+ public update_a_pose_options_visibility (): void {+ if (this.ui.dom_a_pose_correction_options != null) {+ if (this.load_skeleton_step.skeleton_type() === SkeletonType.Human) {+ this.ui.dom_a_pose_correction_options.style.display = 'block'+ } else {+ this.ui.dom_a_pose_correction_options.style.display = 'none'+ }+ }+ }+public handle_transform_controls_moving (): void {if (this.edit_skeleton_step.is_mirror_mode_enabled()) {const selected_bone: Bone = this.transform_controls.object as Bone@@ -268,6 +278,9 @@ export class Bootstrap {this.process_step = ProcessStep.AnimationsListingthis.animations_listing_step.begin()+ // Show/hide A-Pose correction options based on skeleton type+ this.update_a_pose_options_visibility()+// calculate hip bone offset for human skeleton typeif (this.load_skeleton_step.skeleton_type() === SkeletonType.Human) {this.animations_listing_step.calculate_hip_bone_offset(this.load_skeleton_step.armature(),