From 8fd246cb708569eff223c2da145395cc5ef99402 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 12 Aug 2011 06:31:39 +0000 Subject: [PATCH] add bpy.types as a module for convenient imports, eg: from bpy.types import Menu --- release/scripts/modules/bpy/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index a43b42e49a1..5c371fd750a 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -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