@@ -250,6 +250,8 @@ export class Bootstrap {
250
250
251
251
/**********
252
252
* MAIN PROCESS FLOW LOGIC
253
+ * I am doing else if here since the bindpose step changes the step at the end
254
+ * we don't want to trigger the animation listing too early since it is the case after
253
255
*********/
254
256
if ( this . process_step === ProcessStep . LoadModel ) {
255
257
// reset the state in the case of coming back to this step
@@ -262,8 +264,7 @@ export class Bootstrap {
262
264
263
265
this . load_model_step . begin ( )
264
266
}
265
-
266
- if ( this . process_step === ProcessStep . LoadSkeleton ) {
267
+ else if ( this . process_step === ProcessStep . LoadSkeleton ) {
267
268
// add event listener. TODO: put this in the load skeleton process step
268
269
this . load_skeleton_step . addEventListener ( 'skeletonLoaded' , ( ) => {
269
270
this . edit_skeleton_step . load_original_armature_from_model ( this . load_skeleton_step . armature ( ) )
@@ -290,8 +291,7 @@ export class Bootstrap {
290
291
// this needs to happen at the end since it is expecting the mesh data
291
292
this . load_skeleton_step . begin ( )
292
293
}
293
-
294
- if ( this . process_step === ProcessStep . EditSkeleton ) {
294
+ else if ( this . process_step === ProcessStep . EditSkeleton ) {
295
295
this . load_skeleton_step ?. dispose ( )
296
296
297
297
this . regenerate_skeleton_helper ( this . edit_skeleton_step . skeleton ( ) )
@@ -306,16 +306,14 @@ export class Bootstrap {
306
306
this . mesh_preview_display_type = ModelPreviewDisplay . WeightPainted
307
307
this . changed_model_preview_display ( this . mesh_preview_display_type ) // show weight painted mesh by default
308
308
}
309
-
310
- if ( this . process_step === ProcessStep . BindPose ) {
309
+ else if ( this . process_step === ProcessStep . BindPose ) {
311
310
this . transform_controls . enabled = false // shouldn't be editing bones
312
311
this . calculate_skin_weighting_for_models ( )
313
312
this . scene . add ( ...this . weight_skin_step . final_skinned_meshes ( ) ) // add final skinned mesh to scene
314
313
this . weight_skin_step . weight_painted_mesh_group ( ) . visible = false // hide weight painted mesh
315
314
this . process_step_changed ( ProcessStep . AnimationsListing )
316
315
}
317
-
318
- if ( this . process_step === ProcessStep . AnimationsListing ) {
316
+ else if ( this . process_step === ProcessStep . AnimationsListing ) {
319
317
this . process_step = ProcessStep . AnimationsListing
320
318
this . animations_listing_step . begin ( this . load_skeleton_step . skeleton_type ( ) , this . load_skeleton_step . skeleton_scale ( ) )
321
319
@@ -485,27 +483,14 @@ export class Bootstrap {
485
483
// when we have are in the "Weight Painted" display mode
486
484
this . weight_skin_step . calculate_weights_for_all_mesh_data ( true )
487
485
488
- // TODO: maybe way to update references instead of removing and adding?
489
- // this.remove_skinned_meshes_from_scene() // clear any existing skinned meshes in the scene
490
- // this.scene.add(...this.weight_skin_step.final_skinned_meshes())
491
-
492
486
// remember our skeleton position before we do the skinning process
493
487
// that way if we revert to try again...we will have the original positions/rotations
494
488
this . load_model_step . model_meshes ( ) . visible = false // hide our unskinned mesh after we have done the skinning process
495
489
496
490
// re-define skeleton helper to use the skinned mesh)
497
491
if ( this . weight_skin_step . skeleton ( ) === undefined ) {
498
492
console . warn ( 'Tried to regenerate skeleton helper, but skeleton is undefined!' )
499
- return
500
- }
501
-
502
- // we might want to test out the binding algorithm to see various hitboxes
503
- // if we are doing debugging, go to that view, if no debugging, go straight to thd animation listing step
504
- if ( this . edit_skeleton_step . show_debugging ( ) ) {
505
- return
506
493
}
507
-
508
- console . log ( 'What does our scene look like after we are done skinning:' , this . scene )
509
494
}
510
495
511
496
public test_bone_weighting_success ( ) : boolean {
0 commit comments