1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Add option to batch extract MKAGPDX models combined to single dae

This commit is contained in:
KillzXGaming 2019-06-19 19:59:10 -04:00
parent c540b32cb7
commit 1cc36eeabd
5 changed files with 40 additions and 0 deletions

Binary file not shown.

View File

@ -62,6 +62,46 @@ namespace FirstPlugin
{
toolExt[0] = new STToolStripItem("Models");
toolExt[0].DropDownItems.Add(new STToolStripItem("Batch Export (MKAGPDX .bin)", BatchExport));
toolExt[0].DropDownItems.Add(new STToolStripItem("Batch Export as Combined (MKAGPDX .bin)", BatchExportCombined));
}
public void BatchExportCombined(object sender, EventArgs args)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Multiselect = true;
ofd.Filter = "Supported Formats|*.bin";
if (ofd.ShowDialog() != DialogResult.OK) return;
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Supported Formats|*.dae";
if (sfd.ShowDialog() == DialogResult.OK)
{
List<STGenericObject> Objects = new List<STGenericObject>();
STSkeleton Skeleton = new STSkeleton();
List<STGenericMaterial> Materials = new List<STGenericMaterial>();
int MatIndex = 0;
foreach (var file in ofd.FileNames)
{
MKAGPDX_Model model = new MKAGPDX_Model();
var stream = File.Open(file, FileMode.Open);
model.Load(stream);
stream.Dispose();
foreach (STGenericMaterial mat in model.Nodes[0].Nodes)
{
mat.Text = $"Material {MatIndex++}";
Materials.Add(mat);
}
Skeleton.bones.AddRange(((STSkeleton)model.DrawableContainer.Drawables[0]).bones);
Objects.AddRange(((Renderer)model.DrawableContainer.Drawables[1]).Meshes);
}
AssimpSaver assimp = new AssimpSaver();
ExportModelSettings settings = new ExportModelSettings();
assimp.SaveFromModel(Objects, Materials, sfd.FileName, new List<STGenericTexture>(), Skeleton);
}
}
public void BatchExport(object sender, EventArgs args)