Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Only show animation player when testing animations. Remove old unused info panel

Scott Petrovic208236496727
diff --git a/src/animation-player.css b/src/animation-player.css
index 5ccda51..67fb337 100644
--- a/src/animation-player.css
+++ b/src/animation-player.css
@@ -4,7 +4,7 @@
bottom: 0;
left: 43%;
transform: translateX(-50%);
- display: flex;
+ display: none; /* Hidden by default, shown only during AnimationsListing step */
flex-direction: column;
align-items: center;
gap: 0;
@@ -16,7 +16,6 @@
padding: 12px 20px;
backdrop-filter: blur(10px);
z-index: 1000;
- visibility: hidden; /* Hidden by default until animation is loaded */
transition: all 0.3s ease;
width: 40rem;
}
diff --git a/src/index.html b/src/index.html
index ec669ca..537fe3e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -360,12 +360,6 @@
</div>
- <!-- info panel for messages and information-->
- <div id="info-panel">
- <div id="info-messaging"> </div>
- </div>
-
-
<!-- github project link-->
<a id="github-logo" href="https://github.com/scottpetrovic/mesh2motion-app" target="_blank">
<span>View on</span><img src="images/GitHub_Logo_White.png" />
diff --git a/src/lib/AnimationPlayer.ts b/src/lib/AnimationPlayer.ts
index 827bb6e..7999f0d 100644
--- a/src/lib/AnimationPlayer.ts
+++ b/src/lib/AnimationPlayer.ts
@@ -51,11 +51,6 @@ export class AnimationPlayer {
const fps = 30
const total_frames = Math.floor(animation_clip.duration * fps)
- // Show the animation player
- if (this.ui.dom_animation_player !== null) {
- this.ui.dom_animation_player.classList.add('visible')
- }
-
// Update UI
if (this.ui.dom_current_animation_name !== null) {
this.ui.dom_current_animation_name.textContent = animation_clip.name
@@ -86,11 +81,6 @@ export class AnimationPlayer {
this.current_animation_actions = []
this.is_playing = false
- // Hide the animation player
- if (this.ui.dom_animation_player !== null) {
- this.ui.dom_animation_player.classList.remove('visible')
- }
-
// Update UI
if (this.ui.dom_current_animation_name !== null) {
this.ui.dom_current_animation_name.textContent = 'No animation selected'
diff --git a/src/lib/UI.ts b/src/lib/UI.ts
index b4cad22..81e2c9f 100644
--- a/src/lib/UI.ts
+++ b/src/lib/UI.ts
@@ -59,9 +59,6 @@ export class UI {
dom_current_time: HTMLElement | null = null
dom_total_time: HTMLElement | null = null
- dom_info_container: HTMLElement | null = null
- dom_info_panel: HTMLElement | null = null
-
dom_import_animations_button: HTMLButtonElement | null = null
dom_extend_arm_input: HTMLElement | null = null
dom_extend_arm_button: HTMLButtonElement | null = null
@@ -146,9 +143,6 @@ export class UI {
this.dom_current_time = document.querySelector('#current-time')
this.dom_total_time = document.querySelector('#total-time')
- this.dom_info_container = document.querySelector('#info-panel')
- this.dom_info_panel = document.querySelector('#info-messaging')
-
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')
diff --git a/src/script.ts b/src/script.ts
index 13448cb..35c02a1 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -181,32 +181,9 @@ export class Bootstrap {
}
private show_skin_failure_message (bone_names_with_errors: string[], error_point_positions: Vector3[]): void {
- // show the DOM HTML container to see error messages for each bone that isn't inside the mesh
- if (this.ui.dom_info_container !== null) {
- this.ui.dom_info_container.style.display = 'block'
- }
-
// add the bone vertices as X markers to debugging object
const error_markers: Group = Generators.create_x_markers(error_point_positions, 0.02, 0xff0000)
this.debugging_visual_object.add(error_markers)
-
- // add information to the info panel
- if (this.ui.dom_info_panel === null) {
- console.warn('There was a skin failure, but the UI Info panel DOM element is not set to show the message.')
- return
- }
-
- this.ui.dom_info_panel.innerHTML = 'Somebones are outside the mesh and are marked with red. Fix them and try again.'
- this.ui.dom_info_panel.innerHTML += '<br>'
-
- // display the bones names in an HTML list
- let bones_error_list = '<ol id="bone-list">'
- bone_names_with_errors.forEach((bone_name: string) => {
- bones_error_list += `<li>${Utility.clean_bone_name_for_messaging(bone_name)}</li>`
- })
-
- bones_error_list += '</ol>'
- this.ui.dom_info_panel.innerHTML += bones_error_list
}
public process_step_changed (process_step: ProcessStep): ProcessStep {
@@ -216,9 +193,13 @@ export class Bootstrap {
// clean up things related to edit step in case we are leaving it
this.edit_skeleton_step.cleanup_on_exit_step()
- // hide the info container by default
- if (this.ui.dom_info_container !== null) {
- this.ui.dom_info_container.style.display = 'none'
+ // only show animation player on the animation listing page
+ if (this.ui.dom_animation_player !== null) {
+ this.ui.dom_animation_player.style.display = 'none'
+
+ if (process_step === ProcessStep.AnimationsListing) {
+ this.ui.dom_animation_player.style.display = 'flex'
+ }
}
switch (process_step) {
diff --git a/src/styles.css b/src/styles.css
index cc5e1d6..16a2b15 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -236,27 +236,6 @@ option {
font-size: 20px;
}
-#info-panel
-{
- background: var(--bg-tertiary);
- overflow-y: auto;
- height: fit-content;
- bottom: 20px;
- position: absolute;
- display: flex;
- width: 300px;
- right: 20px;
- border-radius: 3px;
- border: 1px solid var(--text-primary);
- max-height: calc(100% - 50px);
- box-shadow: 3px 3px 9px var(--bg-tertiary);
-}
-#info-messaging {
- padding: 0.5rem;
- color: var(--text-primary);
- border: 1px solid var(--text-primary);
-}
-
#load-model-tools, #load-skeleton-tools, #transform-controls, #skeleton-step-actions {
display: flex;
flex-direction: column;