Blender Python API - feedback wanted

Hi,

We are working on getting the Blender toolset and API to a quality level so that it can be widely adopted by studios.

We would be interested in your feedback on the python API for Blender 2.5

http://www.blender.org/documentation/250PythonDoc/contents.html

http://sites.google.com/site/satishgoda/blender/learningblender25/introduction-to-blender-python-api

Thanks for your time, let me know what questions you have.

Tom Musgrove
LetterRip

Hi Tom,

I’m writing an exporter with this API (really like it :cool:)

I had some problems while doing so:

  1. 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.

  1. 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.

I forwarded that to our API guru, hopefully we will fix that or explain it etc.

Thanks for the feedback.

He said,

final transform converted to rotation, probably what you want.

quat = obj.matrix.to_quat()

or if you want the euler converted to a quat…

quat = obj.rotation_euler.to_quat()