diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-12-05 23:45:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-12-05 23:45:51 +0300 |
commit | 651336d5dfdea5faaebb26e5e153efd65676631a (patch) | |
tree | f172bbbbf960ca875fac3a5eae734f86f7315fa4 /release/scripts/modules/bpy | |
parent | bca53f09060e8686fe824f0353881ef0671997f8 (diff) |
fixes for automatic tests and some errors in last commit
Diffstat (limited to 'release/scripts/modules/bpy')
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 0df11659336..72ef4ae3bd8 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -31,17 +31,28 @@ from bpy import ops as _ops_module # fake operator module ops = _ops_module.ops_fake_module +import sys +DEBUG = ("-d" in sys.argv) + def load_scripts(reload_scripts=False): import os - import sys import traceback + import time + + + t_main = time.time() def test_import(module_name): try: - return __import__(module_name) + t = time.time() + ret= __import__(module_name) + if DEBUG: + print("time %s %.4f" % (module_name, time.time() - t)) + return ret except: traceback.print_exc() return None + for base_path in utils.script_paths(): for path_subdir in ("ui", "op", "io"): @@ -62,6 +73,9 @@ def load_scripts(reload_scripts=False): print("Reloading:", mod) reload(mod) + if DEBUG: + print("Time %.4f" % (time.time() - t_main)) + def _main(): # a bit nasty but this prevents help() and input() from locking blender @@ -70,7 +84,8 @@ def _main(): import sys sys.stdin = None - if "-d" in sys.argv and False: # Enable this to measure startup speed + # if "-d" in sys.argv: # Enable this to measure startup speed + if 0: import cProfile cProfile.run('import bpy; bpy.load_scripts()', 'blender.prof') |