+ # for 2.5
+ def execute_25(*args):
+ __execute(*args)
+
+ # operator
+ class EXPORT_OT_pmd(bpy.types.Operator):
+ '''Save a Metasequoia PMD file.'''
+ bl_idname = "export_scene.pmd"
+ bl_label = 'Export PMD'
+
+ # List of operator properties, the attributes will be assigned
+ # to the class instance from the operator settings before calling.
+
+ path = StringProperty(
+ name="File Path",
+ description="File path used for exporting the PMD file",
+ maxlen= 1024,
+ default= ""
+ )
+ filename = StringProperty(
+ name="File Name",
+ description="Name of the file.")
+ directory = StringProperty(
+ name="Directory",
+ description="Directory of the file.")
+
+ check_existing = BoolProperty(
+ name="Check Existing",
+ description="Check and warn on overwriting existing files",
+ default=True,
+ options=set('HIDDEN'))
+
+ def execute(self, context):
+ execute_25(
+ self.properties.path,
+ context.scene
+ )
+ return 'FINISHED'
+
+ def invoke(self, context, event):
+ wm=context.manager
+ wm.add_fileselect(self)
+ return 'RUNNING_MODAL'
+
+ # register menu
+ def menu_func(self, context):
+ default_path=bpy.data.filename.replace(".blend", ".pmd")
+ self.layout.operator(
+ EXPORT_OT_pmd.bl_idname,
+ text="Miku Miku Dance Model(.pmd)").path=default_path
+
+ def register():
+ bpy.types.register(EXPORT_OT_pmd)
+ bpy.types.INFO_MT_file_export.append(menu_func)
+
+ def unregister():
+ bpy.types.unregister(EXPORT_OT_pmd)
+ bpy.types.INFO_MT_file_export.remove(menu_func)
+
+ if __name__ == "__main__":
+ register()