0

In blender docs

template_ID(data, property, new='', open='', unlink='', filter='ALL', live_icon=False, text='', text_ctxt='', translate=True)

filter (enum in ['ALL', 'AVAILABLE'], (optional)) – Optionally limit the items which can be selected

From the available docs it looks like filter is used to filter out particular ids based on some sort of parameter. I tried to add filter in blender ui's code where template_id is used. But didn't get any result. So how can I use filter parameter.

Reigen
  • 895
  • 5
  • 15

1 Answers1

2

Linked to current scene, or any.

enter image description here

Have used this for setting the active object, or pointer properties to bpy.types.Object instances.

  • 'AVAILABLE' for objects linked to context scene
  • 'ALL' for all objects in the blend file.

Setting an object not linked to a scene to the active object of that scene is going to cause issues.

GIF shows following draw method used in (Used in gif above with Templates > Python > UI Panel Simple)

    def draw(self, context):
        layout = self.layout
    obj = context.object

    col = layout.column()
    col.template_ID(context.view_layer.objects, "active", filter='AVAILABLE')
    col.template_ID(context.view_layer.objects, "active", filter='ALL')

See Limit "prop_search" to Specific Types of Objects re using poll to narrow down selection options for pointers.

batFINGER
  • 84,216
  • 10
  • 108
  • 233