Fix drawing of bool properties in UI (#1689)

This commit is contained in:
Moritz Brückner 2021-02-19 20:59:54 +01:00
parent 84663bc981
commit 98481929df

View file

@ -18,11 +18,11 @@ class ArmPropertyListItem(bpy.types.PropertyGroup):
class ARM_UL_PropertyList(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
layout.use_property_split = False
# Make sure your code supports all 3 layout types
if self.layout_type in {'DEFAULT', 'COMPACT'}:
row = layout.row()
row.prop(item, "name_prop", text="", emboss=False, icon="OBJECT_DATAMODE")
row.prop(item, item.type_prop + "_prop", text="", emboss=(item.type_prop == 'boolean'))
layout.prop(item, "name_prop", text="", emboss=False, icon="OBJECT_DATAMODE")
layout.prop(item, item.type_prop + "_prop", text="", emboss=(item.type_prop == 'boolean'))
elif self.layout_type in {'GRID'}:
layout.alignment = 'CENTER'
layout.label(text="", icon="OBJECT_DATAMODE")
@ -155,4 +155,4 @@ def unregister():
bpy.utils.unregister_class(ARM_UL_PropertyList)
bpy.utils.unregister_class(ArmPropertyListNewItem)
bpy.utils.unregister_class(ArmPropertyListDeleteItem)
bpy.utils.unregister_class(ArmPropertyListMoveItem)
bpy.utils.unregister_class(ArmPropertyListMoveItem)