-
Notifications
You must be signed in to change notification settings - Fork 11
/
__init__.py
155 lines (126 loc) · 4.23 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# <pep8 compliant>
"""Blender Addon. Haydee 1 & 2 importer/exporter."""
bl_info = {
"name": "Haydee 1 & 2 I/O Scripts",
"author": "johnzero7, Pooka, Kein",
"version": (1, 3, 1),
"blender": (2, 80, 0),
"location": "File > Import-Export > HaydeeTools",
"description": "Import-Export scripts for Haydee",
"warning": "",
"wiki_url": "https://github.com/johnzero7/HaydeeTools",
"tracker_url": "https://github.com/johnzero7/HaydeeTools/issues",
"category": "Import-Export",
}
#############################################
# support reloading sub-modules
_modules = [
'HaydeeUtils',
'HaydeeMenuIcon',
'HaydeePanels',
'HaydeeExporter',
'HaydeeImporter',
'HaydeeNodeMat',
'addon_updater_ops',
]
# Reload previously loaded modules
if "bpy" in locals():
from importlib import reload
_modules_loaded[:] = [reload(module) for module in _modules_loaded]
del reload
# First import the modules
__import__(name=__name__, fromlist=_modules)
_namespace = globals()
_modules_loaded = [_namespace[name] for name in _modules]
del _namespace
# support reloading sub-modules
#############################################
import bpy
class UpdaterPreferences(bpy.types.AddonPreferences):
"""Updater Class."""
bl_idname = __package__
# addon updater preferences from `__init__`, be sure to copy all of them
auto_check_update: bpy.props.BoolProperty(
name="Auto-check for Update",
description="If enabled, auto-check for updates using an interval",
default=False,
)
updater_interval_months: bpy.props.IntProperty(
name='Months',
description="Number of months between checking for updates",
default=0,
min=0
)
updater_interval_days: bpy.props.IntProperty(
name='Days',
description="Number of days between checking for updates",
default=7,
min=0,
)
updater_interval_hours: bpy.props.IntProperty(
name='Hours',
description="Number of hours between checking for updates",
default=0,
min=0,
max=23
)
updater_interval_minutes: bpy.props.IntProperty(
name='Minutes',
description="Number of minutes between checking for updates",
default=0,
min=0,
max=59
)
def draw(self, context):
"""Draw Method."""
addon_updater_ops.update_settings_ui(self, context)
#
# Registration
#
classesToRegister = [
UpdaterPreferences,
HaydeePanels.HaydeeToolsImportPanel,
HaydeePanels.HaydeeToolsExportPanel,
HaydeePanels.HaydeeToolsSkelPanel,
HaydeeExporter.ExportHaydeeDSkel,
HaydeeExporter.ExportHaydeeDPose,
HaydeeExporter.ExportHaydeeDMotion,
HaydeeExporter.ExportHaydeeDMesh,
HaydeeExporter.HaydeeExportSubMenu,
HaydeeImporter.ImportHaydeeSkel,
HaydeeImporter.ImportHaydeeDSkel,
HaydeeImporter.ImportHaydeeDMesh,
HaydeeImporter.ImportHaydeeMesh,
HaydeeImporter.ImportHaydeeMotion,
HaydeeImporter.ImportHaydeeDMotion,
HaydeeImporter.ImportHaydeePose,
HaydeeImporter.ImportHaydeeDPose,
HaydeeImporter.ImportHaydeeOutfit,
HaydeeImporter.ImportHaydeeSkin,
HaydeeImporter.ImportHaydeeMaterial,
HaydeeImporter.HaydeeImportSubMenu,
HaydeeUtils.HaydeeToolFitArmature_Op,
HaydeeUtils.HaydeeToolFitMesh_Op,
]
# Use factory to create method to register and unregister the classes
registerClasses, unregisterClasses = bpy.utils.register_classes_factory(classesToRegister)
def register():
"""Register addon classes."""
HaydeeMenuIcon.registerCustomIcon()
registerClasses()
HaydeeExporter.register()
HaydeeImporter.register()
addon_updater_ops.register(bl_info)
def unregister():
"""Unregister addon classes."""
addon_updater_ops.unregister()
HaydeeExporter.unregister()
HaydeeImporter.unregister()
unregisterClasses()
HaydeeMenuIcon.unregisterCustomIcon()
if __name__ == "__main__":
register()
# call exporter
# bpy.ops.xps_tools.export_model('INVOKE_DEFAULT')
# call importer
# bpy.ops.xps_tools.import_model('INVOKE_DEFAULT')