- # XXX Parent relationships screw up the location and rotation
- st.sub.append(Statement("position", o.location[0], o.location[1], o.location[2]))
- if o.rotation_mode=="AXIS_ANGLE":
- angle = o.rotation_axis_angle[0]
- axis = o.rotation_axis_angle[1:]
+
+ ss = Statement("transform")
+
+ loc = o.matrix_world.to_translation()
+ ss.sub.append(Statement("position", *tuple(loc)))
+
+ quat = o.matrix_world.to_quaternion()
+ if o.rotation_mode in ('XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'):
+ angles = [a*180/math.pi for a in quat.to_euler()]
+ ss.sub.append(Statement("euler", *angles));