Docs: update examples for 2.8x
Use fields for properties
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user