blenderaddons-ng

A Visual Studio Code project to develop, test, and profile Blender add-ons

Repository badge with link
Blender Version badge Python Version badge Test Status Test coverage badge

Background

blenderaddons-ng focuses on modern, automated testing of Blender add-ons, with an emphasis on creating and running unit tests for core add-on functionality, rather than just interactive testing. The repository provides a clean, reproducible development environment for building, testing, profiling, and benchmarking Blender add-ons.

This project is the next generation of the blenderaddons repo, designed for better structure, automation, and developer experience.

Project Goals

Folder Structure

Installation

git clone https://github.com/varkenvarken/blenderaddons-ng.git
cd ./blenderaddons-ng

Open the folder in VS Code. If prompted, rebuild the DevContainer, or select "Rebuild Container" from the command palette to begin developing.

Requirements

See requirements.txt and the Dockerfile for details.

Development Workflow

  1. Copy add_ons/example_simple.py to add_ons/<new_name>.py as a starting point.
  2. Modify the code, update the bl_info dictionary and OPERATOR_NAME variable.
  3. Copy tests/test_example_simple.py to tests/test_<new_name>.py and write thorough tests.

Profiling

Use line_profiler to profile operators. Example:

LINE_PROFILE=1 python3 add_ons/example_simple.py

Expensive code should be factored out from execute() for profiling.

Benchmarking

Use pytest-benchmark to measure performance. Example:

pytest-benchmark compare 0001 0002

Example benchmarks are in tests/test_example_simple.py. Results are stored in .benchmarks (gitignored).

Contributing

Pull requests for improvements or new add-ons are welcome! Please ensure that your contributions:

See the GitHub repository for more details and to get involved.

License

This project is open source and available under the GPL v3 or later.