[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53774] trunk/blender/release/scripts/ startup/bl_operators/wm.py: simplify WM_MT_context_menu_enum(), use expanded enum property.

Campbell Barton ideasman42 at gmail.com
Sun Jan 13 17:25:48 CET 2013


Revision: 53774
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53774
Author:   campbellbarton
Date:     2013-01-13 16:25:46 +0000 (Sun, 13 Jan 2013)
Log Message:
-----------
simplify WM_MT_context_menu_enum(), use expanded enum property.

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/wm.py

Modified: trunk/blender/release/scripts/startup/bl_operators/wm.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/wm.py	2013-01-13 16:18:35 UTC (rev 53773)
+++ trunk/blender/release/scripts/startup/bl_operators/wm.py	2013-01-13 16:25:46 UTC (rev 53774)
@@ -500,20 +500,15 @@
 
     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)
+        col = self.layout.column()
+        col.prop(value_base, prop_string, expand=True)
 
-        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
-
-
 class WM_OT_context_menu_enum(Operator):
     bl_idname = "wm.context_menu_enum"
     bl_label = "Context Enum Menu"




More information about the Bf-blender-cvs mailing list