A few more fixes.
Fix material copying for wii u bfres. Add batch bflim exporting.
This commit is contained in:
parent
b6078e1432
commit
53b15c1f7b
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -39,8 +39,9 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public List<SarcEntry> Files = new List<SarcEntry>();
|
||||
|
||||
public Dictionary<string, byte[]> OpenedFiles = new Dictionary<string, byte[]>();
|
||||
public Dictionary<string, byte[]> Files = new Dictionary<string, byte[]>();
|
||||
|
||||
public SarcData sarcData;
|
||||
public string SarcHash;
|
||||
@ -61,7 +62,7 @@ namespace FirstPlugin
|
||||
Text = FileName;
|
||||
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Save", null, Save, Keys.Control | Keys.S));
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Save",null, Save, Keys.Control | Keys.S));
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Rename Actor Files (Odyssey)", null, RenameActors, Keys.Control | Keys.S));
|
||||
|
||||
// ContextMenuStrip.Items.Add(new STToolStipMenuItem("Unpack to Folder", null, UnpackToFolder, Keys.Control | Keys.E));
|
||||
@ -102,7 +103,7 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UnpackToFolder(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
@ -113,8 +114,7 @@ namespace FirstPlugin
|
||||
|
||||
}
|
||||
|
||||
private void Delete(object sender, EventArgs args)
|
||||
{
|
||||
private void Delete(object sender, EventArgs args) {
|
||||
Unload();
|
||||
var editor = LibraryGUI.Instance.GetObjectEditor();
|
||||
if (editor != null)
|
||||
@ -127,16 +127,20 @@ namespace FirstPlugin
|
||||
TreeView.Sort();
|
||||
}
|
||||
|
||||
public class FolderEntry : TreeNode
|
||||
public class FolderEntry : TreeNode, IContextMenuNode
|
||||
{
|
||||
public FolderEntry(string text, int imageIndex, int selectedImageIndex)
|
||||
{
|
||||
Text = text;
|
||||
ImageIndex = imageIndex;
|
||||
SelectedImageIndex = selectedImageIndex;
|
||||
}
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
ContextMenu.MenuItems.Add(new MenuItem("Sort Childern", SortChildern));
|
||||
public ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new ToolStripMenuItem("Sort Childern", null, SortChildern, Keys.Control | Keys.W));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
private void SortChildern(object sender, EventArgs args)
|
||||
@ -328,7 +332,7 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
|
||||
public class SarcEntry : TreeNodeCustom
|
||||
public class SarcEntry : TreeNodeCustom, IContextMenuNode
|
||||
{
|
||||
public SARC sarc; //Sarc file the entry is located in
|
||||
public byte[] Data;
|
||||
@ -338,17 +342,22 @@ namespace FirstPlugin
|
||||
{
|
||||
ImageKey = "fileBlank";
|
||||
SelectedImageKey = "fileBlank";
|
||||
|
||||
ContextMenuStrip = new STContextMenuStrip();
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Export Raw Data", null, Export, Keys.Control | Keys.E));
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Export Raw Data to File Location", null, ExportToFileLoc, Keys.Control | Keys.F));
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Replace Raw Data", null, Replace, Keys.Control | Keys.R));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Open With Text Editor", null, OpenTextEditor, Keys.Control | Keys.T));
|
||||
ContextMenuStrip.Items.Add(new STToolStripSeparator());
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Remove", null, Remove, Keys.Control | Keys.Delete));
|
||||
ContextMenuStrip.Items.Add(new STToolStipMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
|
||||
}
|
||||
|
||||
public ToolStripItem[] GetContextMenuItems()
|
||||
{
|
||||
List<ToolStripItem> Items = new List<ToolStripItem>();
|
||||
Items.Add(new STToolStipMenuItem("Export Raw Data", null, Export, Keys.Control | Keys.E));
|
||||
Items.Add(new STToolStipMenuItem("Export Raw Data to File Location", null, ExportToFileLoc, Keys.Control | Keys.F));
|
||||
Items.Add(new STToolStipMenuItem("Replace Raw Data", null, Replace, Keys.Control | Keys.R));
|
||||
Items.Add(new STToolStripSeparator());
|
||||
Items.Add(new STToolStipMenuItem("Open With Text Editor", null, OpenTextEditor, Keys.Control | Keys.T));
|
||||
Items.Add(new STToolStripSeparator());
|
||||
Items.Add(new STToolStipMenuItem("Remove", null, Remove, Keys.Control | Keys.Delete));
|
||||
Items.Add(new STToolStipMenuItem("Rename", null, Rename, Keys.Control | Keys.N));
|
||||
return Items.ToArray();
|
||||
}
|
||||
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
UpdateHexView();
|
||||
@ -379,7 +388,7 @@ namespace FirstPlugin
|
||||
|
||||
IFileFormat file = OpenFile();
|
||||
if (file == null) //File returns null if no supported format is found
|
||||
return;
|
||||
return;
|
||||
|
||||
if (Utils.HasInterface(file.GetType(), typeof(IEditor<>)) && !SuppressFormDialog)
|
||||
{
|
||||
@ -596,7 +605,7 @@ namespace FirstPlugin
|
||||
sarcEntry.sarc = this;
|
||||
sarcEntry.Data = data;
|
||||
|
||||
Files.Add(fullName, data);
|
||||
Files.Add(sarcEntry);
|
||||
|
||||
string ext = Path.GetExtension(name);
|
||||
string SarcEx = SARCExt.SARC.GuessFileExtension(data);
|
||||
@ -623,4 +632,4 @@ namespace FirstPlugin
|
||||
return sarcEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,35 +420,65 @@ namespace Bfres.Structs
|
||||
private void SetCopiedMaterialData(CopyMaterialMenu menu,
|
||||
FMAT selectedMaterial, FMAT targetMaterial)
|
||||
{
|
||||
targetMaterial.Material.Flags = selectedMaterial.Material.Flags;
|
||||
targetMaterial.Material.UserDatas = selectedMaterial.Material.UserDatas;
|
||||
targetMaterial.Material.UserDataDict = selectedMaterial.Material.UserDataDict;
|
||||
if (targetMaterial.Material != null)
|
||||
{
|
||||
targetMaterial.Material.Flags = selectedMaterial.Material.Flags;
|
||||
targetMaterial.Material.UserDatas = selectedMaterial.Material.UserDatas;
|
||||
targetMaterial.Material.UserDataDict = selectedMaterial.Material.UserDataDict;
|
||||
|
||||
if (menu.chkBoxRenderInfo.Checked)
|
||||
{
|
||||
targetMaterial.Material.RenderInfoDict = selectedMaterial.Material.RenderInfoDict;
|
||||
targetMaterial.Material.RenderInfos = selectedMaterial.Material.RenderInfos;
|
||||
if (menu.chkBoxRenderInfo.Checked)
|
||||
{
|
||||
targetMaterial.Material.RenderInfoDict = selectedMaterial.Material.RenderInfoDict;
|
||||
targetMaterial.Material.RenderInfos = selectedMaterial.Material.RenderInfos;
|
||||
}
|
||||
if (menu.chkBoxShaderOptions.Checked)
|
||||
{
|
||||
targetMaterial.Material.ShaderAssign = selectedMaterial.Material.ShaderAssign;
|
||||
}
|
||||
if (menu.chkBoxShaderParams.Checked)
|
||||
{
|
||||
targetMaterial.Material.ShaderParamData = selectedMaterial.Material.ShaderParamData;
|
||||
targetMaterial.Material.ShaderParamDict = selectedMaterial.Material.ShaderParamDict;
|
||||
targetMaterial.Material.ShaderParams = selectedMaterial.Material.ShaderParams;
|
||||
targetMaterial.Material.VolatileFlags = selectedMaterial.Material.VolatileFlags;
|
||||
}
|
||||
if (menu.chkBoxTextures.Checked)
|
||||
{
|
||||
targetMaterial.Material.SamplerDict = selectedMaterial.Material.SamplerDict;
|
||||
targetMaterial.Material.Samplers = selectedMaterial.Material.Samplers;
|
||||
targetMaterial.Material.SamplerSlotArray = selectedMaterial.Material.SamplerSlotArray;
|
||||
targetMaterial.Material.TextureSlotArray = selectedMaterial.Material.TextureSlotArray;
|
||||
targetMaterial.Material.TextureRefs = selectedMaterial.Material.TextureRefs;
|
||||
}
|
||||
targetMaterial.ReadMaterial(targetMaterial.Material);
|
||||
}
|
||||
if (menu.chkBoxShaderOptions.Checked)
|
||||
else
|
||||
{
|
||||
targetMaterial.Material.ShaderAssign = selectedMaterial.Material.ShaderAssign;
|
||||
targetMaterial.MaterialU.Flags = selectedMaterial.MaterialU.Flags;
|
||||
targetMaterial.MaterialU.UserData = selectedMaterial.MaterialU.UserData;
|
||||
|
||||
if (menu.chkBoxRenderInfo.Checked)
|
||||
{
|
||||
targetMaterial.MaterialU.RenderState = selectedMaterial.MaterialU.RenderState;
|
||||
targetMaterial.MaterialU.RenderInfos = selectedMaterial.MaterialU.RenderInfos;
|
||||
}
|
||||
if (menu.chkBoxShaderOptions.Checked)
|
||||
{
|
||||
targetMaterial.MaterialU.ShaderAssign = selectedMaterial.MaterialU.ShaderAssign;
|
||||
}
|
||||
if (menu.chkBoxShaderParams.Checked)
|
||||
{
|
||||
targetMaterial.MaterialU.ShaderParamData = selectedMaterial.MaterialU.ShaderParamData;
|
||||
targetMaterial.MaterialU.ShaderParams = selectedMaterial.MaterialU.ShaderParams;
|
||||
targetMaterial.MaterialU.VolatileFlags = selectedMaterial.MaterialU.VolatileFlags;
|
||||
}
|
||||
if (menu.chkBoxTextures.Checked)
|
||||
{
|
||||
targetMaterial.MaterialU.Samplers = selectedMaterial.MaterialU.Samplers;
|
||||
targetMaterial.MaterialU.TextureRefs = selectedMaterial.MaterialU.TextureRefs;
|
||||
}
|
||||
targetMaterial.ReadMaterial(targetMaterial.MaterialU);
|
||||
}
|
||||
if (menu.chkBoxShaderParams.Checked)
|
||||
{
|
||||
targetMaterial.Material.ShaderParamData = selectedMaterial.Material.ShaderParamData;
|
||||
targetMaterial.Material.ShaderParamDict = selectedMaterial.Material.ShaderParamDict;
|
||||
targetMaterial.Material.ShaderParams = selectedMaterial.Material.ShaderParams;
|
||||
targetMaterial.Material.VolatileFlags = selectedMaterial.Material.VolatileFlags;
|
||||
}
|
||||
if (menu.chkBoxTextures.Checked)
|
||||
{
|
||||
targetMaterial.Material.SamplerDict = selectedMaterial.Material.SamplerDict;
|
||||
targetMaterial.Material.Samplers = selectedMaterial.Material.Samplers;
|
||||
targetMaterial.Material.SamplerSlotArray = selectedMaterial.Material.SamplerSlotArray;
|
||||
targetMaterial.Material.TextureSlotArray = selectedMaterial.Material.TextureSlotArray;
|
||||
targetMaterial.Material.TextureRefs = selectedMaterial.Material.TextureRefs;
|
||||
}
|
||||
targetMaterial.ReadMaterial(targetMaterial.Material);
|
||||
}
|
||||
private void TransformTool()
|
||||
{
|
||||
|
@ -960,7 +960,7 @@ namespace Bfres.Structs
|
||||
|
||||
List<string> BonesNotMatched = new List<string>();
|
||||
|
||||
if (ForceSkinCount && !ob.HasIndices)
|
||||
if (ForceSkinCount && !ob.HasIndices && VertexSkinCount != 0)
|
||||
{
|
||||
var attributeIndex = new FSHP.VertexAttribute();
|
||||
attributeIndex.Format = ResGFX.AttribFormat.Format_8_8_8_8_UInt;
|
||||
|
@ -155,7 +155,7 @@ namespace FirstPlugin
|
||||
{
|
||||
public STToolStripItem[] NewFileMenuExtensions => null;
|
||||
public STToolStripItem[] NewFromFileMenuExtensions => newFileExt;
|
||||
public STToolStripItem[] ToolsMenuExtensions => null;
|
||||
public STToolStripItem[] ToolsMenuExtensions => toolExt;
|
||||
public STToolStripItem[] TitleBarExtensions => null;
|
||||
public STToolStripItem[] CompressionMenuExtensions => null;
|
||||
public STToolStripItem[] ExperimentalMenuExtensions => null;
|
||||
@ -163,11 +163,77 @@ namespace FirstPlugin
|
||||
public ToolStripButton[] IconButtonMenuExtensions => null;
|
||||
|
||||
STToolStripItem[] newFileExt = new STToolStripItem[1];
|
||||
STToolStripItem[] toolExt = new STToolStripItem[1];
|
||||
|
||||
public MenuExt()
|
||||
{
|
||||
toolExt[0] = new STToolStripItem("Textures");
|
||||
toolExt[0].DropDownItems.Add(new STToolStripItem("Batch Export (BFLIM)", Export));
|
||||
newFileExt[0] = new STToolStripItem("BFLIM From Image", CreateNew);
|
||||
}
|
||||
private void Export(object sender, EventArgs args)
|
||||
{
|
||||
string formats = FileFilters.GTX;
|
||||
|
||||
string[] forms = formats.Split('|');
|
||||
|
||||
List<string> Formats = new List<string>();
|
||||
for (int i = 0; i < forms.Length; i++)
|
||||
{
|
||||
if (i > 1 || i == (forms.Length - 1)) //Skip lines with all extensions
|
||||
{
|
||||
if (!forms[i].StartsWith("*"))
|
||||
Formats.Add(forms[i]);
|
||||
}
|
||||
}
|
||||
|
||||
BatchFormatExport form = new BatchFormatExport(Formats);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string Extension = form.GetSelectedExtension();
|
||||
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Multiselect = true;
|
||||
ofd.Filter = Utils.GetAllFilters(typeof(BFLIM));
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
FolderSelectDialog folderDialog = new FolderSelectDialog();
|
||||
if (folderDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
foreach (string file in ofd.FileNames)
|
||||
{
|
||||
var FileFormat = STFileLoader.OpenFileFormat(file);
|
||||
if (FileFormat == null)
|
||||
continue;
|
||||
|
||||
SearchBinary(FileFormat, folderDialog.SelectedPath, Extension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SearchBinary(IFileFormat FileFormat, string Folder, string Extension)
|
||||
{
|
||||
if (FileFormat is SARC)
|
||||
{
|
||||
foreach (var file in ((SARC)FileFormat).Files)
|
||||
{
|
||||
var archiveFile = STFileLoader.OpenFileFormat(file.FullName, file.Data);
|
||||
if (archiveFile == null)
|
||||
continue;
|
||||
|
||||
SearchBinary(archiveFile, Folder, Extension);
|
||||
}
|
||||
}
|
||||
if (FileFormat is BFLIM)
|
||||
{
|
||||
((BFLIM)FileFormat).Export(Folder + FileFormat.FileName + Extension);
|
||||
}
|
||||
|
||||
FileFormat.Unload();
|
||||
}
|
||||
|
||||
public void CreateNew(object sender, EventArgs args)
|
||||
{
|
||||
|
@ -298,6 +298,7 @@ namespace FirstPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint unk;
|
||||
public int unk2;
|
||||
|
||||
|
@ -213,10 +213,10 @@ namespace FirstPlugin
|
||||
{
|
||||
foreach (var file in ((SARC)FileFormat).Files)
|
||||
{
|
||||
string ext = System.IO.Path.GetExtension(file.Key);
|
||||
string ext = System.IO.Path.GetExtension(file.FullName);
|
||||
if (ext == ".bfres")
|
||||
{
|
||||
bfresFiles.Add((BFRES)STFileLoader.OpenFileFormat(file.Key, file.Value));
|
||||
bfresFiles.Add((BFRES)STFileLoader.OpenFileFormat(file.FullName, file.Data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
@ -247,7 +247,6 @@ namespace Switch_Toolbox.Library.Forms
|
||||
if (ActiveObjects.Count <= 0 || ActiveMaterial == null || Runtime.OpenTKInitialized == false)
|
||||
return;
|
||||
|
||||
|
||||
SetupRendering(1);
|
||||
|
||||
gL_ControlLegacy2D1.MakeCurrent();
|
||||
|
Loading…
Reference in New Issue
Block a user