[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35426] trunk/blender/release/scripts/ modules/bpy_types.py: py/ui: ensure extensions which add draw functions for menus/headers/ panels always get the default operator context, not the one that was last set.

Campbell Barton ideasman42 at gmail.com
Wed Mar 9 11:57:57 CET 2011


Revision: 35426
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35426
Author:   campbellbarton
Date:     2011-03-09 10:57:56 +0000 (Wed, 09 Mar 2011)
Log Message:
-----------
py/ui: ensure extensions which add draw functions for menus/headers/panels always get the default operator context, not the one that was last set.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy_types.py

Modified: trunk/blender/release/scripts/modules/bpy_types.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy_types.py	2011-03-09 10:49:12 UTC (rev 35425)
+++ trunk/blender/release/scripts/modules/bpy_types.py	2011-03-09 10:57:56 UTC (rev 35426)
@@ -678,6 +678,9 @@
         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 @@
                         import traceback
                         traceback.print_exc()
 
+                    self.layout.operator_context = operator_context_default
+
             draw_funcs = draw_ls._draw_funcs = [cls.draw]
             cls.draw = draw_ls
 




More information about the Bf-blender-cvs mailing list