1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 # internal blender C module
23 from _bpy import types, props
26 context = _bpy.context
31 from bpy import ops as _ops_module
33 # fake operator module
34 ops = _ops_module.ops_fake_module
37 DEBUG = ("-d" in sys.argv)
40 def load_scripts(reload_scripts=False):
48 def test_import(module_name):
51 ret = __import__(module_name)
53 print("time %s %.4f" % (module_name, time.time() - t))
60 for base_path in utils.script_paths():
61 for path_subdir in ("ui", "op", "io"):
62 path = os.path.join(base_path, path_subdir)
63 if os.path.isdir(path):
64 sys.path.insert(0, path)
65 for f in sorted(os.listdir(path)):
68 mod = test_import(f[0:-3])
75 if reload_scripts and mod:
76 print("Reloading:", mod)
80 print("Time %.4f" % (time.time() - t_main))
85 # a bit nasty but this prevents help() and input() from locking blender
86 # Ideally we could have some way for the console to replace sys.stdin but
87 # python would lock blender while waiting for a return value, not easy :|
90 # if "-d" in sys.argv: # Enable this to measure startup speed
93 cProfile.run('import bpy; bpy.load_scripts()', 'blender.prof')
96 p = pstats.Stats('blender.prof')
97 p.sort_stats('cumulative').print_stats(100)
104 version = _bpy._VERSION
105 version_string = _bpy._VERSION_STR