Hi Tom,
I’m writing an exporter with this API (really like it )
I had some problems while doing so:
- I was unable to get the rotation of an object without setting the rotation mode. So I had to do this to get the quaternion:
# obj is object from bpy.data.objects
old_mode = obj.rotation_mode
obj.rotation_mode = 'QUATERNION'
stream.write("rot " + quat_to_string(obj.rotation_quaternion) + "
")
obj.rotation_mode = old_mode
If I remember correctly rotation_quaternion just returned 0 0 0 1 without setting the rotation mode to QUATERNION.
This confused me at first.
- I don’t understand how the location and rotation works when an object is attached to a parent. location 0 0 0 seems to be the location where it was at the time of assigning the parent not the position of the parent. I couldn’t find this hidden offset.