From 03151e4439792f2f0fca93e3c1456021170217b6 Mon Sep 17 00:00:00 2001 From: neumond Date: Sun, 9 Jul 2017 15:16:05 +0300 Subject: [PATCH] Fix #6, rotation matrix of tag must be inverted --- io_scene_md3/export_md3.py | 6 ++---- io_scene_md3/import_md3.py | 5 ++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/io_scene_md3/export_md3.py b/io_scene_md3/export_md3.py index 0844795..7a3298d 100644 --- a/io_scene_md3/export_md3.py +++ b/io_scene_md3/export_md3.py @@ -115,13 +115,11 @@ def __init__(self, context): def pack_tag(self, name): tag = bpy.context.scene.objects[name] - ox = tuple(tag.matrix_basis[0][:3]) - oy = tuple(tag.matrix_basis[1][:3]) - oz = tuple(tag.matrix_basis[2][:3]) + m = tag.matrix_basis.transposed() return fmt.Tag.pack( name=prepare_name(tag.name), origin=tuple(tag.location), - axis=ox + oy + oz, + axis=sum([tuple(m[j].xyz) for j in range(3)], ()), ) def pack_animated_tags(self): diff --git a/io_scene_md3/import_md3.py b/io_scene_md3/import_md3.py index 5bda1aa..2f0f49c 100644 --- a/io_scene_md3/import_md3.py +++ b/io_scene_md3/import_md3.py @@ -45,10 +45,9 @@ def guess_texture_filepath(modelpath, imagepath): def get_tag_matrix_basis(data): - o = [mathutils.Vector(data.axis[k:k+3]) for k in range(0, 9, 3)] - basis = mathutils.Matrix() + basis = mathutils.Matrix.Identity(4) for j in range(3): - basis[j].xyz = o[j] + basis[j].xyz = data.axis[j::3] basis.translation = mathutils.Vector(data.origin) return basis