Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-09 13:57:56 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-09 13:57:56 +0300
commit897c2ede1345401f03d6af10fb361554cb07e19d (patch)
tree9e1ba013f2f0ecf532d7e3f6358b02e0a3be9194 /release/scripts/modules/bpy_types.py
parent2b88ba069fbe4a6370dc6d5d5f2bda906cbf4fce (diff)
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.
Diffstat (limited to 'release/scripts/modules/bpy_types.py')
-rw-r--r--release/scripts/modules/bpy_types.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index 8fc23731c42..7c8f767f327 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -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