forked from johnzero7/XNALaraMesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
167 lines (139 loc) · 4.26 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
156
157
158
159
160
161
162
163
164
165
166
167
# <pep8 compliant>
"""Blender Addon. XNALara/XPS importer/exporter."""
bl_info = {
"name": "XNALara/XPS Import/Export",
"author": "johnzero7",
"version": (2, 0, 2),
"blender": (2, 80, 0),
"location": "File > Import-Export > XNALara/XPS",
"description": "Import-Export XNALara/XPS",
"warning": "",
"wiki_url": "https://github.com/johnzero7/xps_tools",
"tracker_url": "https://github.com/johnzero7/xps_tools/issues",
"category": "Import-Export",
}
#############################################
# support reloading sub-modules
_modules = [
'xps_panels',
'xps_tools',
'xps_toolshelf',
'xps_const',
'xps_types',
'xps_material',
'write_ascii_xps',
'write_bin_xps',
'read_ascii_xps',
'read_bin_xps',
'mock_xps_data',
'export_xnalara_model',
'export_xnalara_pose',
'import_xnalara_model',
'import_xnalara_pose',
'import_obj',
'export_obj',
'ascii_ops',
'bin_ops',
'timing',
'material_creator',
'node_shader_utils',
'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_intrval_months: bpy.props.IntProperty(
name='Months',
description="Number of months between checking for updates",
default=0,
min=0
)
updater_intrval_days: bpy.props.IntProperty(
name='Days',
description="Number of days between checking for updates",
default=7,
min=0,
)
updater_intrval_hours: bpy.props.IntProperty(
name='Hours',
description="Number of hours between checking for updates",
default=0,
min=0,
max=23
)
updater_intrval_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,
xps_panels.XPSToolsObjectPanel,
xps_panels.XPSToolsBonesPanel,
xps_panels.XPSToolsAnimPanel,
xps_toolshelf.ArmatureBonesHideByName_Op,
xps_toolshelf.ArmatureBonesHideByVertexGroup_Op,
xps_toolshelf.ArmatureBonesShowAll_Op,
xps_toolshelf.ArmatureBonesRenameToBlender_Op,
xps_toolshelf.ArmatureBonesRenameToXps_Op,
xps_toolshelf.ArmatureBonesConnect_Op,
xps_toolshelf.NewRestPose_Op,
xps_tools.Import_Xps_Model_Op,
xps_tools.Export_Xps_Model_Op,
xps_tools.Import_Xps_Pose_Op,
xps_tools.Export_Xps_Pose_Op,
xps_tools.Import_Poses_To_Keyframes_Op,
xps_tools.Export_Frames_To_Poses_Op,
xps_tools.ArmatureBoneDictGenerate_Op,
xps_tools.ArmatureBoneDictRename_Op,
xps_tools.ArmatureBoneDictRestore_Op,
xps_tools.ImportXpsNgff,
xps_tools.ExportXpsNgff,
xps_tools.XpsImportSubMenu,
xps_tools.XpsExportSubMenu,
]
# Use factory to create method to register and unregister the classes
registerClasses, unregisterClasses = bpy.utils.register_classes_factory(classesToRegister)
def register():
"""Register addon classes."""
registerClasses()
xps_tools.register()
addon_updater_ops.register(bl_info)
def unregister():
"""Unregister addon classes."""
addon_updater_ops.unregister()
xps_tools.unregister()
unregisterClasses()
if __name__ == "__main__":
register()
# call exporter
# bpy.ops.xps_tools.export_model('INVOKE_DEFAULT')
# call importer
# bpy.ops.xps_tools.import_model('INVOKE_DEFAULT')