This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path__init__.py
121 lines (100 loc) · 3.8 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# ----------------------------------------------------------
# File __init__.py
# ----------------------------------------------------------
# Addon info
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Thres1ware Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Thres1ware Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
##############################################################################################
bl_info = {
"name": "IntACT", ###################Addon name
"author": "Francien Bossema, Paul van Laar & Kimberly Meechan",
"version": (1, 0, 0),
"blender": (2, 90, 1), ################# Blender working version
"location": "3D View -> UI SIDE PANEL ",
"description": "3D Tools suite for Cultural Heritage X-ray CT and 3D scan visualisation", ########### Addon description
"warning": "",
"doc_url": "",
"tracker_url": "",
"category": "Cultural Heritage", ################## Addon category
}
#############################################################################################
# IMPORTS :
#############################################################################################
# Python imports :
import sys, os, bpy
from importlib import import_module
from os.path import dirname, join, realpath, abspath, exists
from .Operators.INTACT_InstallReq import REQ_LIST, REQ_INSTALLATION_DIR
if sys.platform == "win32":
sys.stdout.reconfigure(
encoding="cp65001"
) # activate unicode characters in windows CLI
###################################################
if not exists(REQ_INSTALLATION_DIR):
os.mkdir(REQ_INSTALLATION_DIR)
if not sys.path[0] == REQ_INSTALLATION_DIR:
sys.path.insert(0, REQ_INSTALLATION_DIR)
#############################################################
def ImportReq(requirements_list):
Pkgs = []
for requirement in requirements_list:
try:
import_module(requirement.test_string)
except ImportError:
Pkgs.append(requirement.package_name)
return Pkgs
NotFoundPkgs = ImportReq(REQ_LIST)
if NotFoundPkgs:
############################
# Install Req Registration :
############################
from .Operators import INTACT_InstallReq
def register():
INTACT_InstallReq.register()
def unregister():
INTACT_InstallReq.unregister()
if __name__ == "__main__":
register()
else:
######################
# Addon Registration :
######################
# Addon modules imports :
from . import INTACT_Props, INTACT_Panel
from .Operators import INTACT_ScanLoad, INTACT_Registration, INTACT_Visualisation, INTACT_ImagesOutput
addon_modules = [
INTACT_Props,
INTACT_Panel,
INTACT_ScanLoad,
INTACT_Registration,
INTACT_Visualisation,
INTACT_ImagesOutput
]
init_classes = []
def register():
for module in addon_modules:
module.register()
for cl in init_classes:
bpy.utils.register_class(cl)
def unregister():
for cl in init_classes:
bpy.utils.unregister_class(cl)
for module in reversed(addon_modules):
module.unregister()
if __name__ == "__main__":
register()