Scripting Blender

I've been playing with Blender lately. Playing in a 3d environment is mentally liberating, while dexterously challenging. Working a detached mouse + a 3d mouse can be cumbersome, but powerful once you get the hang of it.

Something that drew me to Blender was its scripting capabilities. Python is supported by the API and offers most of the functionality of the UI.

For example, generating objects in a Scene can be done via script, and Scenes can be rendered as images or animations.


Sample Blender Scripts

Render a Scene to .png

echo "alias blender=/Applications/Blender/blender.app/Contents/MacOS/blender" >> ~/.bash_profile

blender -b -P python-blender-test.py -f 60

blender -b opentecture.blend -x 1 -o //render -a

blender -b opentecture.blend -f 1

Send an http request via Python

import requests
import json

data = {"test" : 123}
data_json = json.dumps(data)
headers = {'Content-type': 'application/json'}
url = "http://localhost/api"
response = requests.post(url, data=data_json, headers=headers)

About Afomi

Afomi is the digital sandbox of Ryan Wold, who is always evolving this to better share inspirations and aspirations.

About Ryan

Ryan is a systems-thinking Product Developer and Designer who practices agile, test-driven, and lean continuous software delivery, while solving problems with people.

Random Posts