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 #####
19 # internal blender C module
21 from _bpy import types, props
24 context = _bpy.context
29 from bpy import ops as _ops_module
31 # fake operator module
32 ops = _ops_module.ops_fake_module
34 def load_scripts(reload_scripts=False):
39 def test_import(module_name):
41 return __import__(module_name)
46 for base_path in utils.script_paths():
47 for path_subdir in ("ui", "op", "io"):
48 path = os.path.join(base_path, path_subdir)
49 if os.path.isdir(path):
50 sys.path.insert(0, path)
51 for f in sorted(os.listdir(path)):
54 mod = test_import(f[0:-3])
61 if reload_scripts and mod:
62 print("Reloading:", mod)
67 # a bit nasty but this prevents help() and input() from locking blender
68 # Ideally we could have some way for the console to replace sys.stdin but
69 # python would lock blender while waiting for a return value, not easy :|
73 if "-d" in sys.argv and False: # Enable this to measure startup speed
75 cProfile.run('import bpy; bpy.load_scripts()', 'blender.prof')
78 p = pstats.Stats('blender.prof')
79 p.sort_stats('cumulative').print_stats(100)