diff options
Diffstat (limited to 'release/scripts/startup/bl_operators/wm.py')
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 3919ecdd72f..63d9aa31ddd 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -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'} |