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)
- to check which version of Python use used within Blender: just open Blender and switch to the "scripting" view and read the Python version:
- Ensure to add Python to environment variables
4. Install and setup VSCode Python Extension
- Select Python interpreter: CTRL+SHIFT+P -> Python: Select Interpreter
- select the interpreter from installed Python
- Select Python Linter: CTRL+SHIFT+P -> Python: Select Linter
- select pylint and probably install it
5. Install and setup VSCode Python Langage Server
- Configure in your User Settings:
"python.languageServer": "Pylance"
- Open "./src/hello_world.py"
- Right-click anywhere in the editor window and select Run Python File in Terminal
- 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)]
- Download or clone https://github.com/Korchy/blender_autocomplete
- 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')"
],
- Open the blender_coding.blend file with Blender
- Toggle console:
- Run the blender_hello_world.py script, it should display the blender version in the console window
TODO!