BPY plus – a set of modules to extend the Blender Python API. This is an Open Source project based on Blender API. It extends it with several new features and makes using some of the “bpy” functions easier.
License and usage
The BPY Plus project is under the GNU GPL 3 license.
You can use BPY plus in your add-ons and scripts in any way for free.
Support
Your Patreon support helps the project developing and extending with new modules and classes. Any tier will be awesome. The special “BPY Plus support” tier gets you a special role and color on the B3D Interplanety Discord channel.
BPY plus modules
- about – a module with information about BPY plus itself
- bounding – a module for working with bounding objects
- collections – a module for working with collections
- color – a module for working with colors
- props – modules for adding additional Property types
- context – a module for working with context
- file_system – a module for working with the file system.
- math – a module with useful math functions
- mesh – a module to simplify work with mesh objects.
- names – a module to simplify work with object names.
- objects – a module to simplify work with 3D objects.
- output – a module to get output data
- render – a module to work with rendering
- transform – a module for working with 3D objects transformations
- vse – a module to simplify work with Video Sequence Editor (VSE)
Usage example
The “bpy_plus” package must be placed in the same directory as the project in which it will be used. Copy “bpy_plus” to your project directory. Now you can import “bpy_plus” modules as usual:
1 |
from bpy_plus import * |
And then use the required functionality.
For example, let’s find the bounding sphere around selected objects.
Import the “Bounding” class from the “bounding” module:
1 |
from bpy_plus.bounding import Bounding |
Now we can calculate the bounding sphere around the selected objects using the “sphere” method:
1 2 3 4 5 6 |
import bpy b_sphere = Bounding.sphere( objects=bpy.context.selected_objects, mode='GEOMETRY' ) |
This method returns the location and radius of the bounding sphere. Let’s add an empty with the type of sphere to the scene and set the resulting location and radius to it, to display the bounding sphere we found:
1 2 3 4 5 |
empty = bpy.data.objects.new(name='empty', object_data=None) empty.empty_display_type = 'SPHERE' empty.location = b_sphere[0] empty.empty_display_size = b_sphere[1] bpy.context.collection.objects.link(object=empty) |
The result:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import bpy from bpy_plus.bounding import Bounding b_sphere = Bounding.sphere( objects=bpy.context.selected_objects, mode='GEOMETRY' ) empty = bpy.data.objects.new(name='empty', object_data=None) empty.empty_display_type = 'SPHERE' empty.location = b_sphere[0] empty.empty_display_size = b_sphere[1] bpy.context.collection.objects.link(object=empty) |
Current version
1.8.3.
For Blender
2.93, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6