Skip to content

Environment setup

Manuel Martin edited this page Feb 23, 2023 · 5 revisions

Setup

While developing a Blender add-on, it might be useful to be able to load the add-on directly from the checkout folder instead of installing the add-on in Blender from a zip file.

Blender lets you set a directory to load add-ons at start time. You can find this setting in the preferences under File Paths -> Scripts. Blender will look for an addons folder inside the scripts directory so make sure that you follow that structure.

If you are not already using the Blender scripts preference, you can load the Hubs add-on from source simply by setting that preference to full_path_to_/hubs-blender-exporter.

If you are already using the Blender scripts preferences, you can load the Hubs add-on from that folder in two ways:

  • Overriding the Blender user scripts directory

You can override the Blender user scripts directory when launching Blender from a system terminal. This will temporarily use the new directory during the current session so it won't load the add-ons in the overriden path.

MacOS

BLENDER_USER_SCRIPTS=full_path_to_/hubs-blender-exporter /Applications/Blender.app/Contents/MacOS/Blender

Linux

BLENDER_USER_SCRIPTS=full_path_to_/hubs-blender-exporter blender

  • Symlinking your add-on to the Blender user scripts directory

Alternatively you can create a symbolic link pointing to full_path_to_/hubs-blender-exporter/addons/io_hubs_addon. This way you will load the Hubs add-on along with any other add-ons that you already have in the Blender scripts directory.

MacOS and Linux

ln -s full_path_to/hubs-blender-exporter/addons/io_hubs_addon full_path_to/blender_user_scrips_dir

Code Completion

To enable code completion for the Blender Python API you can install the Fake Blender Python API module collection. You can download the modules using the setup.sh script from the repository root or using pip.

Debugging

You can debug the add-on code with PyCharm or VSCode:

Testing

To run the tests locally, your system should have a blender executable in the path that launches the desired version of Blender.

The latest version of Yarn should also be installed.

Then, in the tests folder of this repository, run yarn install, followed by yarn run test.