What I'm trying to do is write a ui for an export script to export multiple selected actions of the selected armature(s) to multiple files.

I can't seem to find an example to define an operator for use in a layout.box() instance which can be selected like the layout.template_list() widget.

Of course, I'm working with a python list of gathered actions, so that widget is out of the question, since Blender has no internal support for this.

So, how do I define an operator which can be "selected" from a box widget?

Mockup of what I'm working with:

definitely draw(this, context ):

    # not typing the gathering code.

    box = layout.box()
    for action in gathered_actions:
        row = box.row()
        row.label( text=action.name, translate=False, icon="ACTION" ) # what I currently have.

I want to replace the label with an operator, but don't know how to build the operator.

Might I note, I'm not experienced with blender, just python, so I'm delving into a new area with this.

  • 1
    $\begingroup$ Not sure what do you mean by box widget. Something like this: blender.stackexchange.com/questions/30444/…? Otherwise please provide an example. $\endgroup$
    – p2or
    Sep 14, 2016 at 8:15
  • 1
    $\begingroup$ layout.box() only gives a visible variation from the surrounding panel, anything inside the box works the same as any other item you place in a panel. $\endgroup$
    – sambler
    Sep 14, 2016 at 10:10
  • $\begingroup$ @poor yes, although your example uses template_list instead of box, which doesn't work with python lists... I'm currently throwing labels inside the box which works like I want, except I can't "select" them, so how do I design an operator to replace the label? $\endgroup$
    – Tcll
    Sep 14, 2016 at 11:54
  • $\begingroup$ What kind of lists? Can you elaborate? Some operators and the UIlist in a box (regarding to your comment). $\endgroup$
    – p2or
    Sep 14, 2016 at 12:38
  • $\begingroup$ Raw python lists list() containing the actions gathered from the selected armature(s). $\endgroup$
    – Tcll
    Sep 14, 2016 at 13:22

1 Answer 1


Ok, so after some reviewing and paying around with stuff...

The short answer is forget about it...
blender's api just doesn't have enough thought put into it, and what's needed simply doesn't exist.

The long answer, build a collection property and wrap it with a pointer property for use in a template_list.

Here's my code for it with an example showing it in action: example

Sorry my code is an image...
phone's can only do so much...

So I think that makes me the first to do something like this :)

Now if only I could get active selections to have a blue background rather than white text. >_>


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .