Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Reset animations selected to 0 if we change rig type

Scott Petrovicc670e7b08017
diff --git a/src/create.html b/src/create.html
index 082cbc7..42f6f9f 100644
--- a/src/create.html
+++ b/src/create.html
@@ -111,7 +111,6 @@
<!-- create a radio button group. There are two options. Move Skeleton, Rotate Mesh -->
<div id="tool-selection-group">
<div style="margin-bottom: 1rem; padding: 0">
- <span id="current-step-index"></span>
<span id="current-step-label"></span>
</div>
diff --git a/src/lib/UI.ts b/src/lib/UI.ts
index 1c42e16..b6b392e 100644
--- a/src/lib/UI.ts
+++ b/src/lib/UI.ts
@@ -1,7 +1,6 @@
export class UI {
private static instance: UI
- dom_current_step_index: HTMLElement | null = null
dom_current_step_element: HTMLElement | null = null
dom_load_model_tools: HTMLElement | null = null
dom_upload_model_button: HTMLButtonElement | null = null
@@ -120,7 +119,6 @@ export class UI {
private initialize_dom_elements (): void {
// grab all UI Elements from page that we need to interact with
- this.dom_current_step_index = document.querySelector('#current-step-index')
this.dom_current_step_element = document.querySelector('#current-step-label')
// skeleton toggle on UI viewport
diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.ts
index 048a5d7..2b499e9 100644
--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts
+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts
@@ -86,10 +86,6 @@ export class StepAnimationsListing extends EventTarget {
public begin (skeleton_type: SkeletonType, skeleton_scale: number): void {
this.skeleton_scale = skeleton_scale
- if (this.ui.dom_current_step_index != null) {
- this.ui.dom_current_step_index.innerHTML = '4'
- }
-
if (this.ui.dom_current_step_element != null) {
this.ui.dom_current_step_element.innerHTML = 'Test animations'
}
@@ -129,9 +125,31 @@ export class StepAnimationsListing extends EventTarget {
this.skinned_meshes_to_animate = []
this.animation_mixer = new AnimationMixer(new Object3D())
this.current_playing_index = 0
+ this.animation_search = null
+ this.reset_ui_elements()
this.animation_player.clear_animation()
}
+ // If we change skeleton types, we need to reset some of the state
+ // in the case we selected animations. This clears the UI state associated with that.
+ private reset_ui_elements (): void {
+ if (this.ui.dom_animation_clip_list !== null) {
+ this.ui.dom_animation_clip_list.innerHTML = ''
+ }
+
+ if (this.ui.dom_animation_count !== null) {
+ this.ui.dom_animation_count.innerHTML = '0'
+ }
+
+ if (this.ui.dom_animations_listing_count !== null) {
+ this.ui.dom_animations_listing_count.innerHTML = '0 animations'
+ }
+
+ if (this.ui.dom_export_button !== null) {
+ this.ui.dom_export_button.disabled = true
+ }
+ }
+
public mixer (): AnimationMixer {
return this.animation_mixer
}
diff --git a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
index caada3b..019e665 100644
--- a/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
+++ b/src/lib/processes/edit-skeleton/StepEditSkeleton.ts
@@ -121,9 +121,6 @@ export class StepEditSkeleton extends EventTarget {
this.update_ui_options_on_begin(skeleton_type)
// show UI elemnents for editing mesh
- if (this.ui.dom_current_step_index != null) {
- this.ui.dom_current_step_index.innerHTML = '3'
- }
if (this.ui.dom_current_step_element != null) {
this.ui.dom_current_step_element.innerHTML = 'Position Joints'
diff --git a/src/lib/processes/load-model/StepLoadModel.ts b/src/lib/processes/load-model/StepLoadModel.ts
index 96f90af..c6dd110 100644
--- a/src/lib/processes/load-model/StepLoadModel.ts
+++ b/src/lib/processes/load-model/StepLoadModel.ts
@@ -141,10 +141,6 @@ export class StepLoadModel extends EventTarget {
}
public begin (): void {
- if (this.ui.dom_current_step_index !== null) {
- this.ui.dom_current_step_index.innerHTML = '1'
- }
-
if (this.ui.dom_current_step_element !== null) {
this.ui.dom_current_step_element.innerHTML = 'Load Model'
}
diff --git a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
index 8d86daf..d5d6b9b 100644
--- a/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
+++ b/src/lib/processes/load-skeleton/StepLoadSkeleton.ts
@@ -51,10 +51,6 @@ export class StepLoadSkeleton extends EventTarget {
}
public begin (): void {
- if (this.ui.dom_current_step_index !== null) {
- this.ui.dom_current_step_index.innerHTML = '2'
- }
-
if (this.ui.dom_current_step_element !== null) {
this.ui.dom_current_step_element.innerHTML = 'Load Skeleton'
}
diff --git a/src/styles.css b/src/styles.css
index fd7d5e0..cd533e6 100644
--- a/src/styles.css
+++ b/src/styles.css
@@ -424,17 +424,6 @@ option {
border-radius: 0;
}
-/* Hide the current step for now */
-#current-step-index {
- display: none;
- font-size: 15px;
- background: var(--current-step-indicator);
- padding: 0.5rem 1rem;
- border-radius: 1rem;
- color: var(--text-primary);
- text-align: center;
-}
-
#current-step-label {
font-size: 20px;
}