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.
Compiling, libraries, modules, coding guidelines and porting
2 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 12 guests