@@ -37,46 +37,11 @@ export class StepAnimationsListing extends EventTarget {
37
37
// Animation search functionality
38
38
public animation_search : AnimationSearch | null = null
39
39
40
- // -z will bring hip bone down
41
- // private hip_bone_offset: Vector3 = new Vector3(0, 0, 0) // -z will bring hip bone down. Helps set new base hip position
42
- // private hip_bone_scale_factor_z: number = 1.0 // this is used to scale the hip bone position for animations
43
-
44
40
/**
45
41
* The amount to raise the arms.
46
42
*/
47
43
private warp_arm_amount : number = 0.0
48
44
49
- // the human model has a hip bone that needs position changes applied
50
- // This will be for animations like falling. We need to capture the offset between
51
- // the original position and the new position from our edited armature
52
- // public calculate_hip_bone_offset (original_armature: Object3D, edited_armature: Object3D): void {
53
- // const original_hip_bone: Bone = this.find_bone_from_armature(original_armature, 'DEF-hips')
54
- // const edited_hip_bone: Bone = this.find_bone_from_armature(edited_armature, 'DEF-hips')
55
- // this.hip_bone_offset = this.calculate_position_offset(original_hip_bone.position, edited_hip_bone.position)
56
-
57
- // // calculate the scale factor for the animation clips
58
- // // this should take the distance between the original and edited armature
59
- // // and divide it by the original armature hip bone position
60
- // this.hip_bone_scale_factor_z = edited_hip_bone.position.z / original_hip_bone.position.z
61
-
62
- // // small T-pose offset that somehow is getting lost
63
- // this.hip_bone_offset = this.hip_bone_offset.sub(new Vector3(0, 0, -0.04))
64
- // }
65
-
66
- // private find_bone_from_armature (armature: Object3D, bone_name: string): Bone | null {
67
- // let found_bone: Bone | null = null
68
- // armature.traverse((object: Object3D) => {
69
- // if (found_bone === null && object.name === bone_name && object instanceof Bone) {
70
- // found_bone = object
71
- // }
72
- // })
73
- // return found_bone
74
- // }
75
-
76
- // private calculate_position_offset (position_1: Vector3, position_2: Vector3): Vector3 {
77
- // return new Vector3(position_1.x - position_2.x, position_1.y - position_2.y, position_1.z - position_2.z)
78
- // }
79
-
80
45
private has_added_event_listeners : boolean = false
81
46
82
47
constructor ( theme_manager : ThemeManager ) {
@@ -125,8 +90,6 @@ export class StepAnimationsListing extends EventTarget {
125
90
this . skinned_meshes_to_animate = [ ]
126
91
this . animation_mixer = new AnimationMixer ( )
127
92
this . current_playing_index = 0
128
- // this.hip_bone_offset = new Vector3(0, 0, 0)
129
- // this.hip_bone_scale_factor_z = 1.0
130
93
this . animation_player . clear_animation ( )
131
94
}
132
95
@@ -238,6 +201,9 @@ export class StepAnimationsListing extends EventTarget {
238
201
this . ui . dom_animations_listing_count . innerHTML = animation_length_string + ' animations'
239
202
}
240
203
204
+ // when we scaled the skeleton itself near the beginning, we kept track of that
205
+ // this scaling will affect position keyframes since they expect the original skeleton scale
206
+ // this will fix any issues with position keyframes not matching the current skeleton scale
241
207
private apply_skeleton_scale_to_position_keyframes ( animation_clips : AnimationClip [ ] ) : void {
242
208
animation_clips . forEach ( ( animation_clip : AnimationClip ) => {
243
209
animation_clip . tracks . forEach ( ( track : KeyframeTrack ) => {
@@ -248,7 +214,6 @@ export class StepAnimationsListing extends EventTarget {
248
214
values [ i + 1 ] *= this . skeleton_scale
249
215
values [ i + 2 ] *= this . skeleton_scale
250
216
}
251
- console . log ( track . name , this . skeleton_scale , track . values )
252
217
}
253
218
} )
254
219
} )
0 commit comments