I wanted to create a List in a Panel where i could add items to and delete them like the list for shape keys for example.
in the properties_data_armature_rigify.py i found a nice example how to do that but somehow it wont work.
i always get the error that an RNA type derived from IDPropertyGroup was expected. unfortunately thats exactly it gets o.O
heres the code:
import bpy
class test(bpy.types.IDPropertyGroup):
pass
mesh = bpy.types.Mesh
mesh.CollectionProperty(attr="testcollection", type=test, name="", description="")
mesh.IntProperty(attr="testcollection_index", default=-1, min=-1, max=100)
class OBJECT_PT_hello(bpy.types.Panel):
bl_label = "Hello World Panel"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
def draw(self, context):
layout = self.layout
obj = context.object.data
row = layout.row()
layout.template_list(obj, "testcollection", obj, "testcollection_index", rows=1)
bpy.types.register(OBJECT_PT_hello)
compare that to the code in the properties_data_armature_rigify.py in your /scripts/ui/ folder and tell me the difference between my code and the rigify code.
i realy cant spot my mistake