+ def create_transform_statement(self, instance):
+ from .datafile import Statement
+
+ st = Statement("transform")
+
+ loc = instance.matrix_world.to_translation()
+ st.sub.append(Statement("position", *tuple(loc)))
+
+ quat = instance.matrix_world.to_quaternion()
+ if instance.rotation_mode in ('XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX'):
+ angles = [a*180/math.pi for a in quat.to_euler()]
+ st.sub.append(Statement("euler", *angles));
+ else:
+ st.sub.append(Statement("rotation", quat.angle*180/math.pi, *tuple(quat.axis)))
+
+ scale = instance.matrix_world.to_scale()
+ st.sub.append(Statement("scale", *tuple(scale)))
+
+ return st
+