dynamic PropertyGroup / Panel I'm building a Blender (2.75) plugin for our 3D engine (https://github.com/aerys/minko). So far so good.

One of the things I'd like to do is to mimic Unity's feature that scripts can be directly added to scene nodes in the editor. Such scripts properties can then be edited directly through a dynamic property inspector built by parsing the script public members.

I've already done what I think is the worst part: using libclang and the python bindings to parse my C++ headers and retrieve a list of the public properties (each property being a public getter/setter pair). I can use this list to generate a list of Blender properties like so:

def get_properties(self):
    if not self._props:
        c = self._get_minko_script_classes(self._clangSource.cursor)
        setters = self._get_class_setters(c[0])

        self._props = {}
        for name, set_type in setters.items():
            if set_type == 'bool':
                self._props[name] = bpy.props.BoolProperty(name=name)
            elif set_type == 'int':
                self._props[name] = bpy.props.IntProperty(name=name)
            elif set_type == 'minko::math::ivec2':
                self._props[name] = bpy.props.IntVectorProperty(name=name, size=2)
            elif set_type == 'minko::math::ivec3':
                self._props[name] = bpy.props.IntVectorProperty(name=name, size=3)
            elif set_type == 'minko::math::ivec4':
                self._props[name] = bpy.props.IntVectorProperty(name=name, size=4)
            elif set_type == 'float':
                self._props[name] = bpy.props.FloatProperty(name=name)
            elif set_type == 'minko::math::vec2':
                self._props[name] = bpy.props.FloatVectorProperty(name=name, size=2)
            elif set_type == 'minko::math::vec3':
                self._props[name] = bpy.props.FloatVectorProperty(name=name, size=3)
            elif set_type == 'minko::math::vec4':
                self._props[name] = bpy.props.FloatVectorProperty(name=name, size=4)
            elif set_type == 'std::string':
                self._props[name] = bpy.props.StringProperty(name=name)

    return self._props


Now I want to display those properties (self._props) in a panel. But Blender examples are all about "static" property definition, declaring properties as class members... I guess Python would let me create dynamic classes definitions. But it sounds hacky.

So my question is: how to pass this list of Blender *Property to the UI to display it properly in a Blender friendly way?

Thank you,
Using Custom Properties (ID properties) works:

for key, key_type in props.items():
    context.active_object[MinkoScript.format_property_name(i, key)] = script.get_property_default_value(key)


In order to be able to iterate on a specific script properties to draw the panel, I also store the properties dict in an ID property:

context.active_object[MinkoScript.format_property_name(i, '$properties')] = props


Then in the panel:

for i in range(0, context.active_object['minko_num_scripts']):
    layout.label(
        context.active_object[MinkoScript.format_property_name(i, '$name')] + ':',
        icon='TEXT'
    )
    box = layout.box()
    script_id = 'minko_script_' + str(i)
    script_props = context.active_object[MinkoScript.format_property_name(i, '$properties')]
    keys = sorted(script_props.keys())
    for key in keys:
        row = box.row(True)
        col = row.column(True)
        col.label(key + ':')
        col = row.column(True)
        col.prop(
            context.active_object,
            '["' + MinkoScript.format_property_name(i, key) + '"]',
            text=''
        )
    row = box.row(True)
    row.operator(MinkoRemoveScriptOperator.bl_idname, text="Remove").script_id = i
    row.operator(MinkoReloadScriptOperator.bl_idname, text="Reload").script_id = i