Batch Import/Export

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Posts: 0
Joined: Sun Nov 07, 2010 11:30 pm
Location: Hamilton, New Zealand

Batch Import/Export

Post by ldo » Fri Nov 30, 2012 11:22 am

I thought it would be useful to be able to perform bulk operations in Blender’s batch mode. For example, I download a bunch of Collada-format models from the Google/Trimble 3D Warehouse, and I want to loop over them and convert them all to .blend files from the command line, without having to tediously click-click-click for each one.

Unfortunately, Blender’s import/export functions are implemented as operators. But operators represent interactive user actions. This makes them rather useless in batch mode—try to use them that way, and you get “operator poll() failed, context is incorrect” errors.

The solution is to implement separate API calls for these functions that are not operators. For example, the following patch adds a “collada_import” function to the bpy.utils module, that can be successfully invoked from batch mode. ... group_id=9

Posts: 0
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Post by CoDEmanX » Sat Dec 01, 2012 1:06 pm

using operators can be a hassle, much appreciated that you did some low level-abilities! There should be low level functions for basically everything...
I'm sitting, waiting, wishing, building Blender in superstition...

Post Reply