Dynamic Classes no longer possible in 2.93

This is maybe a question for @ideasman42 . So in previous versions it was possible to something like this:

import bpy

data = {
             'bl_label': "MyNewType",
             'bl_idname': "test.MyNewType",
             '__annotations__': {
                "MyIntVal": (bpy.props.IntProperty, {'name': "MyIntVal", 'default': 42})
             }
         }

my_new_type = type("MyNewType", (bpy.types.PropertyGroup,), data)

bpy.utils.register_class(my_new_type)

bpy.types.Object.my_prop_grp = bpy.props.PointerProperty(type=my_new_type)
print(bpy.data.objects[0].my_prop_grp.MyIntVal)

Note that since the change to properties since 2.80 you have to specify them as annotations. Is anyone else using this? I think it’s a pretty valid use case, but in Blender 2.93 it doesn’t seem like the properties get created. Debugging a bit it seems like there is some internal data that gets set for properties. Is there another way to do this now?

1 Like

Task created: https://developer.blender.org/T86719

1 Like