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-02-11 04:12:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-11 04:12:01 +0300
commit2f4f046b6f16d4429b6d74270945cbb87cca6c52 (patch)
treef9ee0ba654d21ba985b6c9e7b3ab8969e082aa17 /release
parentb1cdf5c34478204fbec5272b97754abc548da195 (diff)
UI functions added to existing UI classes (operators adding their own menus for eg),
would stop the entire menu from drawing if they raised an exception. now print the exception and continue. Also added a verbose argument for bpy.utils.(un)register_module() to help test whats being registered.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/bpy/utils.py17
-rw-r--r--release/scripts/modules/bpy_types.py7
2 files changed, 20 insertions, 4 deletions
diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py
index a86cfacb56b..1bb62fdb29f 100644
--- a/release/scripts/modules/bpy/utils.py
+++ b/release/scripts/modules/bpy/utils.py
@@ -593,26 +593,37 @@ def _bpy_module_classes(module, is_registered=False):
i += 1
-def register_module(module):
+def register_module(module, verbose=False):
import traceback
+ if verbose:
+ print("bpy.utils.register_module(%r): ..." % module)
for cls, path, line in _bpy_module_classes(module, is_registered=False):
+ if verbose:
+ print(" %s of %s:%s" % (cls, path, line))
try:
register_class(cls)
except:
print("bpy.utils.register_module(): failed to registering class '%s.%s'" % (cls.__module__, cls.__name__))
print("\t", path, "line", line)
traceback.print_exc()
-
+ if verbose:
+ print("done.\n")
if "cls" not in locals():
raise Exception("register_module(%r): defines no classes" % module)
-def unregister_module(module):
+def unregister_module(module, verbose=False):
import traceback
+ if verbose:
+ print("bpy.utils.unregister_module(%r): ..." % module)
for cls, path, line in _bpy_module_classes(module, is_registered=True):
+ if verbose:
+ print(" %s of %s:%s" % (cls, path, line))
try:
unregister_class(cls)
except:
print("bpy.utils.unregister_module(): failed to unregistering class '%s.%s'" % (cls.__module__, cls.__name__))
print("\t", path, "line", line)
traceback.print_exc()
+ if verbose:
+ print("done.\n") \ No newline at end of file
diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py
index fcc3166b066..4eb712a65cc 100644
--- a/release/scripts/modules/bpy_types.py
+++ b/release/scripts/modules/bpy_types.py
@@ -657,7 +657,12 @@ class _GenericUI:
def draw_ls(self, context):
for func in draw_ls._draw_funcs:
- func(self, context)
+ # so bad menu functions dont stop the entire menu from drawing.
+ try:
+ func(self, context)
+ except:
+ import traceback
+ traceback.print_exc()
draw_funcs = draw_ls._draw_funcs = [cls.draw]
cls.draw = draw_ls