Book Image

Python Scripting in Blender

By : Paolo Acampora
5 (1)
Book Image

Python Scripting in Blender

5 (1)
By: Paolo Acampora

Overview of this book

Blender, a powerful open source 3D software, can be extended and powered up using the Python programming language. This book teaches you how to automate laborious operations using scripts, and expand the set of available commands, graphic interfaces, tools, and event responses, which will enable you to add custom features to meet your needs and bring your creative ideas to life. The book begins by covering essential Python concepts and showing you how to create a basic add-on. You’ll then gain a solid understanding of the entities that affect the look of Blender’s objects such as modifiers, constraints, and materials. As you advance, you’ll get to grips with the animation system in Blender and learn how to set up its behavior using Python. The examples, tools, patterns, and best practices present throughout the book will familiarize you with the Python API and build your knowledge base, along with enabling you to produce valuable code that empowers the users and is ready for publishing or production. By the end of this book, you’ll be able to successfully design add-ons that integrate seamlessly with the software and its ecosystem.
Table of Contents (19 chapters)
1
Part 1: Introduction to Python
7
Part 2: Interactive Tools and Animation
13
Part 3: Delivering Output

Running our add-on

Even if we have yet to add any graphic element, our add-on is ready for its first launch. We can use two tricks in order to run add-ons that are not yet listed, which is quite common in development.

Refreshing the add-on list

Since we have added a new script folder and just changed its content, we need to either restart Blender or refresh the add-on information. To do that, we can click the Refresh button at the top right in the Add-ons preferences window.

Figure 3.7: The Collector add-on, loaded from the project folder

Figure 3.7: The Collector add-on, loaded from the project folder

If we start typing the name of our add-on in the filter bar, the entries in the list will narrow down until Collector becomes easy to find and enable. Now, it’s time to execute our operator via the Blender Source Bar.

Running from the Search Toolbar

Operators that are not part of any graphic element are for internal usage – that is, callable by other operators but not by the user.

To make...