Skip to content

Import a 3D Model and automatically assign and export animations

TypeScript

Reset state when going back to load skeleton step

Scott Petrovic5dfdfb66639b
diff --git a/src/index.html b/src/index.html
index 3a69cca..247bb61 100644
--- a/src/index.html
+++ b/src/index.html
@@ -106,7 +106,7 @@
<div style="display: flex; flex-direction: column; gap: 1rem;">
- <span>Skeleton Type to use:</span>
+ <span>Skeleton template:</span>
<select id="skeleton-selection">
<option value="human">Human</option>
<option value="quadraped">4 Leg Creature</option>
diff --git a/src/lib/EventListeners.ts b/src/lib/EventListeners.ts
index dd8a9e6..1cfdb72 100644
--- a/src/lib/EventListeners.ts
+++ b/src/lib/EventListeners.ts
@@ -116,8 +116,7 @@ export class EventListeners {
// going back to load skeleton step from edit skeleton step
this.bootstrap.ui.dom_back_to_load_skeleton_button?.addEventListener('click', () => {
- // this.bootstrap.process_step = this.bootstrap.process_step_changed(ProcessStep.LoadSkeleton)
- console.log('go back to the load skeleton step')
+ this.bootstrap.process_step = this.bootstrap.process_step_changed(ProcessStep.LoadSkeleton)
})
// change view event listeners when configuring skeleton
diff --git a/src/script.ts b/src/script.ts
index fcef8f4..b2ec953 100644
--- a/src/script.ts
+++ b/src/script.ts
@@ -187,6 +187,19 @@ export class Bootstrap {
this.load_model_step.begin()
break
case ProcessStep.LoadSkeleton:
+
+ // Resetting state for the load skeleton step
+
+ // if skeleton helper existed because we are going back to this
+ if (this.skeleton_helper !== undefined) {
+ this.scene.remove(this.skeleton_helper)
+ }
+
+ // need to change the texture display to normal material in
+ this.mesh_preview_display_type = ModelPreviewDisplay.Textured
+ this.changed_model_preview_display(this.mesh_preview_display_type)
+
+ // initializing all the load skeleton step stuff
this.scene.add(this.load_model_step.model_meshes())
process_step = ProcessStep.LoadSkeleton
this.load_skeleton_step.begin()
@@ -198,6 +211,8 @@ export class Bootstrap {
this.edit_skeleton_step.setup_scene(this.scene)
this.transform_controls.enabled = true
this.transform_controls.setMode(this.transform_controls_type) // 'translate', 'rotate'
+
+ this.mesh_preview_display_type = ModelPreviewDisplay.WeightPainted
this.changed_model_preview_display(this.mesh_preview_display_type) // show weight painted mesh by default
break
case ProcessStep.BindPose: