Skip to content

hsimpson/blender-coding-getting-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Blender python coding with VSCode: getting started

Tested with Blender 2.93.1 on Windows 10-64bit but should work also with older/newer versions of Blender and other OS like Linux or macOS

Steps:

1. Install Blender 2.93.1

2. Install VSCode

3. Install Python (same version which is used within Blender: 2.93.1 uses Python 3.9.2)

  1. to check which version of Python use used within Blender: just open Blender and switch to the "scripting" view and read the Python version: Blender Python Version
  2. Ensure to add Python to environment variables

4. Install and setup VSCode Python Extension

  1. Select Python interpreter: CTRL+SHIFT+P -> Python: Select Interpreter
    • select the interpreter from installed Python
  2. Select Python Linter: CTRL+SHIFT+P -> Python: Select Linter
    • select pylint and probably install it

5. Install and setup VSCode Python Langage Server

  1. Configure in your User Settings:
"python.languageServer": "Pylance"

6. Test Python extension

  1. Open "./src/hello_world.py"
  2. Right-click anywhere in the editor window and select Run Python File in Terminal
  3. You should see something like this:
Hello World!

Python version: 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)]

7. Install and setup auto complete/intelli sense modules for Blender python API

  1. Download or clone https://github.com/Korchy/blender_autocomplete
  2. Add to User Settings:
"python.autoComplete.extraPaths": [
"<PATH_TO_BLENDER_AUTOCOMPLETE>/blender_autocomplete/2.93"
],
"python.analysis.extraPaths": [
    "<PATH_TO_BLENDER_AUTOCOMPLETE>/blender_autocomplete/2.93"
],
"python.linting.pylintArgs": [
    "--init-hook",
    "import sys; sys.path.append('<PATH_TO_BLENDER_AUTOCOMPLETE>,/blender_autocomplete/2.93')"
],

8. Test script within Blender

  1. Open the blender_coding.blend file with Blender
  2. Toggle console: Blender Console
  3. Run the blender_hello_world.py script, it should display the blender version in the console window Blender Python run

9. Setup remote debugging

TODO!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages