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

Transforming objects indirectly

We have seen how to transform an object by altering its channels directly. There are two other ways to influence an object’s position, rotation, and scale. Object Constraints are special utilities that affect the transformation either by limiting certain values or by copying them from another object.

Then there is the possibility to arrange more objects in a hierarchy via Parenting, that is, by making one object belong to another.

We will see how these operations are reflected in Python.

Using Object Constraints

Constraints can move, rotate, or scale an object without changing its transform properties. Some of them, such as Copy Transforms, override the object transform completely; others, such as Limit Distance, operate on top of them.

Figure 4.5: Blender constraints menu

Figure 4.5: Blender constraints menu

Most constraints bind the transforms of more objects together, such as Copy Location, while others, such as Limit Location, have their...