Get a list of Pose Libraries and show it in UI

With this single line, it is possible to show a dropdown of actions:

self.layout.prop(ob.animation_data, "action")

This also allows selection of pose libraries…

But there is a problem - selecting actions/pose libraries from this dropdown also changes current Action… with is something I don’t want to happen.

I can’t simply find out a way to access list containing only actions that are Pose Libraries, or directly just access list pose libraries. I tried to find it in and bpy.context.object etc. but so far no progress.

Is it possible to get a list of pose libraries and render it in UI?

Well I got it solved… somewhat.

It isn’t a very good solution.

  1. I used regex to filter actions to show only those that have pose in their name… maybe there is some collection that only contains Pose Library Actions, but I couldn’t find it.

  2. I Used UI List / template_list to show the list. It still a mystery to me, what kinds of data you can actually show with it, and how can I find out what works with it.

Blender API seems to be really hard to learn (for me), short and uninformative names. I could only hack this together using examples…

import bpy

# Draw uilist row
class ACTION_UL_poselibs(bpy.types.UIList):

    def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
        if self.layout_type in {'DEFAULT', 'COMPACT'}:
            layout.prop(item, "name", text="", emboss=False, icon_value=icon)
        elif self.layout_type in {'GRID'}:

    def filter_items(self, context, data, propname):
        # shorthand
        fn = bpy.types.UI_UL_list

        # lists
        group = getattr(data, propname)
        flt_flags = []
        flt_neworder = []

        # filter to show only those containing "pose"
        flt_flags = fn.filter_items_by_name("[Pp]ose", self.bitflag_filter_item, group, "name")
        flt_neworder = fn.sort_items_by_name(group, "name")

        return flt_flags, flt_neworder

# Draw panel + uilist
class UIList_poselibs(bpy.types.Panel):
    bl_label = 'PoseLibs UI List'
    bl_idname = 'OBJECT_PT_PoselibsUIList'
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "object"

    # draw uilist
    def draw(self, context):
        layout = self.layout
        ob = context.object
        layout.template_list("ACTION_UL_poselibs", "",, "actions", ob, "list_index")