Skip to content

Commit

Permalink
Fix #6, rotation matrix of tag must be inverted
Browse files Browse the repository at this point in the history
  • Loading branch information
neumond committed Jul 9, 2017
1 parent 1d0a663 commit 03151e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions io_scene_md3/export_md3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions io_scene_md3/import_md3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 03151e4

Please sign in to comment.