Fix T75615: Export Animation to Nuke (chan file) Broken curve

Use previous rotation as euler_compat on matrix conversion
This commit is contained in:
Damien Picard 2020-12-05 16:08:54 +01:00
parent b2948ae5fa
commit be0c6b3d9e
Notes: blender-bot 2023-02-14 18:57:47 +01:00
Referenced by issue #75615, Export Animation to Nuke (chan file) Broken curve
1 changed files with 6 additions and 2 deletions

View File

@ -22,7 +22,7 @@
It takes the currently active object and writes it's transformation data
into a text file with .chan extension."""
from mathutils import Matrix
from mathutils import Matrix, Euler
from math import radians, degrees
@ -39,6 +39,7 @@ def save_chan(context, filepath, y_up, rot_ord):
# prepare the correcting matrix
rot_mat = Matrix.Rotation(radians(-90.0), 4, 'X').to_4x4()
previous_rotation = Euler()
filehandle = open(filepath, 'w')
fw = filehandle.write
@ -65,10 +66,13 @@ def save_chan(context, filepath, y_up, rot_ord):
fw("%f\t%f\t%f\t" % t[:])
# create rotation component
r = mat.to_euler(rot_ord)
r = mat.to_euler(rot_ord, previous_rotation)
fw("%f\t%f\t%f\t" % (degrees(r[0]), degrees(r[1]), degrees(r[2])))
# store previous rotation for compatibility
previous_rotation = r
# if the selected object is a camera export vertical fov also
if camera:
vfov = degrees(camera.angle_y)