I've created an own UIList
for an addon. It's just used to display some properties of Action
(as that one doesn't have a properties panel in the Action Editor), so it must get populated with actions and not with user input.
It actually must be updated manually, with a button I added below it. Althought this already works, I think it's not nice, so I was wondering if there was any way to update the list automatically.
I tried to override the draw
method and override it there, but then the List (and the panel in general) isn't displayed at all.
def draw(self, context):
# LIST UPDATE
bpy.types.UIList.draw(self, context)
Here's my UIList
implementation:
class MyUIList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
custom_icon = 'OBJECT_DATAMODE'
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.label(bpy.data.actions[item.Index].name, icon = custom_icon)
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label("", icon = custom_icon)
Thanks in advance!