diff --git a/File_Format_Library/FileFormats/GMX/GMX.cs b/File_Format_Library/FileFormats/GMX/GMX.cs index 7da8ecb4..7d428c57 100644 --- a/File_Format_Library/FileFormats/GMX/GMX.cs +++ b/File_Format_Library/FileFormats/GMX/GMX.cs @@ -12,7 +12,7 @@ using Toolbox.Library.Forms; namespace FirstPlugin { - public class GMX : TreeNodeFile, IFileFormat + public class GMX : TreeNodeFile, IFileFormat, IContextMenuNode { public FileType FileType { get; set; } = FileType.Model; @@ -78,6 +78,35 @@ namespace FirstPlugin } } + public ToolStripItem[] GetContextMenuItems() + { + List Items = new List(); + Items.Add(new ToolStripMenuItem("Export", null, ExportAction, Keys.Control | Keys.E)); + return Items.ToArray(); + } + + private void ExportAction(object sender, EventArgs e) + { + SaveFileDialog sfd = new SaveFileDialog(); + sfd.Filter = "Supported Formats|*.dae;"; + if (sfd.ShowDialog() == DialogResult.OK) + { + ExportModel(sfd.FileName); + } + } + + private void ExportModel(string FileName) + { + AssimpSaver assimp = new AssimpSaver(); + ExportModelSettings settings = new ExportModelSettings(); + + var model = new STGenericModel(); + model.Materials = new List(); + model.Objects = Renderer.Meshes; + + assimp.SaveFromModel(model, FileName, new List(), new STSkeleton()); + } + public Header GMXHeader; public GMX_Renderer Renderer;