add bpy.types as a module for convenient imports, eg:
authorCampbell Barton <ideasman42@gmail.com>
Fri, 12 Aug 2011 06:31:39 +0000 (06:31 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 12 Aug 2011 06:31:39 +0000 (06:31 +0000)
  from bpy.types import Menu

release/scripts/modules/bpy/__init__.py

index a43b42e49a14ffe232ff18d951bcf42fc7acb0d4..5c371fd750a7590c4f4593c567710556fc2a8ddd 100644 (file)
@@ -44,14 +44,18 @@ from . import utils, path, ops
 ops = ops.ops_fake_module
 
 
-def _main():
-    import sys as _sys
+def main():
+    import sys
 
     # Possibly temp. addons path
     from os.path import join, dirname, normpath
-    _sys.path.append(normpath(join(dirname(__file__),
+    sys.path.append(normpath(join(dirname(__file__),
                                    "..", "..", "addons", "modules")))
 
+    # fake module to allow:
+    #   from bpy.types import Panel
+    sys.modules["bpy.types"] = types
+
     # if "-d" in sys.argv: # Enable this to measure startup speed
     if 0:
         import cProfile
@@ -65,6 +69,6 @@ def _main():
         utils.load_scripts()
 
 
-_main()
+main()
 
-del _main
+del main