This document shows the procedure for generating modules by yourself.
You can choose the method to generate modules.
The generating script can be run on Python >= 3.7. Check your Python version is >= 3.7.
The generating script uses the packages listed on
requirements.txt.
Execute below command to install requirement packages.
git clone https://github.com/nutti/fake-bpy-module.git
cd fake-bpy-module
pip install -r requirements.txt
After generating modules, you need to setup IDE to enable a code completion.
Download Blender binary from Blender official download site. Download Blender whose version is the version you try to generate modules.
git clone git://git.blender.org/blender.git
Download the fake-bpy-module sources from GitHub.
Use Git and clone fake-bpy-module repository.
git clone https://github.com/nutti/fake-bpy-module.git
Or, you can download .zip file from GitHub.
https://github.com/nutti/fake-bpy-module/archive/master.zip
cd fake-bpy-module/src
bash gen_module.sh <source-dir> <blender-dir> <branch/tag/commit> <blender-version> <output-dir> <mod-version>
<source-dir>
: Specify Blender sources directory.<blender-dir>
: Specify Blender binary directory.<branch/tag/commit>
: Specify target Blender source's branch for the generating modules.- If you want to generate modules for 2.79, specify
v2.79
- If you want to generate modules for newest Blender version, specify
master
- If you want to generate modules for 2.79, specify
<blender-version>
: Specify blender version.<output-dir>
: Specify directory where generated modules are output.<mod-version>
: Modify APIs by using patch files located inmods
directory.- If you specify
2.80
, all patch files undermods/2.80
will be used. - Files located in
mods/common
directories will be used at any time.
- If you specify
By default, this command uses Python interpreter by calling python
command.
If you want to use other Python interpreter, you can specify by PYTHON_BIN
environment variable.
PYTHON_BIN=/path/to/python3.7 bash gen_module.sh <source-dir> <blender-dir> <branch/tag/commit> <output-dir> <mod-version>
Download Blender binary from
Blender official download site.
Download Blender whose version is the version you try to generate modules.
Place Blender binary to some directory.
In this tutorial, Blender binary assumes to be placed on
/workspace/blender-bin
. (i.e. Blender executable is located on
/workspace/blender-bin/blender
)
export WORKSPACE=/workspace
export BLENDER_BIN=${WORKSPACE}/blender-bin
export BLENDER_SRC=${WORKSPACE}/blender
cd ${WORKSPACE}
git clone git://git.blender.org/blender.git
Be sure to match the version between sources and binary.
If you try to generate modules for v2.79, you should use git checkout v2.79
.
cd ${BLENDER_SRC}
git checkout [branch/tag/commit]
Generated .rst documents are located on ${BLENDER_SRC}/doc/python_api/sphinx-in
.
${BLENDER_BIN}/blender --background --factory-startup -noaudio --python-exit-code 1 --python doc/python_api/sphinx_doc_gen.py
Download the fake-bpy-module sources from GitHub.
Use Git and clone fake-bpy-module repository.
cd ${WORKSPACE}
git clone https://github.com/nutti/fake-bpy-module.git
Or, you can download .zip file from GitHub.
https://github.com/nutti/fake-bpy-module/archive/master.zip
cd fake-bpy-module/src
mkdir -p mods/generated_mods
${BLENDER_BIN}/blender --background --factory-startup -noaudio --python-exit-code 1 --python gen_modfile/gen_external_modules_modfile.py -- -m addon_utils -o mods/generated_mods/gen_modules_modfile
${BLENDER_BIN}/blender --background --factory-startup -noaudio --python-exit-code 1 --python gen_modfile/gen_external_modules_modfile.py -- -m keyingsets_builtins -a -o mods/generated_mods/gen_startup_modfile
mkdir -p mods/generated_mods/gen_bgl_modfile
python gen_modfile/gen_bgl_modfile.py -i ${BLENDER_SRC}/source/blender/python/generic/bgl.c -o mods/generated_mods/gen_bgl_modfile/bgl.json
<blender-version>
: Specify Blender version.
python gen.py -i <input-dir> -o <output-dir> -f <format> -b <blender-version> -m <mod-version>
-i <input-dir>
: Specify input directory (The directory where .rst files are located in process 4). In this document,<input-dir>
should be${BLENDER_SRC}/doc/python_api/sphinx-in
.-o <output-dir>
: Specify output directory. (The directory where generated files will be located)-d
: Dump internal data structures to<output-dir>
as the files name with suffix-dump.json
-f <format>
: Format the generated code by<format>
convention.pep8
: Format generated code by pep8.
-b <blender-version>
: Specify blender version.-m <mod-version>
: Modify APIs by using patch files located inmods
directory.- If you specify
2.80
, all patch files undermods/2.80
will be used. - Files located in
mods/common
directories will be used at any time.
- If you specify