A very common task during production is to perform repetitive actions on multiple .blend files (fixing paths, adjusting settings, etc.). This process can be time consuming and error-prone.
After writing small ad-hoc scripts for years, today we are sharing bbatch, a command line tool used to find .blend files in a given directory and execute a provided Python script on each file. Here is a quick overview.
Simply provide bbatch with a directory and a Python script and bbatch will execute that script on all the .blends it can find within the directory structure. bbatch’s functionality is only limited by a user's imagination and Python scripting abilities. Any script that can be run by Blender’s text editor can easily be executed on a directory of .blend files via bbatch.
bbatch was developed during the production of Wing It!, an earlier iteration of this tool was Blender Purge, which was used to crawl directories and purge unused data blocks. bbatch retains the purge functionality and adds several new features, to quickly execute scripts on a directory of .blend files.
How does it work?
First, check out the repository at projects.blender.org.
bbatch uses Blender’s command line arguments to open a “background blender” and runs a user provided script. bbatch does not create additional save versions when saving after script execution. To use bbatch follow the instructions on the bbatch readme.
Comments are welcome!
If you have feedback or suggestions, reach out via the comments or in the Blender Studio Pipeline Issue Board. Enjoy bbatch!