4

I want to create an Add-on with Python.

It should contain an operator that shows several string entries. Each of them can be selected/deselected individually. This is pretty much what happens with Properties/Texture:

enter image description here

I do not need the icon, but the string and the checkbox. I already have a list of strings to be presented to the user.

Similar controls are used for vertex groups, shape keys, uvmaps.

How can I create my own one?

Thank you

Edit:

the modification to the proposed solution is this:

class ULLibraries(UIList):    
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        layout.prop(item, "name", text="", emboss=False)
        layout.prop(item, "enabled", text="", index=index)
    def invoke(self, context, event):
        pass 

with following data:

class CustomProp(bpy.types.PropertyGroup):
    name = StringProperty() 
    enabled = BoolProperty() 

Result:

enter image description here

Monster
  • 8,178
  • 1
  • 11
  • 27
  • Yes, I found that at a later stage too. At the moment I'm not sure if that is really what I need. The basic framework looks like it is. – Monster Dec 21 '15 at 13:03
  • I found the difference .... it is how to design the storage [must contain name (string) and a status property (bool)] and the slot (UIList) [show name and status as with layout.prop()]. --- yes it is a doublicate – Monster Dec 22 '15 at 05:53
  • Hey @Monster! Sorry, don't get it, what else you need? A checkbox? – p2or Dec 22 '15 at 11:42
  • Yes, I was looking for String + Checkbox. It was not clear to me that it's appearance depends on the property type. – Monster Dec 22 '15 at 12:09

0 Answers0