PyCharm+Blender开发配置指南
2024-02-25
2 min read

最近需要写比较多的 blender 脚本,奈何在 mac 下没有完整的 pip 安装包,导致在 pycharm 下代码补全总是不行,虽然有 copilot 辅助也能基本搞定,但总是难以了解到很多细节。于是全网搜了下,整理出来下面的方法,以作记录。
首先声明这个方法并非我原创,来源可见这些链接:
- https://github.com/Korchy/blender_autocomplete/tree/master
- https://b3d.interplanety.org/en/using-external-ide-pycharm-for-writing-blender-scripts/
- https://github.com/mutantbob/pycharm-blender/blob/master/python_api/pypredef_gen.py
- https://blenderartists.org/t/accessing-blender-python-api-in-pycharm/1274770/5
1. 确认 blender 版本

2. 下载提前解析好的 pyref 仓库内容
git clone https://github.com/Korchy/blender_autocomplete.git
3. 设置 pycharm 的 python interpreter 环境
- 设置一个常用的 python interpreter,如下是我常用的 miniforge 环境:

- Show All:

- 设置环境路径:

- 添加刚才下载的仓库路径,注意版本号!比如我这里的 blender 是 3.6.5,则使用 3.6 目录:
