Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Python Scripting in Blender

You're reading from  Python Scripting in Blender

Product type Book
Published in Jun 2023
Publisher Packt
ISBN-13 9781803234229
Pages 360 pages
Edition 1st Edition
Languages
Author (1):
Paolo Acampora Paolo Acampora
Profile icon Paolo Acampora

Table of Contents (19) Chapters

Preface 1. Part 1: Introduction to Python
2. Chapter 1: Python’s Integration with Blender 3. Chapter 2: Python Entities and API 4. Chapter 3: Creating Your Add-Ons 5. Chapter 4: Exploring Object Transformations 6. Chapter 5: Designing Graphical Interfaces 7. Part 2: Interactive Tools and Animation
8. Chapter 6: Structuring Our Code and Add-Ons 9. Chapter 7: The Animation System 10. Chapter 8: Animation Modifiers 11. Chapter 9: Animation Drivers 12. Chapter 10: Advanced and Modal Operators 13. Part 3: Delivering Output
14. Chapter 11: Object Modifiers 15. Chapter 12: Rendering and Shaders 16. Index 17. Other Books You May Enjoy Appendix

Writing the Vert Runner add-on

In this section, we will write an add-on that animates the selected objects along the geometry of the active object. The animation will trace a path that connects the vertices of a mesh, hence the name Vert Runner:

Figure 7.16: Animating a toy along the vertices of a path

Figure 7.16: Animating a toy along the vertices of a path

This can be a basis for procedural walks or patrols, motion effects, or any other case where we have a geometrical path.

In this operator, the selected objects and the active ones are treated differently: the active object is the reference geometry on which the selected objects are moved.

Setting the environment

Let’s start by adding a new script to our add-ons directory:

  1. Select PythonScriptingBlender/ch7/addons in VS Code.
  2. Create a new file by clicking on the New File icon.
  3. Name the new file vert_runner.py.
  4. Open the file by double-clicking it.

As usual, we will start with the add-on information.

Writing the...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}