1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- '''
- To load stuff that assumes a Blender scene is already loaded
- I need to wait for the BLEND file of the template to load and
- then add the functions and stuff I want after said file loads.
- The use of "bpy.app.handlers" and "persistent" help in this case
- for some reason I don't undertand yet >:] (but meh, it works)
- References:
- https://s-nako.work/2020/09/blender-error-attributeerror-_restrictcontext-object-has-no-attribute-view_layer/
- https://web.archive.org/web/20210925181415/https://blenderbrew.com/custom-application-templates-in-blender/
- '''
- import bpy
- from bpy.app.handlers import persistent
- @persistent
- def set_blenxy_env(dummy):
-
-
- from . import required_modules
- from . import basic_settings
- from . import collada_superbmd_import
- from . import collada_superbmd_export
-
-
-
-
- def register():
- print("\nWelcome to Blenxy!\n")
- print("Setting environment...")
- bpy.app.handlers.load_post.append(set_blenxy_env)
-
- def unregister():
- print("See you later!")
- bpy.app.handlers.load_post.remove(set_blenxy_env)
-
- if __name__ == "__main__":
- register()
|