7 ms·
By far the easiest way to work with .blend files is to shell out to Blender, let it open the file for you, and use Blender's Python API to get whatever you need
by edflsafoiewq 3y ago
By far the easiest way to work with .blend files is to shell out to Blender, let it open the file for you, and use Blender's Python API to get whatever you need.
blender -b your_file.blend -P python_script.py
Besides not having to parse the file yourself, there's lots of stuff (like "where is this object on frame X") that can't be read from .blend alone but need the actual algorithms Blender uses, so it's easiest to just reuse Blender itself.
The downside is the Python API breaks all the time.
- xtagon 3y agoWhen I was learning Blender as a teenager I discovered this and built a website that let you enter text and it generated a 3D model of the text. I was young and naïve and didn't realize how dumb of an architecture it was to simply shell out to a Blender process without any sort of queue, and it just spiked 100% cpu every time. But it worked!