I’ve tried below in the python console:
>>> import bpy
>>>
>>> class MyMaterialSubProps(bpy.types.PropertyGroup):
... my_float: bpy.props.FloatProperty()
...
>>> class MyMaterialGroupProps(bpy.types.PropertyGroup):
... sub_group: bpy.props.PointerProperty(type=MyMaterialSubProps)
...
>>> def register():
... bpy.utils.register_class(MyMaterialSubProps)
... bpy.utils.register_class(MyMaterialGroupProps)
... bpy.types.Material.my_custom_props: bpy.props.PointerProperty(type=MyMaterialGroupProps)
...
>>> def unregister():
... del bpy.types.Material.my_custom_props
... bpy.utils.unregister_class(MyMaterialGroupProps)
... bpy.utils.unregister_class(MyMaterialSubProps)
...
>>> register()
>>> bpy.types.Material.my_custom_props
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
AttributeError: type object 'Material' has no attribute 'my_custom_props'
>>> del bpy.types.Material.my_custom_props
Traceback (most recent call last):
File "<blender_console>", line 1, in <module>
AttributeError: my_custom_props
I want to know how exactly the annotation works, according to the PEP0526, it only add a key-value pair in __annotations__
dict, how these annotation really added the identifier ? to my test , del
didn’t really delete the identifer. Is there anything I understand incorrectly?