Hi there,
I hope it’s the right place to ask. I would like to use the template_any_id layout with custom properties in an add-on. I defined an id pointer property and an id_type enum, like this:
class OtherAnimationTargets(PropertyGroup):
''' Other Animation Targets, any ID and data path.'''
name: StringProperty(
name='Name',
)
id: PointerProperty(
name='ID',
type=ID,
)
id_type: EnumProperty(
name='ID Type',
items=ID_types,
)
Right now the ID types are hard set as a list of tuples (which feels wrong, but I haven’t found a different method):
ID_types = [
('ACTION', 'Action', 'Action', 'ACTION', 0),
('ARMATURE', 'Armature', 'Armature', 'ARMATURE_DATA', 1),
('BRUSH', 'Brush', 'Brush', 'BRUSH_DATA', 2),
...
]
Unfortunately, I am not able to use the template right now, because the id field is greyed out. I can assign an ID through python, but the uilayout won’t allow to edit it (see the image below). Here is how I call it in the ui:
col_other.template_any_ID(active_any_target, property="id", type_property='id_type', text="ID block")
Currently, I think that I am simply misusing the template, so I posted here instead of filing a report.
Thanks for taking the time to read!