simplify WM_MT_context_menu_enum(), use expanded enum property.

This commit is contained in:
Campbell Barton 2013-01-13 16:25:46 +00:00
parent 4f2a65d34c
commit 608f6eccce

@ -500,18 +500,13 @@ class WM_MT_context_menu_enum(Menu):
def draw(self, context):
data_path = self.data_path
value = context_path_validate(bpy.context, data_path)
value = context_path_validate(context, data_path)
if value is Ellipsis:
return {'PASS_THROUGH'}
base_path, prop_string = data_path.rsplit(".", 1)
value_base = context_path_validate(context, base_path)
values = [(i.name, i.identifier, i.icon) for i in value_base.bl_rna.properties[prop_string].enum_items]
for name, identifier, icon in values:
props = self.layout.operator("wm.context_set_enum", text=name, icon=icon)
props.data_path = data_path
props.value = identifier
col = self.layout.column()
col.prop(value_base, prop_string, expand=True)
class WM_OT_context_menu_enum(Operator):