Hi.
I’ve word in several programming language bue I’m quite new to python, and i dont quite understant the events of it. Right now i’m making an addon where i have markers names and markers frames on a UiList. Everything works fine, i can list everything perfectly.
But i want when i chose(click) an element of the UiList, for it to change the current frame.
My UiList is very simple:
class ListItem(bpy.types.PropertyGroup):
name = StringProperty(
name="Name",
description="A name for this item",
default="Untitled")
frame = IntProperty(
name="Any other property you want",
description="",
default=0)
class MY_UL_List(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
# We could write some code to decide which icon to use here...
custom_icon = 'MARKER_HLT'
# Make sure your code supports all 3 layout types
if self.layout_type in {'DEFAULT', 'COMPACT'}:
layout.label(item.name, icon = custom_icon)
layout.label(str(item.frame))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label("", icon = custom_icon)
…
#class that draws the UiList
row.template_list(“MY_UL_List”, “The_List”, sce, “my_list”, sce, “list_index” )
…
register classes
Thank you in advance for your help