BlenderKit / blenderkit_asset_tasks

Automated processing of assets. This repo holds scripts for autoprocessing and configuration for Github Actions.
5 stars 2 forks source link
3d automation blender

blenderkit_asset_tasks

Scripts to do automatic processing of Blender assets in the database.

Structure

Scripts in the root are standalone scripts which does, prefferably one, task. They can import from blender_server_utils, but should not import from one another. If some code is to be shared, it should be placed in blender_server_utils. Standalone scripts in root often need do some stuff right inside Blender. For this they should start Blender with some script from blender_bg_utils. All code which has to be run inside Blender should be in blender_bg_utils.

Requirements for Blender

Assets tasks have to start a Blender to make the job and the questions is which version? Basically there are 2 types of scripts in this repo:

Multiple versions

There are tasks where we need the asset to be processed in the same Blender version as original to keep compatibility with as old Blender as possible. Like in case of generating resolutions which will be later imported by users into their Blenders. Script automatically detects closest Blender to use.

We define the path BLENDERS_PATH to directory containing multiple installations of Blender. Each version of the Blender should be placed in directory named X.Y so the scripts can detect it automatically: image

For example:

BLENDERS_PATH="/Users/ag/blenders"
ls /Users/ag/blenders
2.93
3.0
3.1
4.0
4.1

NOTE: On MacOS you will need to create a symbolic links.

For multiple versions scripts you can use docker image blenderkit/headless-blender:multi-version. It has the blenders directory at: /home/headless/blenders.

Single versions

There are tasks in which we do not care about compatibility with older Blenders. Latest Blender brings better stability and performance in these cases. Like in case of generating GLTFs or renders which does not get imported back to users' Blenders. Scripts will just use the specified path directly to Blender executable defined by BLENDER_PATH.

For example: BLENDER_PATH=/Applications/Blender420/Contents/MacOS/Blender

For single versions scripts you can use docker image blenderkit/headless-blender:blender-x.y. It has the blender executable placed at: /home/headless/blender/blender.