Add replace textures from folder function for BNTX

This commit is contained in:
KillzXGaming 2019-03-25 21:29:13 -04:00
parent 0fef2f07e4
commit a7183147b0
5 changed files with 22 additions and 5 deletions

Binary file not shown.

View file

@ -97,10 +97,6 @@ namespace FirstPlugin
}
public static void ReadModel(FMDL model, Model mdl)
{
Console.WriteLine("matcount " + mdl.Materials.Count);
Console.WriteLine("shpcount " + mdl.Shapes.Count);
Console.WriteLine("skelcount " + mdl.Skeleton.Bones.Count);
if (model == null)
model = new FMDL();
model.Text = mdl.Name;
@ -659,7 +655,6 @@ namespace FirstPlugin
shaderParam.PaddingLength = param.PaddingLength;
reader.Seek(param.DataOffset, System.IO.SeekOrigin.Begin);
Console.WriteLine(shaderParam.Name + " " + shaderParam.Type + " " + shaderParam.HasPadding);
shaderParam.ReadValue(reader, (int)param.DataSize);
m.matparam.Add(param.Name, shaderParam);

View file

@ -166,6 +166,7 @@ namespace FirstPlugin
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Import, Keys.Control | Keys.R));
ContextMenuStrip.Items.Add(new ToolStripSeparator());
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Import Texture", null, ImportTextureAction, Keys.Control | Keys.I));
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace Textures (From Folder)", null, ReplaceAll, Keys.Control | Keys.T));
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Export All Textures", null, ExportAll, Keys.Control | Keys.A));
ContextMenuStrip.Items.Add(new ToolStripSeparator());
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
@ -522,6 +523,27 @@ namespace FirstPlugin
GC.Collect();
}
}
private void ReplaceAll(object sender, EventArgs args)
{
FolderSelectDialog sfd = new FolderSelectDialog();
if (sfd.ShowDialog() == DialogResult.OK)
{
foreach (string file in System.IO.Directory.GetFiles(sfd.SelectedPath))
{
string FileName = System.IO.Path.GetFileNameWithoutExtension(file);
foreach (TextureData node in Textures.Values)
{
if (FileName == node.Text)
{
node.Replace(file);
}
}
}
}
}
private void ExportAll(object sender, EventArgs args)
{
List<string> Formats = new List<string>();