https://github.com/FrandSX/sxbatcher-blender

<aside> đź’ˇ NOTE: This page refers to an open source cross-platform asset management and multi-process exporter project on Github

</aside>

Summary

SX Batcher is a lightweight project to address two issues:

  1. Asset Management for game projects
  2. Exporting bottlenecks

The above issues are approached with:

  1. An asset catalogue file
  2. A lightweight Blender addon for asset tagging
  3. A multi-process (and distributed) asset export tool (And optional headless scripts)

Other pipeline practices that are extremely beneficial:

Image 1: SX Batcher main view, where assets are selected from the catalogue for batch processing.

Image 1: SX Batcher main view, where assets are selected from the catalogue for batch processing.


Requirements


Single System Setup (sx_batcher_gui.py)

Exporting FBX files from the Blender GUI is a single-thread process. Significant performance gains are achieved when exporting large amounts of assets in parallel.

Startup on a Single Computer

Requirements:

  1. Blender must be installed on the system. Since the location of the binary is important, Linux installs using Snap or Flatpak may run into sandboxing issues.
  2. Python 3 must be installed on the system. On Windows, install from python.org instead of Windows Store to avoid issues.
  3. SX Tools Blender addon.
  4. Assets in a folder structure
  5. Catalogue file (sx_assets.json)

Launch SX Batcher by running sx_batcher_gui.py script. This is done on terminal/command prompt by typing:

python sx_batcher_gui.py

On Windows, you can right-click on the script file, and choose to open with Python. After this, double-clicking on the script file will run it automatically.

You should now see the screen similar to Image 1, but the catalogue is empty.

Settings

Click on the Settings tab.

  1. Point Blender Path to the blender executable (not the folder!)
  2. Point SX Tools Library Path to the location of SX Tools. SX Tools is a Blender addon used in the same project as SX Batcher. For general use SX Tools is not required, and easily edited out of the source code.
  3. Catalogue Path must point to the location of the json-file containing the index of the project assets (named sx_assets.json by default). This file should be in the root folder of your assets hierarchy!
  4. Export Path should point to the folder in your game project containing the processed assets.
  5. Click on Save Settings to make the settings persist over app restarts. This saves out sx_conf.json into the folder where sx_batcher_gui.py is located.

Multi-process exporting functions by spawning headless Blender instances, each passed a separate blend file to process, together with a python script sx_batch.py that contains the processing steps.

Image 2: The settings tab, make sure the necessary paths are properly set!

Image 2: The settings tab, make sure the necessary paths are properly set!

Image 3: SX Batcher utilizes all CPUs available on the system, as well as those made available over LAN.

Image 3: SX Batcher utilizes all CPUs available on the system, as well as those made available over LAN.


Multi-System Setup (sx_batcher_gui.py)

Using SX Batcher GUI

Set up each remote node in local network similarly to single-system setup. The only differences are:

  1. Catalogue file is not needed on remote nodes
  2. Duplicates of assets do not need to be located on remote nodes
  3. Export path is not needed

Therefore, in the Settings tab, both Catalogue Path and Export Path can be left blank on a remote node.

Finally, on Network tab, enable Share CPU Cores, and choose the number of cores to share.

The UI lists the logical cores instead of physical ones. Initial tests seemed to indicate best performance by utilizing all logical cores for headless processing. Optimizations by limiting batches to physical core counts etc. only reduced overall performance.

The remote node starts instantly broadcasting its availability for batch processing, and shows up on any system where Use Network Nodes is enabled. This should be done on the master node that sends asset batches to be processed.

<aside> đź’ˇ The Master Node does need to have all the assets and catalogue properly configured!

</aside>

Image 4: The node list dynamically updates when “Use Network Nodes” is enabled

Image 4: The node list dynamically updates when “Use Network Nodes” is enabled


SX Batcher (sxbatcher.py)

SX Batcher is a Blender addon with two functions:

  1. Allows objects to be added to the Catalogue, in a category, with optional tags
  2. Maintains the revision number of the modified Blender files

Add SX Batcher to Blender via the addon settings. Make sure the catalogue file location is selected correctly.

A new tab appears in the 3D View.

<aside> đź’ˇ NOTE: When adding tags, separate them using only space (no commas)

</aside>

<aside> đź’ˇ NOTE: If SX Tools addon is in use, SX Batcher is redundant! The same functionality is present in SX Tools

</aside>

Screenshot from 2022-05-04 12-44-29.png