__init__.py 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # ##### BEGIN GPL LICENSE BLOCK #####
  2. #
  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.
  7. #
  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.
  12. #
  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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # ##### END GPL LICENSE BLOCK #####
  18. # <pep8-80 compliant>
  19. """
  20. Give access to blender data and utility functions.
  21. """
  22. __all__ = (
  23. "app",
  24. "context",
  25. "data",
  26. "ops",
  27. "path",
  28. "props",
  29. "types",
  30. "utils",
  31. )
  32. # internal blender C module
  33. from _bpy import (
  34. app,
  35. context,
  36. data,
  37. msgbus,
  38. props,
  39. types,
  40. )
  41. # python modules
  42. from . import (
  43. path,
  44. utils,
  45. )
  46. # fake operator module
  47. from .ops import ops_fake_module as ops
  48. def main():
  49. import sys
  50. # Possibly temp. addons path
  51. from os.path import join, dirname
  52. sys.path.extend([
  53. join(dirname(dirname(dirname(__file__))), "addons", "modules"),
  54. join(utils.user_resource('SCRIPTS'), "addons", "modules"),
  55. ])
  56. # fake module to allow:
  57. # from bpy.types import Panel
  58. sys.modules.update({
  59. "bpy.app": app,
  60. "bpy.app.handlers": app.handlers,
  61. "bpy.app.translations": app.translations,
  62. "bpy.types": types,
  63. })
  64. # Initializes Python classes.
  65. # (good place to run a profiler or trace).
  66. utils.load_scripts()
  67. main()
  68. del main