0
$\begingroup$

Actually, I know how to "insert" or "add" custom properties into a UIList in blender 2.8.

enter image description here

But actually I'm stuck with enum and collection properties. I don't know why I can't display them in a UIList, but If I test them outside of that, they work.

enter image description here

The process is simple. Create a PropertyGroup with an EnumProperty:

class CUSTOM_objectCollection(PropertyGroup):
    #name = StringProperty() -> Instantiated by default
    obj_type = StringProperty()
    obj_name = StringProperty()
    obj_id = IntProperty()
    obj_radio = StringProperty()
    obj_escala = StringProperty()    
    obj_simetria = BoolProperty()
    obj_ejemplo =  EnumProperty(default=None,
        items = [
            ('NONE', 'None', "Flat geometry"),
            ('GEOM', 'Geometry', "Use z value from shape geometry if exists"),
            ('FIELD', 'Field', "Extract z elevation value from an attribute field"),
            ('OBJ', 'Object', "Get z elevation value from an existing ground mesh")
        ])
    obj_esquina = BoolProperty()
    obj_borde = BoolProperty()

And add an item in some operator:

item = scn.custom.add()
item.name = i.name
item.obj_type = i.type 
item.obj_id = len(scn.custom)
item.obj_ejemplo = "NONE" 
item.obj_simetria = item.obj_simetria
item.obj_escala = str(round(i.scale[0],2))

But it doesn't work with the EnumProperty and I don't get any error.

$\endgroup$
  • 1
    $\begingroup$ Hi. Please try to use existing tags when asking a question. Thanks. $\endgroup$ – Ray Mairlot Jun 30 at 10:46
0
$\begingroup$

I must add all de properties into de UIList class

# -------------------------------------------------------------------
#   Drawing
# -------------------------------------------------------------------

class CUSTOM_UL_items(UIList):
    def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
        split = layout.split(factor=0.3)
        #split.label(text="Index: %d" % (index))
        custom_icon = "OUTLINER_OB_%s" % item.obj_type

        split.label(text=item.name) #item.name
        split.prop(item, 'obj_name', text="",  icon="MESH_CIRCLE")
        split.prop(item, 'obj_radio',text="Radio: ")
        split.prop(item, 'obj_ejemplo', text='')
        split.label(text="Escala: " + item.obj_escala)
        split.prop(item, 'obj_simetria', text="Simetria", toggle=False, slider=True, icon="CHECKMARK")
        

        split.prop(item, 'obj_esquina', text="Esquina", icon="CHECKMARK")
        
        split.prop(item, 'obj_borde', text="Borde", icon="CHECKMARK")

    

def invoke(self, context, event):
    pass   

enter image description here

| improve this answer | |
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.