-
Notifications
You must be signed in to change notification settings - Fork 61
Using addons inside containers
To get started with using addons inside containers you will need
- Docker (See getting started)
- A folder with the addon
.zip
file and a Python file calledbpy_activate_addon.py
When running the container, you will need to mount the folder where the addon zip file and the Python script live as a Docker volume. cd
into the folder where the addon and Python script live and run
docker run --gpus all \
-w /addon-test \
--rm -it \
-v $(pwd):/addon-test \
-t nytimes/blender:latest \
/bin/bash
This should launch bash
in the container. If you run the ls
command, you should be able to see the addon .zip
file and Python script.
Open the bpy_activate_addon.py
in a code editor and use the following snippet to install and enable your addon (make sure you change the name of the addon to the actual name)
import bpy
# Register the addon and enable it
bpy.ops.preferences.addon_install(filepath='./your-addon-file.zip')
bpy.ops.preferences.addon_enable(module='your-addon')
# Use the addon directly from Python
# ...
Now run Blender headless inside the container with the Python file, it would look something like
blender --background --python ./bpy_activate_addon.py
Here is an example log of running the above with the Stop-motion-OBJ
addon.
If everything worked and you see a similar print you are ready to use the addon inside the container.
This repository is maintained by the Research & Development team at The New York Times and is provided as-is for your own use. For more information about R&D at the Times visit our website