Writing the pendulum add-on
Using what we have learned so far, we can write an add-on that sets up a pendulum for the active object.
We will start with the steps from Chapter 3, and create a .py
file for our add-on.
Setting the environment
Let’s create a folder for Chapter 9 in our PythonScriptingBlender project. In the Blender Preferences area, set the ch9
folder as the Scripts Folder property and restart the application. We can create our new files and folder in our IDE (VS Code in this book) so that we can start editing:
- Select
PythonScriptingBlender/ch9/addons
in VS Code. - Create a new file by clicking the New File icon.
- Name the new file
pendulum.py
. - Open the file by double-clicking it.
We can now add the standard elements of most add-ons:
- Add-on information
- The
Operator
class - The menu function
- Registration functions
Next, we’ll learn how to write this information.
Writing the information
As usual...