I am trying to write an add-on for an operator that:
1) Links to an external library 2) Displays a list of all the armatures in the linked group 3) Lets the user select a bunch of armatures out of the list 4) Makes proxies for the selected list.
I have managed to write parts 1 and 4, for which I wrote a class:
class LinkMakeProxy(bpy.types.Operator): """Link & Proxy""" bl_idname = "bpy.ops" bl_label = "Link & Proxy" @classmethod def poll(cls, context): ... def execute(self, context): ... def invoke(self, context, event): ...
but I am not sure how to display the list and get user input.
From reading the API guide, it seems as if I would need to create a new subclass:
class SelectArmaturesPanel(bpy.types.Panel): """Creates a Panel for Link & Proxy Operator""" bl_label = "Select Armatures Panel" bl_idname = "TOOL_PT_select_armatures" bl_space_type = 'VIEW_3D' bl_region_type = 'TOOL_PROPS' bl_context = "objectmode"
and define a
draw method for it. My specific questions are:
1) Is this approach correct? 2) How to ensure that the Panel is only shown when the above operator is running?
Edit: What I need is something like
bpy.props.BoolVectorProperty added to my operator class, which I can dynamically set and prompt the user via
context.window_manager.invoke_props_dialog to update. This would do away with the need for a separate Panel.
The problem with this is
BoolVectorProperty is of fixed length whereas I need variable length Boolean Vectors.