Blender Add-on
• Author: Daniel Mačura •To preface this post, I’ll assume you are familiar with Python and have a grasp of Blender. We’ll be using Blender 4.1, how ever other versions should work too. We’ll look into the Blender API and create a simple addon with UI.
So, what’s an addon?
Well, simply put, an add-on is a Python module that allows you to extend the functionality of Blender. For Blender to recognize a plugin, we need to define three requirements. Firstly, bl_info, stores add-on metadata, such as the name and minimum supported Blender version. Secondly, we need to implement register() and unregister() methods.
=
An astute reader may notice that this add-on doesn’t yet use Blender API functions, so let’s change that!
Your first addon
Let’s start simply, we’ll delete the default cube. To achieve this, we’ll import the Blender API and register a new operator. Operators allow us to define actions that can be executed from a menu, buttons, or a keyboard shortcut.
=
"""Removes the pesky default cube""" # The tooltip used in menus and buttons
= # A unique identifier for buttons and menu items to reference
= # The display name in the interface
= # Allow undo operator
# Implicitely called when running the operator
= # Get all objects in Blender save file
# Deletes the cube (assuming it exits)
# Called when the add-on is enabled
# We add the operator to the
# Called when the add-on is disabled
# Entry point for the Belnder script editor to use
After we press the play button in the text editor window in Blender, the add-on is ready to be tested. It can be found in the Object menu in the 3D viewport, or alternatively, it can be searched by typing the phrase Remove default cube.