mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 07:04:36 +00:00
Make gmx models exportable
This commit is contained in:
parent
e4654f8dff
commit
54b6790afe
1 changed files with 30 additions and 1 deletions
|
@ -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<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
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<STGenericMaterial>();
|
||||
model.Objects = Renderer.Meshes;
|
||||
|
||||
assimp.SaveFromModel(model, FileName, new List<STGenericTexture>(), new STSkeleton());
|
||||
}
|
||||
|
||||
public Header GMXHeader;
|
||||
public GMX_Renderer Renderer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue