TomasHubelbauer / blender-script

A demo on running Blender with a Python script for generating and rendering a scene.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blender Script

  1. Add Blender to %PATH% and run pip install bpy
  2. Open the repository in VS Code
  3. Open script.py and render.png in split view side by side
  4. Open the VS Code terminal
  5. Run npx nodemon --exec blender --background --python script.py
  6. Observe the render.png preview refresh after each save
  7. Debug by either:
  • Removing --background
  • Splitting terminal and running blender --python script.py
  • Pressing F12 in Blender to preview render

Stalking Blender Operations' Corresponding Python

As per https://www.youtube.com/watch?v=45WZWqmpRQE, open up the Scripting workspace and do your work, observe the console to see the Python code for each operation that you carry out.

To-Do

Figure out how to get autocompletion for bpy

https://github.com/TomasHubelbauer/blender-python-intellisense

Set up a GitHub Actions workflow which installs Blender and runs the script

blender --python script.py on every push and push render.png to the repository.

About

A demo on running Blender with a Python script for generating and rendering a scene.

License:MIT License


Languages

Language:Python 100.0%