-
Notifications
You must be signed in to change notification settings - Fork 1
/
__init__.py
53 lines (40 loc) · 1.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
bl_info = {
"name": "Tools:Q",
"author": "studioQ",
"version": (1, 0, 1),
"blender": (2, 93, 3),
"description": "Tools:Q Common",
"warning": "",
"support": "COMMUNITY",
"wiki_url": "",
"category": "All"
}
import importlib
import os
IGNORE_DIR_LIST = [
".git",
"__pycache__",
]
def get_funcs(func_name):
this_path = os.path.dirname(__file__)
dir_list = [
f for f in os.listdir(this_path)
if os.path.isdir(os.path.join(this_path, f)) and (f not in IGNORE_DIR_LIST)
]
path_list = ["." + f for f in dir_list]
functions = []
for path in path_list:
module = importlib.import_module(path, package=__package__)
if hasattr(module, func_name):
functions += [getattr(module, func_name)]
return functions
def register():
# Register Packages
for func in get_funcs("register_package"):
func()
def unregister():
# Unregister Packages
for func in get_funcs("unregister_package"):
func()
if __name__ == "__main__":
register()