Page MenuHome

EnumProperty using update function and expand option is not correctly drawing
Closed, ArchivedPublic

Description

Blender 2.77 linux 64

This code give very strange and unpredictable results (see attached screeshoots). But work correctly if the property is displayed without expand option.

import bpy


def getValues(self, context):
    items = []
    values = ['value' + str(i+1) for i in range(10)]
    for i, v in enumerate(values):
        #put each item in a tuple (key, label, tooltip)
        items.append( (str(i), str(i+1)+' '+v, v) )
    return items


bpy.types.Scene.values = bpy.props.EnumProperty(
        name = "Values",
        items = getValues)


class PANEL(bpy.types.Panel):
    bl_category = "TEST"
    bl_label = "Show bug"
    bl_space_type = "VIEW_3D"
    bl_context = "objectmode"
    bl_region_type = "TOOLS"

    def draw(self, context):
        scn = context.scene
        layout = self.layout
        
        row = layout.row()
        col = row.column()
        col.prop(scn, "values", expand=True) #messup
        
        layout.prop(scn, "values") #always correct


bpy.utils.register_module(__name__)

Details

Type
Bug