-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path__init__.py
More file actions
159 lines (116 loc) · 4.21 KB
/
__init__.py
File metadata and controls
159 lines (116 loc) · 4.21 KB
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
bl_info = {
'name': 'Sub Rosa formats',
'author': 'jdbool',
'version': (0, 1, 0),
'blender': (2, 80, 0),
'location': 'File > Import-Export',
'description': 'Import-Export CMO and CMC',
'warning': '',
'support': 'COMMUNITY',
'category': 'Import-Export'
}
import bpy
from bpy.props import StringProperty
from bpy_extras.io_utils import ImportHelper, ExportHelper
class ImportCMO(bpy.types.Operator, ImportHelper):
"""Load a Sub Rosa Object File"""
bl_idname = 'import_scene.cmo'
bl_label = 'Import CMO'
bl_options = {'UNDO'}
filename_ext = '.cmo'
filter_glob = StringProperty(
default='*.cmo',
options={'HIDDEN'}
)
def execute(self, context):
from . import import_cmo
keywords = self.as_keywords(ignore=('filter_glob',))
return import_cmo.load(context, **keywords)
class ImportCMC(bpy.types.Operator, ImportHelper):
"""Load a Sub Rosa Character File"""
bl_idname = 'import_scene.cmc'
bl_label = 'Import CMC'
bl_options = {'UNDO'}
filename_ext = '.cmo'
filter_glob = StringProperty(
default='*.cmc',
options={'HIDDEN'}
)
def execute(self, context):
from . import import_cmc
keywords = self.as_keywords(ignore=('filter_glob',))
return import_cmc.load(context, **keywords)
class ImportITM(bpy.types.Operator, ImportHelper):
"""Load a Sub Rosa Item File"""
bl_idname = 'import_scene.itm'
bl_label = 'Import ITM'
bl_options = {'UNDO'}
filename_ext = '.itm'
filter_glob = StringProperty(
default='*.itm',
options={'HIDDEN'}
)
def execute(self, context):
from . import import_itm
keywords = self.as_keywords(ignore=('filter_glob',))
return import_itm.load(context, **keywords)
class ImportSIT(bpy.types.Operator, ImportHelper):
"""Load a Sub Rosa Legacy Item File"""
bl_idname = 'import_scene.sit'
bl_label = 'Import SIT'
bl_options = {'UNDO'}
filename_ext = '.sit'
filter_glob = StringProperty(
default='*.sit',
options={'HIDDEN'}
)
def execute(self, context):
from . import import_sit
keywords = self.as_keywords(ignore=('filter_glob',))
return import_sit.load(context, **keywords)
class ImportSBV(bpy.types.Operator, ImportHelper):
"""Load a Sub Rosa Vehicle File"""
bl_idname = 'import_scene.sbv'
bl_label = 'Import SBV'
bl_options = {'UNDO'}
filename_ext = '.sbv'
filter_glob = StringProperty(
default='*.sbv',
options={'HIDDEN'}
)
def execute(self, context):
from . import import_sbv
keywords = self.as_keywords(ignore=('filter_glob',))
return import_sbv.load(context, **keywords)
def menu_func_import(self, context):
self.layout.operator(ImportCMO.bl_idname, text='Sub Rosa Object (.cmo)')
self.layout.operator(ImportCMC.bl_idname, text='Sub Rosa Character (.cmc)')
self.layout.operator(ImportITM.bl_idname, text='Sub Rosa Item (.itm)')
self.layout.operator(ImportSIT.bl_idname, text='Sub Rosa Legacy Item (.sit)')
self.layout.operator(ImportSBV.bl_idname, text='Sub Rosa Vehicle (.sbv)')
class ExportCMO(bpy.types.Operator, ExportHelper):
"""Load a Sub Rosa Object File"""
bl_idname = 'export_scene.cmo'
bl_label = 'Export CMO'
filename_ext = '.cmo'
filter_glob = StringProperty(
default='*.cmo',
options={'HIDDEN'}
)
def execute(self, context):
from . import export_cmo
keywords = self.as_keywords(ignore=('filter_glob', 'check_existing'))
return export_cmo.save(context, **keywords)
def menu_func_export(self, context):
self.layout.operator(ExportCMO.bl_idname, text='Sub Rosa Object (.cmo)')
classes = (ImportCMO, ImportCMC, ImportITM, ImportSIT, ImportSBV, ExportCMO)
def register():
for cls in classes:
bpy.utils.register_class(cls)
bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
def unregister():
bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
for cls in classes:
bpy.utils.unregister_class(cls)