Location Scale Tweaks

master
SE2Dev 2016-11-30 13:06:57 -05:00
parent 37e18b705e
commit 568070c13f
2 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,8 @@ from . import seanim as SEAnim
# TODO: Add support for defining modifier bones for Absolute anims
g_scale = 2.54 # This is the scale multiplier for exported anims - currently this is only here to ensure compatibility with Blender-CoD
def get_loc_vec(bone, anim_type):
if anim_type == SEAnim.SEANIM_TYPE.SEANIM_TYPE_ABSOLUTE and bone.parent is not None:
return bone.parent.matrix.inverted() * bone.matrix.translation
@ -125,7 +127,7 @@ def export_action(self, context, progress, action, filepath):
pose_bone = bone_info[0] # the first element in the bone_info array is the PoseBone
if use_keys_loc and (bone_info[1] == True):
loc = get_loc_vec(pose_bone, anim.header.animType) * 2.54 # Remove the multiplication later
loc = get_loc_vec(pose_bone, anim.header.animType) * g_scale # Remove the multiplication later
key = SEAnim.KeyFrame(frame - frame_start, (loc.x, loc.y, loc.z))
anim_bone.posKeys.append(key)

View File

@ -4,6 +4,8 @@ from progress_report import ProgressReport, ProgressReportSubstep
import os
from . import seanim as SEAnim
g_scale = 1 / 2.54 # This is the scale multiplier for exported anims - currently this is only here to ensure compatibility with Blender-CoD
# A list (in order of priority) of bone names to automatically search for when determining which bone to use as the root for delta anims
DeltaRootBones = ["tag_origin"]
@ -114,7 +116,7 @@ def load_seanim(self, context, progress, filepath=""):
fcurve.keyframe_points[0].co = Vector((-1, bone.location[axis])) # Add the control keyframe # Can be changed to Vector((-1, 0)) because Location 0,0,0 is rest pos
for k, key in enumerate(tag.posKeys):
offset = Vector(key.data) * 1 / 2.54 # Currently the conversion is only here because I never added scaling options for Blender-CoD
offset = Vector(key.data) * g_scale # Currently the conversion is only here because I never added scaling options for Blender-CoD
# Viewanims are SEANIM_TYPE_ABSOLUTE - But all children of j_gun has a SEANIM_TYPE_RELATIVE override
if animType == SEAnim.SEANIM_TYPE.SEANIM_TYPE_ABSOLUTE and bone.parent is not None: