BPY plus modules for adding new properties types
The matrix_4x4_property module
It realized the Matrix4x4Property type
Usage example:
We create a list of elements with matrices for using in a UIList. We add a single element to this list. The world matrix of the active object is stored to this element.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import bpy from bpy_plus.props.matrix_4x4_property import Matrix4x4Property class TestList(bpy.types.PropertyGroup): matrix_ptr: bpy.props.PointerProperty( type=Matrix4x4Property ) bpy.utils.register_class(TestList) bpy.types.Scene.test_list = bpy.props.CollectionProperty(type=TestList) new_list_element = bpy.context.scene.test_list.add() new_list_element.matrix_ptr.matrix = bpy.context.object.matrix_world print(bpy.context.scene.test_list[0].matrix_ptr.matrix) |
The quaternion_property module
It realized the QuaternionProperty type
Usage example:
We create a list of elements with quaternions for using in a UIList. We add a single element to this list. The rotation quaternion of the active object is stored to this element.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import bpy from bpy_plus.props.quaternion_property import QuaternionProperty class TestList(bpy.types.PropertyGroup): quaternion_ptr: bpy.props.PointerProperty( type=QuaternionProperty ) bpy.utils.register_class(TestList) bpy.types.Scene.test_list = bpy.props.CollectionProperty(type=TestList) new_list_element = bpy.context.scene.test_list.add() new_list_element.quaternion_ptr.quaternion = bpy.context.object.rotation_quaternion print(bpy.context.scene.test_list[0].quaternion_ptr.quaternion) |