remove dummy menu which WM_OT_context_menu_enum needed, use popup menu directly instead.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 6 Jul 2013 03:04:48 +0000 (03:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 6 Jul 2013 03:04:48 +0000 (03:04 +0000)
release/scripts/startup/bl_operators/wm.py

index 3919ecdd72f598b6cde4131f007ded3e57796381..63d9aa31dddd46a310a443f589f368945416ebb3 100644 (file)
@@ -471,34 +471,29 @@ class WM_OT_context_cycle_array(Operator):
         return operator_path_undo_return(context, data_path)
 
 
-class WM_MT_context_menu_enum(Menu):
-    bl_label = ""
-    data_path = ""  # BAD DESIGN, set from operator below.
+class WM_OT_context_menu_enum(Operator):
+    bl_idname = "wm.context_menu_enum"
+    bl_label = "Context Enum Menu"
+    bl_options = {'UNDO', 'INTERNAL'}
+    data_path = rna_path_prop
 
-    def draw(self, context):
+    def execute(self, context):
         data_path = self.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)
         prop = value_base.bl_rna.properties[prop_string]
 
-        layout = self.layout
-        layout.label(prop.name, icon=prop.icon)
-        layout.prop(value_base, prop_string, expand=True)
+        def draw_cb(self, context):
+            layout = self.layout
+            layout.prop(value_base, prop_string, expand=True)
 
+        context.window_manager.popup_menu(draw_func=draw_cb, title=prop.name, icon=prop.icon)
 
-class WM_OT_context_menu_enum(Operator):
-    bl_idname = "wm.context_menu_enum"
-    bl_label = "Context Enum Menu"
-    bl_options = {'UNDO', 'INTERNAL'}
-    data_path = rna_path_prop
-
-    def execute(self, context):
-        data_path = self.data_path
-        WM_MT_context_menu_enum.data_path = data_path
-        bpy.ops.wm.call_menu(name="WM_MT_context_menu_enum")
         return {'PASS_THROUGH'}