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

Using armature deformers

Armatures are deformation objects like lattices, but instead of using a grid, they rely on the translation, rotation, and scale of sub-objects called bones, in analogy with the human skeleton.

By default, bones are represented as octahedral sticks. Armatures can switch to Pose Mode, a special Blender mode in which bones can be animated individually using the techniques learned in Chapter 7.

The setup of an Armature modifier might take some extra steps but is similar to the one used for lattices.

Adding armature objects to the scene

To acquire familiarity with the bones, we will create a simple armature for Suzanne’s geometry:

  1. Open Blender or go back to the default scene via File | New | General.
  2. Delete the default Cube shape by pressing Canc or X | Delete.
  3. Add a monkey head to the scene using Add | Mesh | Monkey.
  4. Add an armature to the scene using Add | Armature | Single Bone.

At this point, we should see the tip...