Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

adapted import for blender coordinate system #39

Open
wants to merge 1 commit into
base: blender_28
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions export_seanim.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ def get_rot_quat(bone, anim_type):
def gen_loc_key(frame, pose_bone, anim_type):
# Remove the multiplication later
loc = get_loc_vec(pose_bone, anim_type) * g_scale
return SEAnim.KeyFrame(frame, (loc.x, loc.y, loc.z))
return SEAnim.KeyFrame(frame, (loc.x, loc.z, loc.y))

# Generate a SEAnim compatible ROT keyframe from a given pose bone


def gen_rot_key(frame, pose_bone, anim_type):
quat = get_rot_quat(pose_bone, anim_type)
return SEAnim.KeyFrame(frame, (quat.x, quat.y, quat.z, quat.w))
return SEAnim.KeyFrame(frame, (quat.x, quat.z, quat.y, -quat.w))


def gen_scale_key(frame, pose_bone, anim_type):
'''
Generate an SEAnim compatible SCALE keyframe from a given pose bone
'''
scale = tuple(pose_bone.scale)
return SEAnim.KeyFrame(frame, scale)
return SEAnim.KeyFrame(frame, (scale[0], scale[2], scale[1]))


def resolve_animtype(self):
Expand Down
11 changes: 7 additions & 4 deletions import_seanim.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ def load_seanim(self, context, progress, filepath=""):
for k, key in enumerate(tag.posKeys):
# Currently the conversion is only here because I never
# added scaling options for Blender-CoD
offset = Vector(key.data) * g_scale
offset = Vector((
key.data[0], key.data[2], key.data[1]
)) * g_scale

# Viewanims are SEANIM_TYPE_ABSOLUTE - But all children of
# j_gun has a SEANIM_TYPE_RELATIVE override
Expand Down Expand Up @@ -207,8 +209,9 @@ def load_seanim(self, context, progress, filepath=""):

for k, key in enumerate(tag.rotKeys):
# Convert the Quaternion to WXYZ
quat = Quaternion(
(key.data[3], key.data[0], key.data[1], key.data[2]))
quat = Quaternion((
-key.data[3], key.data[0], key.data[2], key.data[1]
))
angle = quat.to_matrix().to_3x3()

bone.matrix_basis.identity()
Expand Down Expand Up @@ -247,7 +250,7 @@ def load_seanim(self, context, progress, filepath=""):
(-1, bone.scale[axis])) # Add the control keyframe

for k, key in enumerate(tag.scaleKeys):
scale = Vector(key.data)
scale = Vector((key.data[0], key.data[2], key.data[1]))

for axis, fcurve in enumerate(fcurves):
fcurve.keyframe_points[
Expand Down