Make gmx models exportable
This commit is contained in:
parent
e4654f8dff
commit
54b6790afe
@ -12,7 +12,7 @@ using Toolbox.Library.Forms;
|
|||||||
|
|
||||||
namespace FirstPlugin
|
namespace FirstPlugin
|
||||||
{
|
{
|
||||||
public class GMX : TreeNodeFile, IFileFormat
|
public class GMX : TreeNodeFile, IFileFormat, IContextMenuNode
|
||||||
{
|
{
|
||||||
public FileType FileType { get; set; } = FileType.Model;
|
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 Header GMXHeader;
|
||||||
public GMX_Renderer Renderer;
|
public GMX_Renderer Renderer;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user