mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-22 20:43:09 +00:00
Add replace textures from folder function for BNTX
This commit is contained in:
parent
0fef2f07e4
commit
a7183147b0
5 changed files with 22 additions and 5 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -97,10 +97,6 @@ namespace FirstPlugin
|
||||||
}
|
}
|
||||||
public static void ReadModel(FMDL model, Model mdl)
|
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)
|
if (model == null)
|
||||||
model = new FMDL();
|
model = new FMDL();
|
||||||
model.Text = mdl.Name;
|
model.Text = mdl.Name;
|
||||||
|
@ -659,7 +655,6 @@ namespace FirstPlugin
|
||||||
shaderParam.PaddingLength = param.PaddingLength;
|
shaderParam.PaddingLength = param.PaddingLength;
|
||||||
|
|
||||||
reader.Seek(param.DataOffset, System.IO.SeekOrigin.Begin);
|
reader.Seek(param.DataOffset, System.IO.SeekOrigin.Begin);
|
||||||
Console.WriteLine(shaderParam.Name + " " + shaderParam.Type + " " + shaderParam.HasPadding);
|
|
||||||
shaderParam.ReadValue(reader, (int)param.DataSize);
|
shaderParam.ReadValue(reader, (int)param.DataSize);
|
||||||
|
|
||||||
m.matparam.Add(param.Name, shaderParam);
|
m.matparam.Add(param.Name, shaderParam);
|
||||||
|
|
|
@ -166,6 +166,7 @@ namespace FirstPlugin
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Import, Keys.Control | Keys.R));
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Replace", null, Import, Keys.Control | Keys.R));
|
||||||
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Import Texture", null, ImportTextureAction, Keys.Control | Keys.I));
|
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 ToolStripMenuItem("Export All Textures", null, ExportAll, Keys.Control | Keys.A));
|
||||||
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
ContextMenuStrip.Items.Add(new ToolStripSeparator());
|
||||||
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
|
||||||
|
@ -522,6 +523,27 @@ namespace FirstPlugin
|
||||||
GC.Collect();
|
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)
|
private void ExportAll(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
List<string> Formats = new List<string>();
|
List<string> Formats = new List<string>();
|
||||||
|
|
Loading…
Reference in a new issue