Docs: update examples for 2.8x

Use fields for properties
This commit is contained in:
2019-03-22 00:07:06 +11:00
parent bd1299f6a4
commit dd1132416e
13 changed files with 90 additions and 60 deletions

View File

@@ -9,18 +9,17 @@ Custom properties can be added to any subclass of an :class:`ID`,
import bpy
# Assign a collection
# Assign a collection.
class SceneSettingItem(bpy.types.PropertyGroup):
name = bpy.props.StringProperty(name="Test Prop", default="Unknown")
value = bpy.props.IntProperty(name="Test Prop", default=22)
name: bpy.props.StringProperty(name="Test Property", default="Unknown")
value: bpy.props.IntProperty(name="Test Property", default=22)
bpy.utils.register_class(SceneSettingItem)
bpy.types.Scene.my_settings = \
bpy.props.CollectionProperty(type=SceneSettingItem)
bpy.types.Scene.my_settings = bpy.props.CollectionProperty(type=SceneSettingItem)
# Assume an armature object selected
# Assume an armature object selected.
print("Adding 2 values!")
my_item = bpy.context.scene.my_settings.add()