Is there any way to extend a CollectionProperty class?. I have the following problem.
Im writing an addon that reads and writes to a custom xml wrapper class but it fails on register, getting RestrictContext or RestrictData errors.
#A custom collection class class myItems(): __items =  def __init__(self): ... def add(self): ... class myAddonProperties(bpy.types.PropertyGroup): myAddonItems = myItems() bpy.utils.register_class(myAddonProperties) bpy.types.scene.myAddon = PointerProperty(myAddonProperties)
It fails on enable the addon getting RestrictContext error
class ItemProperties(bpy.types.PropertyGroup): pass bpy.utils.register_class(ItemProperties) class myCollection(CollectionProperty): def __init__(self, type): self.type = type def __call__(self, type): self.type = type bpy.utils.register_class(myCollection) class myAddonProperties(bpy.types.PropertyGroup): myItems = myCollection(type = ItemProperties)
The first example works fine if its executed from the text editor but they fail when they are loaded as an addon.
The real question is, is it posible to write an addon that has a custom class that reads and writes to Blender classes?
PD: Im accesing myItems from the propertygroup as self.myItems, will it work if i access myItems as myAddonProperties.myItems?