bnp
bnp copied to clipboard
🐣 bnp: Blender numpy utilities https://bnp.readthedocs.io/
🐣 bnp: Blender numpy utilities

✌ About
bnp contains simple numpy utilities for Blender.
Latest version: 0.4.1
You can easily read Blender's objects with numpy!
🚶 Installation
bnp installation
- Copy
bnp/bnpto$YOUR_BLENDER_PATH/scripts/addons_contribmanually
e.g. $YOUR_BLENDER_PATH: C:/Program Files/Blender Foundation/Blender 2.83/2.83
- OK: C:/Program Files/Blender Foundation/Blender 2.83/2.83/scripts/addons_contrib/bnp/init.py
- NG: C:/Program Files/Blender Foundation/Blender 2.83/2.83/scripts/addons_contrib/bnp/bnp/init.py
(Appendix) how to install numpy
If you have some errors when you import numpy, please run following commands.
- Download get-pip.py in
$YOUR_FAVORITE_DIRECTORY % cd $YOUR_FAVORITE_DIRECTORY% $BLENDER_PYTHON_PATH/python get-pip.pywith administrator mode orsudo% $BLENDER_PIP_PATH/pip install numpywith administrator mode orsudo
e.g.
$YOUR_FAVORITE_DIRECTORY:C:/Users/YOUR_ACCOUNT/Downloads$BLENDER_PYTHON_PATH:C:/Program Files/Blender Foundation/Blender 2.83/2.83/python/bin
🎲 Tiny example
import bnp
vertices = bnp.objname2np("Cube")
print(vertices) # (vtx_num, 3)
bnp.scene.put_cubes(vertices)
You can find more examples at https://github.com/j20232/bnp/tree/master/examples
To check examples, please open *.blend(sample scenes) files in your file browser.
Don't open *.blend files from Blender.exe because this library doesn't work due to the permission.
🗄 Features
-
[x] Numpy converter
- Translation matrices of
bpy.types.Objectandbpy.types.Armature - Vertex positions of
bpy.types.Mesh - Skinning weights (vertex weights) of
bpy.types.Object - Blend shapes (shape keys) of
bpy.types.Object - Camera parameters from
bpy.types.Camera
- Translation matrices of
-
[x] Clear unused objects in your Scene
-
Green box: box deformed with Blender's LBS
-
White boxes: vertices calculated with bnp's LBS
-
You can easily add blend shapes (shape keys) and insert the keyframes to the scene
-
You can easily write rendered images and gbuffers as
.png,.bmp,.jpg,.exr,.hdrand.mp4 -
Left: GLTF default shading
-
Right: PBR shading based on cgbookcase.com
-
You can easily load PBR textures!
- Please get them from FREE PBR, textures.com and so on
You can render images with offscreen mode as follows:
$ blender.exe -b .\004_set_camera_and_render_image.blend -P ..\examples\004_set_camera_and_render_image.py
📄 Documentation
https://bnp.readthedocs.io/en/latest/
👁 Versions
- Blender 2.83.0 (or later)
- numpy: 1.19.0 (or later)
⚠️ LICENSE
GPL-3.0 (based on Blender)
If bnp violates any licenses, I'll delete this repository immediately.
Please let me know if there're problems.
🐈 Author
mocobt



