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"

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.

  • $\begingroup$ What do you mean by "running"? If you just want a dialog that(pop-up) when you operator is executed, you can put a draw function in your operator. $\endgroup$ – cmomoney Feb 9 '17 at 16:24
  • $\begingroup$ @cmomoney I need to show the dialog only after getting some info from a file (selected by the user), with the contents of the dialog also based on this info. Is there a way to control all this in the draw function? $\endgroup$ – RSS Feb 9 '17 at 17:01
  • $\begingroup$ @cmomoney By 'running' I mean while the execute() method is executing. $\endgroup$ – RSS Feb 9 '17 at 17:09
  • $\begingroup$ You could do this with a CollectionProperty docs.blender.org/api/blender_python_api_2_78_4/… $\endgroup$ – cmomoney Feb 9 '17 at 21:09
  • $\begingroup$ @cmomoney Thanks for the hint, this looks promising. I asked a related question here blender.stackexchange.com/questions/73392/… $\endgroup$ – RSS Feb 10 '17 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.