Writing the Elevator add-on
Now that we know how to transform objects in Python, we can write a new add-on that contains a transformation operator.
This add-on allows us to move all selected objects above a certain height. It can be useful whenever we want to set a minimum height, that is, a floor, for our scene. As we did in Chapter 3, we start with a basic implementation, and we will then proceed to refine it. As usual, we start our work by setting a folder for the code of the chapter.
Setting the environment
As we did at the beginning of Chapter 3, we create a folder for Chapter 4 in our VS Code project; then, from Blender’s menu bar, we can access the Blender Preferences window and then File Paths to set the ch4
folder as the Scripts folder:
Figure 4.7: System folder for Chapter 4
Now it’s time to add a new file to our project:
- Select
PythonScriptingBlender/ch4/addons
in VS Code. - Create a new file by clicking the...