simplify WM_MT_context_menu_enum(), use expanded enum property.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 13 Jan 2013 16:25:46 +0000 (16:25 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 13 Jan 2013 16:25:46 +0000 (16:25 +0000)
release/scripts/startup/bl_operators/wm.py

index b34148054272be1b57bcb47083525588d7089297..b33a10b671e29b53d12f56e83683ab7e12cf07d7 100644 (file)
@@ -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):