4 'category': 'Import-Export',
5 'name': 'meshio. (.pmd)(.pmx)(.mqo)',
8 'location': 'File > Import-Export',
9 'description': 'Import-Export PMD/PMX/MQO meshes',
10 'warning': 'pmx importer/exporter is under development',
11 'wiki_url': 'http://meshio.sourceforge.jp/',
12 'support': 'COMMUNITY',
16 # To support reload properly, try to access a package var, if it's there, reload everything
19 def reload_module(name):
21 imp.reaload(locals()[name])
22 reload_module('import_pmx')
23 reload_module('export_pmx')
24 reload_module('import_pmd')
25 reload_module('export_pmd')
26 reload_module('import_mqo')
27 reload_module('export_mqo')
31 import bpy_extras.io_utils
35 class ImportPmd(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
36 '''Import from PMD file format (.pmd)'''
37 bl_idname = 'import_scene.mmd_pmd'
38 bl_label = 'Import PMD'
41 filter_glob = bpy.props.StringProperty(
42 default='*.pmd', options={'HIDDEN'})
44 def execute(self, context):
45 from . import import_pmd
46 bl.initialize('pmd_import', context.scene)
47 import_pmd._execute(**self.as_keywords(
48 ignore=('filter_glob',)))
53 def menu_func(klass, self, context):
54 self.layout.operator(klass.bl_idname,
55 text='MikuMikuDance model (.pmd)',
60 class ImportPmx(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
61 '''Import from PMX Format(.pmx)'''
62 bl_idname='import_scene.mmd_pmx'
66 filter_glob=bpy.props.StringProperty(
67 default='*.pmx', options={'HIDDEN'})
69 def execute(self, context):
70 from . import import_pmx
71 bl.initialize('pmd_import', context.scene)
72 import_pmx._execute(**self.as_keywords(
73 ignore=('filter_glob',)))
78 def menu_func(klass, self, context):
79 self.layout.operator(klass.bl_idname,
80 text='MikuMikuDance model (.pmx)',
85 class ImportMqo(bpy.types.Operator, bpy_extras.io_utils.ImportHelper):
86 '''Import from MQO file format (.mqo)'''
87 bl_idname = 'import_scene.metasequioa_mqo'
88 bl_label = 'Import MQO'
91 filter_glob = bpy.props.StringProperty(
92 default='*.mqo', options={'HIDDEN'})
94 scale = bpy.props.FloatProperty(
96 description='Scale the MQO by this value',
97 min=0.0001, max=1000000.0,
98 soft_min=0.001, soft_max=100.0, default=0.1)
100 def execute(self, context):
101 from . import import_mqo
102 bl.initialize('mqo_import', context.scene)
103 import_mqo._execute(**self.as_keywords(
104 ignore=('filter_glob',)))
109 def menu_func(klass, self, context):
110 self.layout.operator(klass.bl_idname,
111 text="Metasequoia (.mqo)",
116 class ExportPmd(bpy.types.Operator, bpy_extras.io_utils.ExportHelper):
117 '''Export to PMD file format (.pmd)'''
118 bl_idname = 'export_scene.mmd_pmd'
119 bl_label = 'Export PMD'
121 filename_ext = '.pmd'
122 filter_glob = bpy.props.StringProperty(
123 default='*.pmd', options={'HIDDEN'})
125 use_selection = bpy.props.BoolProperty(
126 name='Selection Only',
127 description='Export selected objects only',
130 def execute(self, context):
131 from . import export_pmd
132 bl.initialize('pmd_export', context.scene)
133 export_pmd._execute(**self.as_keywords(
134 ignore=('check_existing', 'filter_glob', 'use_selection')))
139 def menu_func(klass, self, context):
140 default_path=bpy.data.filepath.replace('.blend', '.pmd')
141 self.layout.operator(klass.bl_idname,
142 text='Miku Miku Dance Model(.pmd)',
144 ).filepath=default_path
147 class ExportPmx(bpy.types.Operator, bpy_extras.io_utils.ExportHelper):
148 '''Export to PMX file format (.pmx)'''
149 bl_idname = 'export_scene.mmd_pmx'
150 bl_label = 'Export PMX'
152 filename_ext = '.pmx'
153 filter_glob = bpy.props.StringProperty(
154 default='*.pmx', options={'HIDDEN'})
156 use_selection = bpy.props.BoolProperty(
157 name='Selection Only',
158 description='Export selected objects only',
161 def execute(self, context):
162 from . import export_pmx
163 bl.initialize('pmx_export', context.scene)
164 export_pmx._execute(**self.as_keywords(
165 ignore=('check_existing', 'filter_glob', 'use_selection')))
170 def menu_func(klass, self, context):
171 default_path=bpy.data.filepath.replace('.blend', '.pmx')
172 self.layout.operator(klass.bl_idname,
173 text='Miku Miku Dance Model(.pmx)',
175 ).filepath=default_path
178 class ExportMqo(bpy.types.Operator, bpy_extras.io_utils.ExportHelper):
179 '''Save a Metasequoia MQO file.'''
180 bl_idname = 'export_scene.metasequioa_mqo'
181 bl_label = 'Export MQO'
183 filename_ext = '.mqo'
184 filter_glob = bpy.props.StringProperty(
185 default='*.mqo', options={'HIDDEN'})
187 use_selection = bpy.props.BoolProperty(
188 name='Selection Only',
189 description='Export selected objects only',
192 scale = bpy.props.FloatProperty(
194 description='Scale the MQO by this value',
195 min=0.0001, max=1000000.0,
196 soft_min=0.001, soft_max=100.0, default=10.0)
198 apply_modifier = bpy.props.BoolProperty(
199 name='ApplyModifier',
200 description='Would apply modifiers',
203 def execute(self, context):
204 from . import export_mqo
205 bl.initialize('mqo_export', context.scene)
206 export_mqo._execute(**self.as_keywords(
207 ignore=('check_existing', 'filter_glob', 'use_selection')))
212 def menu_func(klass, self, context):
213 default_path=bpy.data.filepath.replace('.blend', '.mqo')
214 self.layout.operator(klass.bl_idname,
215 text='Metasequoia (.mqo)',
217 ).filepath=default_path
221 bpy.utils.register_module(__name__)
222 bpy.types.INFO_MT_file_import.append(ImportPmd.menu_func)
223 bpy.types.INFO_MT_file_import.append(ImportPmx.menu_func)
224 bpy.types.INFO_MT_file_import.append(ImportMqo.menu_func)
225 bpy.types.INFO_MT_file_export.append(ExportPmd.menu_func)
226 bpy.types.INFO_MT_file_export.append(ExportPmx.menu_func)
227 bpy.types.INFO_MT_file_export.append(ExportMqo.menu_func)
230 bpy.utils.unregister_module(__name__)
231 bpy.types.INFO_MT_file_import.remove(ImportPmd.menu_func)
232 bpy.types.INFO_MT_file_import.remove(ImportPmx.menu_func)
233 bpy.types.INFO_MT_file_import.remove(ImportMqo.menu_func)
234 bpy.types.INFO_MT_file_export.remove(ExportPmd.menu_func)
235 bpy.types.INFO_MT_file_export.remove(ExportPmx.menu_func)
236 bpy.types.INFO_MT_file_export.remove(ExportMqo.menu_func)
239 if __name__=='__main__':