mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-10 15:14:55 +00:00
Add option to export all GT1 textures
This commit is contained in:
parent
994557b3b4
commit
f70a18c3f8
7 changed files with 115 additions and 52 deletions
|
@ -66,7 +66,7 @@ namespace FirstPlugin.LuigisMansion.DarkMoon
|
|||
public LM2_Renderer Renderer;
|
||||
public DrawableContainer DrawableContainer = new DrawableContainer();
|
||||
|
||||
TextureFolder textureFolder = new TextureFolder("Textures");
|
||||
STTextureFolder textureFolder = new STTextureFolder("Textures");
|
||||
LM2_ModelFolder modelFolder;
|
||||
TreeNode materialNamesFolder = new TreeNode("Material Names");
|
||||
TreeNode chunkFolder = new TreeNode("Chunks");
|
||||
|
|
|
@ -10,56 +10,6 @@ using System.Windows.Forms;
|
|||
|
||||
namespace FirstPlugin.LuigisMansion.DarkMoon
|
||||
{
|
||||
public class TextureFolder : TreeNodeCustom, IContextMenuNode
|
||||
{
|
||||
public TextureFolder(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new ToolStripMenuItem("Export", null, ExportAll, Keys.Control | Keys.E));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
private void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
List<string> Formats = new List<string>();
|
||||
Formats.Add("Microsoft DDS (.dds)");
|
||||
Formats.Add("Portable Graphics Network (.png)");
|
||||
Formats.Add("Joint Photographic Experts Group (.jpg)");
|
||||
Formats.Add("Bitmap Image (.bmp)");
|
||||
Formats.Add("Tagged Image File Format (.tiff)");
|
||||
|
||||
FolderSelectDialog sfd = new FolderSelectDialog();
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string folderPath = sfd.SelectedPath;
|
||||
|
||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
foreach (STGenericTexture tex in Nodes)
|
||||
{
|
||||
if (form.Index == 0)
|
||||
tex.SaveDDS(folderPath + '\\' + tex.Text + ".dds");
|
||||
else if (form.Index == 1)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".png");
|
||||
else if (form.Index == 2)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".jpg");
|
||||
else if (form.Index == 3)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".bmp");
|
||||
else if (form.Index == 4)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".tiff");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TexturePOWE : STGenericTexture
|
||||
{
|
||||
public static readonly uint Identifier = 0xE977D350;
|
||||
|
|
|
@ -10,7 +10,7 @@ using System.Drawing;
|
|||
|
||||
namespace FirstPlugin
|
||||
{
|
||||
public class GT1 : TreeNodeFile, IFileFormat
|
||||
public class GT1 : TreeNodeFile, IFileFormat, IContextMenuNode
|
||||
{
|
||||
public FileType FileType { get; set; } = FileType.Image;
|
||||
|
||||
|
@ -166,6 +166,53 @@ namespace FirstPlugin
|
|||
{
|
||||
return (byte)(((x & 0x0F) << 4) | ((x & 0xF0) >> 4));
|
||||
}
|
||||
|
||||
public virtual ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction, Keys.Control | Keys.E));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
private void ExportAllAction(object sender, EventArgs args)
|
||||
{
|
||||
ExportAll();
|
||||
}
|
||||
|
||||
public virtual void ExportAll()
|
||||
{
|
||||
List<string> Formats = new List<string>();
|
||||
Formats.Add("Microsoft DDS (.dds)");
|
||||
Formats.Add("Portable Graphics Network (.png)");
|
||||
Formats.Add("Joint Photographic Experts Group (.jpg)");
|
||||
Formats.Add("Bitmap Image (.bmp)");
|
||||
Formats.Add("Tagged Image File Format (.tiff)");
|
||||
|
||||
FolderSelectDialog sfd = new FolderSelectDialog();
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string folderPath = sfd.SelectedPath;
|
||||
|
||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
foreach (STGenericTexture tex in Nodes)
|
||||
{
|
||||
if (form.Index == 0)
|
||||
tex.SaveDDS(folderPath + '\\' + tex.Text + ".dds");
|
||||
else if (form.Index == 1)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".png");
|
||||
else if (form.Index == 2)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".jpg");
|
||||
else if (form.Index == 3)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".bmp");
|
||||
else if (form.Index == 4)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".tiff");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GITexture : STGenericTexture
|
||||
|
|
65
Switch_Toolbox_Library/Generics/Texture/STTextureFolder.cs
Normal file
65
Switch_Toolbox_Library/Generics/Texture/STTextureFolder.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Toolbox.Library
|
||||
{
|
||||
//A folder that can easily batch export multiple folders
|
||||
public class STTextureFolder : TreeNodeCustom, IContextMenuNode
|
||||
{
|
||||
public STTextureFolder(string text)
|
||||
{
|
||||
Text = text;
|
||||
}
|
||||
|
||||
public virtual ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new ToolStripMenuItem("Export All", null, ExportAllAction, Keys.Control | Keys.E));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
private void ExportAllAction(object sender, EventArgs args) {
|
||||
ExportAll();
|
||||
}
|
||||
|
||||
public virtual void ExportAll()
|
||||
{
|
||||
List<string> Formats = new List<string>();
|
||||
Formats.Add("Microsoft DDS (.dds)");
|
||||
Formats.Add("Portable Graphics Network (.png)");
|
||||
Formats.Add("Joint Photographic Experts Group (.jpg)");
|
||||
Formats.Add("Bitmap Image (.bmp)");
|
||||
Formats.Add("Tagged Image File Format (.tiff)");
|
||||
|
||||
FolderSelectDialog sfd = new FolderSelectDialog();
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string folderPath = sfd.SelectedPath;
|
||||
|
||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
foreach (STGenericTexture tex in Nodes)
|
||||
{
|
||||
if (form.Index == 0)
|
||||
tex.SaveDDS(folderPath + '\\' + tex.Text + ".dds");
|
||||
else if (form.Index == 1)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".png");
|
||||
else if (form.Index == 2)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".jpg");
|
||||
else if (form.Index == 3)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".bmp");
|
||||
else if (form.Index == 4)
|
||||
tex.SaveBitMap(folderPath + '\\' + tex.Text + ".tiff");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Binary file not shown.
Binary file not shown.
|
@ -233,6 +233,7 @@
|
|||
<DependentUpon>SceneSelector.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Generics\Texture\ImageParameters.cs" />
|
||||
<Compile Include="Generics\Texture\STTextureFolder.cs" />
|
||||
<Compile Include="Interfaces\IMeshContainer.cs" />
|
||||
<Compile Include="Interfaces\ITextureContainer.cs" />
|
||||
<Compile Include="IO\Extensions\UintExtension.cs" />
|
||||
|
|
Loading…
Reference in a new issue