py/ui: ensure extensions which add draw functions for menus/headers/panels always...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 9 Mar 2011 10:57:56 +0000 (10:57 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 9 Mar 2011 10:57:56 +0000 (10:57 +0000)
release/scripts/modules/bpy_types.py

index 8fc23731c428f4f551563d3db2d94d9757d3496f..7c8f767f327170ed95e2c12af3bd92db25f55ab4 100644 (file)
@@ -678,6 +678,9 @@ class _GenericUI:
         if draw_funcs is None:
 
             def draw_ls(self, context):
+                # ensure menus always get default context
+                operator_context_default = self.layout.operator_context
+
                 for func in draw_ls._draw_funcs:
                     # so bad menu functions dont stop the entire menu from drawing.
                     try:
@@ -686,6 +689,8 @@ class _GenericUI:
                         import traceback
                         traceback.print_exc()
 
+                    self.layout.operator_context = operator_context_default
+
             draw_funcs = draw_ls._draw_funcs = [cls.draw]
             cls.draw = draw_ls