Blender script to convert models...

I wrote a bit about this here (see the gist at the bottom), using a blender python script to import various different model formats and then export them as collada. My code isn’t finished yet, but I’d like to release it to the community once I’ve got it done.

At the moment, I’m using bound_box to get the size of all the components of the scene, then rescale everything in the scene so that’s 1 unit in the longest dimension. Is there an easier way of doing this than getting the maximum size of the objects in the scene in each dimension, then dividing them all by that size?

At least not in python, there’s nothing like a scene domain / bounding box. So you really need to get the maximum extent, then scale everything down (you may use the transform.resize operator for that).

Okay thanks, I’ll try transform.resize(). I’m having trouble using a TRACK_TO constraint to get the camera to look at the origin (I have an empty object at the origin). Does the code here look about right?

Are there any scripts out there for using blender to convert between model formats? I don’t want to reinvent the wheel if there’s something else I can contribute to.

Not sure if my last reply got posted. :confused:

Is there an existing script for using blender from the command line to convert between models? I don’t want to reinvent the wheel if there’s another project I can contribute too.

Got a bit farther with this - using a blender script to convert models into three.js format…

Is it possible to decimate models via a script in blender? I’d like to do some LOD stuff, where far away meshes are a 100 triangle approximation, and load the full detail model when you get closer - or is that too hard to do in a script?