diff options
Diffstat (limited to 'release/scripts/startup/bl_ui/__init__.py')
-rw-r--r-- | release/scripts/startup/bl_ui/__init__.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py index c4e3df469b7..a57a2cc5a4c 100644 --- a/release/scripts/startup/bl_ui/__init__.py +++ b/release/scripts/startup/bl_ui/__init__.py @@ -239,3 +239,23 @@ class UI_MT_list_item_context_menu(bpy.types.Menu): bpy.utils.register_class(UI_MT_list_item_context_menu) + + +class UI_MT_button_context_menu(bpy.types.Menu): + """ + UI button context menu definition. Scripts can append/prepend this to + add own operators to the context menu. They must check context though, so + their items only draw in a valid context and for the correct buttons. + """ + + bl_label = "List Item" + bl_idname = "UI_MT_button_context_menu" + + def draw(self, context): + # Draw menu entries created with the legacy `WM_MT_button_context` class. + # This is deprecated, and support will be removed in a future release. + if hasattr(bpy.types, "WM_MT_button_context"): + self.layout.menu_contents("WM_MT_button_context") + + +bpy.utils.register_class(UI_MT_button_context_menu) |