]> git.tdb.fi Git - libs/gl.git/blobdiff - blender/io_mspgl/__init__.py
Add a Blender operator to export the entire project at once
[libs/gl.git] / blender / io_mspgl / __init__.py
index 79575f7df23b2c80761e24c09f499f68b7f45ee6..cba8178f66b06c2b36d775a5c37a125cf534d3cd 100644 (file)
@@ -132,6 +132,26 @@ class ExportMspGLScene(bpy.types.Operator, ExportHelper):
                if self.collection:
                        col.prop(self, "skip_existing")
 
+class ExportMspGLProject(bpy.types.Operator):
+       bl_idname = "export.mspgl_project"
+       bl_label = "Export Msp GL project"
+       bl_description = "Export the entire project in Msp GL format"
+
+       directory: bpy.props.StringProperty(name="Directory", description="Directory for exporting the data", subtype='FILE_PATH')
+
+       def invoke(self, context, event):
+               blend_filepath = context.blend_data.filepath
+               if blend_filepath:
+                       self.directory = os.path.split(blend_filepath)[0]
+               context.window_manager.fileselect_add(self)
+               return {'RUNNING_MODAL'}
+
+       def execute(self, context):
+               from .export import ProjectExporter
+               exporter = ProjectExporter()
+               exporter.export_to_directory(context, self.directory)
+               return {'FINISHED'}
+
 class AddUniform(bpy.types.Operator):
        bl_idname = "material.add_uniform"
        bl_label = "Add Uniform"
@@ -160,8 +180,9 @@ def menu_func_export(self, context):
        self.layout.operator(ExportMspGLData.bl_idname, text="Msp GL data")
        self.layout.operator(ExportMspGLAnimation.bl_idname, text="Msp GL animation")
        self.layout.operator(ExportMspGLScene.bl_idname, text="Msp GL scene")
+       self.layout.operator(ExportMspGLProject.bl_idname, text="Msp GL project")
 
-classes = [ExportMspGLData, ExportMspGLAnimation, ExportMspGLScene, AddUniform, RemoveUniform]
+classes = [ExportMspGLData, ExportMspGLAnimation, ExportMspGLScene, ExportMspGLProject, AddUniform, RemoveUniform]
 
 def register():
        for c in classes: