0% found this document useful (0 votes)
150 views18 pages

Python Automation in Blender Guide

The document discusses how Blender can be automated with Python. Blender is a 3D modeling and animation software that Python is built into as its main scripting language. The document outlines Blender's capabilities, how Python integrates with it, features of Blender's Python support, tips for using it, and provides examples of modeling and creating a UI component with Python.

Uploaded by

btf73
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views18 pages

Python Automation in Blender Guide

The document discusses how Blender can be automated with Python. Blender is a 3D modeling and animation software that Python is built into as its main scripting language. The document outlines Blender's capabilities, how Python integrates with it, features of Blender's Python support, tips for using it, and provides examples of modeling and creating a UI component with Python.

Uploaded by

btf73
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Automating Blender with Python
  • What Blender Can Do
  • Blender: 3D Modelling
  • Blender: 2D Animation
  • Blender: Visual Effects
  • Blender: Video Editing
  • The Role of Python in Blender
  • Blender Python Features
  • Blender Python Tips
  • Use The Scripting Window
  • Practical Use of The Scripting Window
  • Demos
  • See Model Demo
  • Final Model Code
  • Unexpected Use Cases

Automating Blender with

Python
Austin Godber
May 2021
DesertPy
First off, what does Blender do?
● 3D Modelling & Animation
● 2D Animation
● Visual Effects
● Video Editing
● Much more
Blender: 3D Modelling

Source: Blender Guru - [Link]


Blender: 2D Animation

Source: Cuty Dina [Link]


Blender: Visual Effects

Source: Ian Hubert - [Link]


Blender: Video Editing

Source: Code, Tech and Tutorials - [Link]


What does this have to do with Python?
● Python is built in as it’s main scripting language.
● Many of the plugins are written in Python.
● Python is very well integrated and exposed through the UI, which makes
using it easier.
● Maybe there are surprising things you can do with this.
Blender Python Features

● Edit any data the user interface can (Scenes, Meshes, Particles etc.).
● Modify user preferences, keymaps and themes.
● Run tools with own settings.
● Create user interface elements such as menus, headers and panels.
● Create new tools.
● Create interactive tools.
● Create new rendering engines that integrate with Blender.
● Subscribe to changes to data and it’s properties.
● Define new settings in existing Blender data.
● Draw in the 3D Viewport using Python.
Source: [Link]
Blender Python Tips
● Enable Developer Extras
● Enable Python Tooltips
○ Now you can see python function names in
many “On Hover” info boxes.
● Start Blender from Terminal if possible, so
you can see the python errors. YMMV.
● Use the latest blender (>2.9), download
from their site if needed.
● Use the scripting mode.
Use The Scripting Window
Render Window
Render Window

Python Console
Render Window

Python Console

Info Window
Demos
● Modeling
○ Source: [Link]
○ TODO
■ Add Material
■ Add Light
■ Add Camera
■ Render
● UI Component
○ Later Meeting
○ Source: [Link]
See Model Demo
Final Model Code
import bpy
from random import randint

[Link].select_all( action='SELECT')
[Link]( use_global =False)

number = 500

for i in range(0, number):


x = randint(- 10, 10)
y = randint(- 10, 10)
z = randint(- 4, 4)
[Link].primitive_monkey_add( location=(x,y,z))
[Link].shade_smooth()
Unexpected Use Cases
● zpy - blender plugin to generate synthetic 2D data (images) from 3D model for
training deep learning algorithms.

Automating Blender with 
Python
Austin Godber
May 2021
DesertPy
First off, what does Blender do?
●
3D Modelling & Animation
●
2D Animation
●
Visual Effects
●
Video Editing
●
Much more
Blender: 3D Modelling
Source: Blender Guru - https://www.youtube.com/watch?v=TPrnSACiTJ4&t=187s
Blender: 2D Animation
Source: Cuty Dina https://www.youtube.com/watch?v=C5FIsONz_zM
Blender: Visual Effects
Source: Ian Hubert - https://www.youtube.com/watch?v=FFJ_THGj72U&t=52s
Blender: Video Editing
Source: Code, Tech and Tutorials - https://www.youtube.com/watch?v=OtoM5b7i5z0
What does this have to do with Python?
●
Python is built in as it’s main scripting language.
●
Many of the plugins are writte
Blender Python Features
●
Edit any data the user interface can (Scenes, Meshes, Particles etc.).
●
Modify user preferences, k
Blender Python Tips
●
Enable Developer Extras
●
Enable Python Tooltips
○
Now you can see python function names in 
many “On H
Use The Scripting Window

You might also like