Import a 3D Model and automatically assign and export animations
TypeScript
Remove some dead comments with hip bone
Scott Petrovicd182f382b61c
diff --git a/src/lib/processes/animations-listing/StepAnimationsListing.ts b/src/lib/processes/animations-listing/StepAnimationsListing.tsindex 985f258..75109ef 100644--- a/src/lib/processes/animations-listing/StepAnimationsListing.ts+++ b/src/lib/processes/animations-listing/StepAnimationsListing.ts@@ -37,46 +37,11 @@ export class StepAnimationsListing extends EventTarget {// Animation search functionalitypublic animation_search: AnimationSearch | null = null- // -z will bring hip bone down- // private hip_bone_offset: Vector3 = new Vector3(0, 0, 0) // -z will bring hip bone down. Helps set new base hip position- // private hip_bone_scale_factor_z: number = 1.0 // this is used to scale the hip bone position for animations-/*** The amount to raise the arms.*/private warp_arm_amount: number = 0.0- // the human model has a hip bone that needs position changes applied- // This will be for animations like falling. We need to capture the offset between- // the original position and the new position from our edited armature- // public calculate_hip_bone_offset (original_armature: Object3D, edited_armature: Object3D): void {- // const original_hip_bone: Bone = this.find_bone_from_armature(original_armature, 'DEF-hips')- // const edited_hip_bone: Bone = this.find_bone_from_armature(edited_armature, 'DEF-hips')- // this.hip_bone_offset = this.calculate_position_offset(original_hip_bone.position, edited_hip_bone.position)-- // // calculate the scale factor for the animation clips- // // this should take the distance between the original and edited armature- // // and divide it by the original armature hip bone position- // this.hip_bone_scale_factor_z = edited_hip_bone.position.z / original_hip_bone.position.z-- // // small T-pose offset that somehow is getting lost- // this.hip_bone_offset = this.hip_bone_offset.sub(new Vector3(0, 0, -0.04))- // }-- // private find_bone_from_armature (armature: Object3D, bone_name: string): Bone | null {- // let found_bone: Bone | null = null- // armature.traverse((object: Object3D) => {- // if (found_bone === null && object.name === bone_name && object instanceof Bone) {- // found_bone = object- // }- // })- // return found_bone- // }-- // private calculate_position_offset (position_1: Vector3, position_2: Vector3): Vector3 {- // return new Vector3(position_1.x - position_2.x, position_1.y - position_2.y, position_1.z - position_2.z)- // }-private has_added_event_listeners: boolean = falseconstructor (theme_manager: ThemeManager) {@@ -125,8 +90,6 @@ export class StepAnimationsListing extends EventTarget {this.skinned_meshes_to_animate = []this.animation_mixer = new AnimationMixer()this.current_playing_index = 0- // this.hip_bone_offset = new Vector3(0, 0, 0)- // this.hip_bone_scale_factor_z = 1.0this.animation_player.clear_animation()}@@ -238,6 +201,9 @@ export class StepAnimationsListing extends EventTarget {this.ui.dom_animations_listing_count.innerHTML = animation_length_string + ' animations'}+ // when we scaled the skeleton itself near the beginning, we kept track of that+ // this scaling will affect position keyframes since they expect the original skeleton scale+ // this will fix any issues with position keyframes not matching the current skeleton scaleprivate apply_skeleton_scale_to_position_keyframes (animation_clips: AnimationClip[]): void {animation_clips.forEach((animation_clip: AnimationClip) => {animation_clip.tracks.forEach((track: KeyframeTrack) => {@@ -248,7 +214,6 @@ export class StepAnimationsListing extends EventTarget {values[i + 1] *= this.skeleton_scalevalues[i + 2] *= this.skeleton_scale}- console.log(track.name, this.skeleton_scale, track.values)}})})