- background job style cleanup.
[blender.git] / doc / python_api / examples / bpy.props.2.py
1 """
2 PropertyGroup Example
3 +++++++++++++++++++++
4
5 PropertyGroups can be used for collecting custom settings into one value
6 to avoid many indervidual settings mixed in together.
7 """
8
9 import bpy
10
11
12 class MaterialSettings(bpy.types.PropertyGroup):
13     my_int = bpy.props.IntProperty()
14     my_float = bpy.props.FloatProperty()
15     my_string = bpy.props.StringProperty()
16
17 bpy.utils.register_class(MaterialSettings)
18
19 bpy.types.Material.my_settings = \
20     bpy.props.PointerProperty(type=MaterialSettings)
21
22 # test the new settings work
23 material = bpy.data.materials[0]
24
25 material.my_settings.my_int = 5
26 material.my_settings.my_float = 3.0
27 material.my_settings.my_string = "Foo"