-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy path__init__.py
57 lines (46 loc) · 2.06 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import importlib
import logging
import sys
from . import addon_updater_ops
bl_info = {
"name": "QuickSnap",
"author": "Julien Heijmans",
"blender": (2, 93, 0),
'version': (1, 4, 7),
"category": "3D View",
"description": "Quickly snap objects/vertices/curve points",
"warning": "",
"doc_url": "https://github.com/JulienHeijmans/quicksnap",
"releases_url": "https://github.com/JulienHeijmans/quicksnap/releases",
"tracker_url": "https://github.com/JulienHeijmans/quicksnap/issues",
}
modulesNames = ['addon_updater', 'addon_updater_ops', 'quicksnap_utils', 'quicksnap_snapdata', 'quicksnap_render',
'quicksnap']
modulesFullNames = {}
for currentModuleName in modulesNames:
modulesFullNames[currentModuleName] = ('{}.{}'.format(__name__, currentModuleName))
for currentModuleFullName in modulesFullNames.values():
if currentModuleFullName in sys.modules:
importlib.reload(sys.modules[currentModuleFullName])
else:
globals()[currentModuleFullName] = importlib.import_module(currentModuleFullName)
setattr(globals()[currentModuleFullName], 'modulesNames', modulesFullNames)
def register():
for current_module_name in modulesFullNames.values():
if current_module_name in sys.modules:
if hasattr(sys.modules[current_module_name], 'register'):
if current_module_name == f"{__name__}.addon_updater_ops":
sys.modules[current_module_name].register(bl_info)
else:
sys.modules[current_module_name].register()
def unregister():
for current_module_name in modulesFullNames.values():
if current_module_name in sys.modules:
if hasattr(sys.modules[current_module_name], 'unregister'):
sys.modules[current_module_name].unregister()
logger = logging.getLogger(__name__)
logger.handlers = []
logger.setLevel(logging.NOTSET)
console_handler = logging.StreamHandler()
console_handler.setFormatter(fmt=logging.Formatter('[%(levelname)s] %(asctime)s %(message)s'))
logger.addHandler(console_handler)