I’m trying to make a custom exporter for cameras, but I have found some problems.
- Change the rotation order of the camera in Blender to ZXY.
- Export as Alembic and read into Nuke.
- The Nuke camera matches the Blender camera.
When I try to do the same thing via a script it doesn’t match at all. This is the code I use (on the same camera, nothing changed):
item = bpy.data.objects[“Camera”]
rot_mat = mathutils.Matrix.Rotation(math.radians(-90.0), 4, ‘X’).to_4x4()
wm_src = item.matrix_world.copy()
wm = wm_src @ rot_mat
rot = wm.to_euler(“ZXY”)
rotx = math.degrees(rot.x)
roty = math.degrees(rot.y)
rotz = math.degrees(rot.z)
print(rotx, rotz, roty)
If I use the default XYZ the result is closer, but still not correct. I think I did have this working some time ago though, so that might be a user error.
What special magic does the Alembic exporter do with rotations when exporting?
- I’m fully aware this might be a user error.