mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-11-14 00:47:37 +00:00
Add all sections and start to add menus
This commit is contained in:
parent
5d8e765d4c
commit
e8e5c39b8f
13 changed files with 624 additions and 93 deletions
|
@ -310,61 +310,4 @@ namespace Bfres.Structs
|
|||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
public class EmbeddedFilesFolder : TreeNodeCustom
|
||||
{
|
||||
public EmbeddedFilesFolder()
|
||||
{
|
||||
Text = "Embedded Files";
|
||||
Name = "EXT";
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
public class ExternalFileData : TreeNode
|
||||
{
|
||||
public byte[] Data;
|
||||
public ExternalFileData(byte[] data, string Name)
|
||||
{
|
||||
Text = Name;
|
||||
ImageKey = "folder";
|
||||
Data = data;
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem export = new MenuItem("Export");
|
||||
ContextMenu.MenuItems.Add(export);
|
||||
export.Click += Export;
|
||||
MenuItem replace = new MenuItem("Replace");
|
||||
ContextMenu.MenuItems.Add(replace);
|
||||
replace.Click += Import;
|
||||
}
|
||||
|
||||
|
||||
private void Import(object sender, EventArgs args)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "All files(*.*)|*.*";
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Data = System.IO.File.ReadAllBytes(ofd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void Export(object sender, EventArgs args)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "All files(*.*)|*.*";
|
||||
|
||||
sfd.DefaultExt = System.IO.Path.GetExtension(Text);
|
||||
sfd.FileName = Text;
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(sfd.FileName, Data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
using System;
|
||||
using Switch_Toolbox.Library;
|
||||
using System.Windows.Forms;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
public class EmbeddedFilesFolder : TreeNodeCustom
|
||||
{
|
||||
public EmbeddedFilesFolder()
|
||||
{
|
||||
Text = "Embedded Files";
|
||||
Name = "EXT";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.models.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
public class ExternalFileData : TreeNode
|
||||
{
|
||||
public byte[] Data;
|
||||
public ExternalFileData(byte[] data, string Name)
|
||||
{
|
||||
Text = Name;
|
||||
ImageKey = "folder";
|
||||
Data = data;
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem export = new MenuItem("Export");
|
||||
ContextMenu.MenuItems.Add(export);
|
||||
export.Click += Export;
|
||||
MenuItem replace = new MenuItem("Replace");
|
||||
ContextMenu.MenuItems.Add(replace);
|
||||
replace.Click += Import;
|
||||
}
|
||||
|
||||
|
||||
private void Import(object sender, EventArgs args)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "All files(*.*)|*.*";
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Data = System.IO.File.ReadAllBytes(ofd.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void Export(object sender, EventArgs args)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "All files(*.*)|*.*";
|
||||
|
||||
sfd.DefaultExt = System.IO.Path.GetExtension(Text);
|
||||
sfd.FileName = Text;
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
System.IO.File.WriteAllBytes(sfd.FileName, Data);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using Switch_Toolbox.Library;
|
||||
using System;
|
||||
using Switch_Toolbox.Library;
|
||||
using System.Windows.Forms;
|
||||
using FirstPlugin;
|
||||
|
||||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
public class FbnvFolder : TreeNodeCustom
|
||||
|
@ -10,11 +12,39 @@ namespace Bfres.Structs
|
|||
{
|
||||
Text = "Bone Visabilty Animations";
|
||||
Name = "FBNV";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Syroot.NintenTools.NSW.Bfres;
|
||||
using System.Windows.Forms;
|
||||
using Switch_Toolbox.Library;
|
||||
using Switch_Toolbox.Library.Rendering;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using Switch_Toolbox.Library.IO;
|
||||
using Switch_Toolbox.Library.Forms;
|
||||
using ResU = Syroot.NintenTools.Bfres;
|
||||
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
||||
using ResGFX = Syroot.NintenTools.NSW.Bfres.GFX;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
|
@ -21,6 +11,34 @@ namespace Bfres.Structs
|
|||
{
|
||||
Text = "Material Animations";
|
||||
Name = "FMAA";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
}
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,36 @@ namespace Bfres.Structs
|
|||
{
|
||||
Text = "Models";
|
||||
Name = "FMDLFolder";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.models.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
|
@ -49,6 +79,9 @@ namespace Bfres.Structs
|
|||
MenuItem replace = new MenuItem("Replace Model");
|
||||
ContextMenu.MenuItems.Add(replace);
|
||||
replace.Click += Replace;
|
||||
MenuItem rename = new MenuItem("Rename");
|
||||
ContextMenu.MenuItems.Add(rename);
|
||||
rename.Click += Rename;
|
||||
MenuItem calcTansBitans = new MenuItem("Calculate Tangents/Bitangents");
|
||||
ContextMenu.MenuItems.Add(calcTansBitans);
|
||||
calcTansBitans.Click += CalcTansBitansAllShapes;
|
||||
|
@ -60,10 +93,6 @@ namespace Bfres.Structs
|
|||
MenuItem recalculateNormals = new MenuItem("Recalculate");
|
||||
normals.MenuItems.Add(recalculateNormals);
|
||||
recalculateNormals.Click += RecalculateNormals;
|
||||
|
||||
MenuItem rename = new MenuItem("Rename");
|
||||
ContextMenu.MenuItems.Add(rename);
|
||||
rename.Click += Rename;
|
||||
}
|
||||
private void SmoothNormals(object sender, EventArgs args)
|
||||
{
|
||||
|
|
|
@ -1,16 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Syroot.NintenTools.NSW.Bfres;
|
||||
using System.Windows.Forms;
|
||||
using Switch_Toolbox.Library;
|
||||
using Switch_Toolbox.Library.Rendering;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using Switch_Toolbox.Library.IO;
|
||||
using Switch_Toolbox.Library.Forms;
|
||||
using ResU = Syroot.NintenTools.Bfres;
|
||||
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
||||
using ResGFX = Syroot.NintenTools.NSW.Bfres.GFX;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
|
@ -33,15 +23,15 @@ namespace Bfres.Structs
|
|||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
private void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
private void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void Clear(object sender, EventArgs args)
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Switch_Toolbox.Library;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
public class FshpaFolder : TreeNodeCustom
|
||||
{
|
||||
public FshpaFolder()
|
||||
{
|
||||
Text = "Shape Animations";
|
||||
Name = "FSHPA";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
private void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
}
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ namespace Bfres.Structs
|
|||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Clear(object sender, EventArgs args)
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
|
@ -44,11 +44,11 @@ namespace Bfres.Structs
|
|||
((FMDL)Parent).BFRESRender.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
private void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
((FMDL)Parent).ExportAll();
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
private void Import(object sender, EventArgs args)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Supported Formats|*.bfobj;*.fbx;*.dae; *.obj;*.csv;|" +
|
||||
|
|
|
@ -15,7 +15,38 @@ namespace Bfres.Structs
|
|||
{
|
||||
Text = "Skeleton Animations";
|
||||
Name = "FSKA";
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem import = new MenuItem("Import");
|
||||
ContextMenu.MenuItems.Add(import);
|
||||
import.Click += Import;
|
||||
MenuItem exportAll = new MenuItem("Export All");
|
||||
ContextMenu.MenuItems.Add(exportAll);
|
||||
exportAll.Click += ExportAll;
|
||||
MenuItem clear = new MenuItem("Clear");
|
||||
ContextMenu.MenuItems.Add(clear);
|
||||
clear.Click += Clear;
|
||||
}
|
||||
public void Import(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
public void ExportAll(object sender, EventArgs args)
|
||||
{
|
||||
|
||||
}
|
||||
private void Clear(object sender, EventArgs args)
|
||||
{
|
||||
DialogResult dialogResult = MessageBox.Show("Are you sure you want to remove all objects? This cannot be undone!", "", MessageBoxButtons.YesNo);
|
||||
|
||||
if (dialogResult == DialogResult.Yes)
|
||||
{
|
||||
Nodes.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.models.Clear();
|
||||
((ResourceFile)Parent).BFRESRender.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadAnimations(ResU.ResFile resFile, BFRESRender BFRESRender)
|
||||
{
|
||||
foreach (var ska in resFile.SkeletalAnims.Values)
|
||||
|
@ -87,7 +118,7 @@ namespace Bfres.Structs
|
|||
ContextMenu.MenuItems.Add(replace);
|
||||
replace.Click += Replace;
|
||||
}
|
||||
public void Export(object sender, EventArgs args)
|
||||
private void Export(object sender, EventArgs args)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "Supported Formats|*.bfska;|" +
|
||||
|
@ -101,7 +132,7 @@ namespace Bfres.Structs
|
|||
SkeletalAnim.Export(sfd.FileName, BFRESRender.resFile);
|
||||
}
|
||||
}
|
||||
public void Replace(object sender, EventArgs args)
|
||||
private void Replace(object sender, EventArgs args)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Supported Formats|*.bfska;|" +
|
||||
|
|
|
@ -8,6 +8,7 @@ using FirstPlugin;
|
|||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
|
||||
public class FSKL : STSkeleton
|
||||
{
|
||||
public int[] Node_Array;
|
||||
|
|
|
@ -0,0 +1,301 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Syroot.NintenTools.NSW.Bfres;
|
||||
using Syroot.NintenTools.NSW.Bfres.Helpers;
|
||||
using OpenTK;
|
||||
using System.Windows.Forms;
|
||||
using Switch_Toolbox.Library;
|
||||
using Switch_Toolbox.Library.Rendering;
|
||||
using WeifenLuo.WinFormsUI.Docking;
|
||||
using Switch_Toolbox.Library.IO;
|
||||
using Switch_Toolbox.Library.Forms;
|
||||
using ResU = Syroot.NintenTools.Bfres;
|
||||
using ResUGX2 = Syroot.NintenTools.Bfres.GX2;
|
||||
using ResGFX = Syroot.NintenTools.NSW.Bfres.GFX;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
public class Misc
|
||||
{
|
||||
public static List<string> HackyTextureList = new List<string>(new string[] {
|
||||
"Alb", "alb", "Base", "base", "bonbon.167300917","Eye.00","EyeIce.00", "FaceDummy", "Eye01.17", "Dee.00",
|
||||
"rainbow.758540574", "Mucus._1700670200", "Eye.11", "CapTail00","eye.0","pallet_texture","Mark.930799313","InEye.1767598300","Face.00",
|
||||
"ThunderHair_Thunder_BaseColor.1751853236","FireHair_Thunder_BaseColor._162539711","IceHair_Thunder_BaseColor.674061150","BodyEnemy.1866226988",
|
||||
"Common_Scroll01._13827715"
|
||||
});
|
||||
}
|
||||
|
||||
public class ResourceFile : TreeNodeFile
|
||||
{
|
||||
public BFRESRender BFRESRender;
|
||||
|
||||
public TreeNode TextureFolder = new TreeNode("Textures");
|
||||
public ResourceFile(IFileFormat handler)
|
||||
{
|
||||
ImageKey = "bfres";
|
||||
SelectedImageKey = "bfres";
|
||||
FileHandler = handler;
|
||||
|
||||
ContextMenu = new ContextMenu();
|
||||
MenuItem save = new MenuItem("Save");
|
||||
ContextMenu.MenuItems.Add(save);
|
||||
save.Click += Save;
|
||||
|
||||
MenuItem newMenu = new MenuItem("New");
|
||||
MenuItem import = new MenuItem("Import");
|
||||
// ContextMenu.MenuItems.Add(newMenu);
|
||||
// ContextMenu.MenuItems.Add(import);
|
||||
|
||||
MenuItem rename = new MenuItem("Rename");
|
||||
ContextMenu.MenuItems.Add(rename);
|
||||
rename.Click += Rename;
|
||||
MenuItem remove = new MenuItem("Remove");
|
||||
ContextMenu.MenuItems.Add(remove);
|
||||
remove.Click += Remove;
|
||||
|
||||
if (Parent == null)
|
||||
remove.Enabled = false;
|
||||
|
||||
if (BFRES.IsWiiU)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuItem model = new MenuItem("Model");
|
||||
MenuItem fska = new MenuItem("Skeletal Animation");
|
||||
MenuItem fmaa = new MenuItem("Material Animation");
|
||||
MenuItem bonevis = new MenuItem("Bone Visual Animation");
|
||||
MenuItem shape = new MenuItem("Shape Animation");
|
||||
MenuItem scene = new MenuItem("Scene Animation");
|
||||
MenuItem embedded = new MenuItem("Embedded File");
|
||||
MenuItem texture = new MenuItem("Texture File");
|
||||
texture.Click += NewTextureFile;
|
||||
newMenu.MenuItems.Add(model);
|
||||
newMenu .MenuItems.Add(fska);
|
||||
newMenu.MenuItems.Add(fmaa);
|
||||
newMenu.MenuItems.Add(bonevis);
|
||||
newMenu.MenuItems.Add(shape);
|
||||
newMenu.MenuItems.Add(scene);
|
||||
newMenu.MenuItems.Add(embedded);
|
||||
newMenu.MenuItems.Add(texture);
|
||||
|
||||
MenuItem importmodel = new MenuItem("Model");
|
||||
MenuItem importfska = new MenuItem("Skeletal Animation");
|
||||
MenuItem importfmaa = new MenuItem("Material Animation");
|
||||
MenuItem importbonevis = new MenuItem("Bone Visual Animation");
|
||||
MenuItem importshape = new MenuItem("Shape Animation");
|
||||
MenuItem importscene = new MenuItem("Scene Animation");
|
||||
MenuItem importembedded = new MenuItem("Embedded File");
|
||||
MenuItem importtexture = new MenuItem("Texture File");
|
||||
import.MenuItems.Add(importmodel);
|
||||
import.MenuItems.Add(importfska);
|
||||
import.MenuItems.Add(importfmaa);
|
||||
import.MenuItems.Add(importbonevis);
|
||||
import.MenuItems.Add(importshape);
|
||||
import.MenuItems.Add(importscene);
|
||||
import.MenuItems.Add(importembedded);
|
||||
import.MenuItems.Add(importtexture);
|
||||
}
|
||||
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
//If has models
|
||||
if (Nodes.ContainsKey("FMDLFolder"))
|
||||
{
|
||||
if (Nodes["FMDLFolder"].Nodes.ContainsKey("FshpFolder"))
|
||||
{
|
||||
|
||||
}
|
||||
LibraryGUI.Instance.LoadViewport(Viewport.Instance);
|
||||
Viewport.Instance.gL_ControlModern1.MainDrawable = BFRESRender;
|
||||
|
||||
BFRESRender.UpdateVertexData();
|
||||
}
|
||||
}
|
||||
public void Load(ResU.ResFile resFile)
|
||||
{
|
||||
Text = resFile.Name;
|
||||
|
||||
if (resFile.Models.Count > 0)
|
||||
Nodes.Add(new FmdlFolder());
|
||||
if (resFile.Textures.Count > 0)
|
||||
AddFTEXTextures(resFile);
|
||||
if (resFile.SkeletalAnims.Count > 0)
|
||||
AddSkeletonAnims(resFile);
|
||||
if (resFile.ShaderParamAnims.Count > 0)
|
||||
Nodes.Add(new FshuFolder());
|
||||
if (resFile.ColorAnims.Count > 0)
|
||||
Nodes.Add(new FshuColorFolder());
|
||||
if (resFile.TexSrtAnims.Count > 0)
|
||||
Nodes.Add(new TexSrtFolder());
|
||||
if (resFile.TexPatternAnims.Count > 0)
|
||||
Nodes.Add(new TexPatFolder());
|
||||
if (resFile.ShapeAnims.Count > 0)
|
||||
Nodes.Add(new FshpaFolder());
|
||||
if (resFile.BoneVisibilityAnims.Count > 0)
|
||||
Nodes.Add(new FbnvFolder());
|
||||
if (resFile.SceneAnims.Count > 0)
|
||||
Nodes.Add(new FscnFolder());
|
||||
if (resFile.ExternalFiles.Count > 0)
|
||||
Nodes.Add(new EmbeddedFilesFolder());
|
||||
|
||||
foreach (var anim in resFile.ShaderParamAnims)
|
||||
Nodes["FSHA"].Nodes.Add(anim.Key);
|
||||
foreach (var anim in resFile.ColorAnims)
|
||||
Nodes["FSHAColor"].Nodes.Add(anim.Key);
|
||||
foreach (var anim in resFile.TexSrtAnims)
|
||||
Nodes["TEXSRT"].Nodes.Add(anim.Key);
|
||||
foreach (var anim in resFile.TexPatternAnims)
|
||||
Nodes["TEXPAT"].Nodes.Add(anim.Key);
|
||||
|
||||
int ext = 0;
|
||||
foreach (var extfile in resFile.ExternalFiles)
|
||||
{
|
||||
string Name = extfile.Key;
|
||||
|
||||
FileReader f = new FileReader(extfile.Value.Data);
|
||||
string Magic = f.ReadMagic(0, 4);
|
||||
if (Magic == "FSHA")
|
||||
{
|
||||
Nodes["EXT"].Nodes.Add(new BfshaFileData(extfile.Value.Data, Name));
|
||||
}
|
||||
else
|
||||
Nodes["EXT"].Nodes.Add(new ExternalFileData(extfile.Value.Data, Name));
|
||||
|
||||
f.Dispose();
|
||||
f.Close();
|
||||
|
||||
ext++;
|
||||
}
|
||||
}
|
||||
public void Load(ResFile resFile)
|
||||
{
|
||||
Text = resFile.Name;
|
||||
UpdateTree(resFile);
|
||||
|
||||
foreach (MaterialAnim anim in resFile.MaterialAnims)
|
||||
Nodes["FMAA"].Nodes.Add(anim.Name);
|
||||
foreach (ShapeAnim anim in resFile.ShapeAnims)
|
||||
Nodes["FSHPA"].Nodes.Add(anim.Name);
|
||||
foreach (VisibilityAnim anim in resFile.BoneVisibilityAnims)
|
||||
Nodes["FBNV"].Nodes.Add(anim.Name);
|
||||
foreach (SceneAnim anim in resFile.SceneAnims)
|
||||
Nodes["FSCN"].Nodes.Add(anim.Name);
|
||||
|
||||
int ext = 0;
|
||||
foreach (ExternalFile extfile in resFile.ExternalFiles)
|
||||
{
|
||||
string Name = resFile.ExternalFileDict.GetKey(ext);
|
||||
|
||||
FileReader f = new FileReader(extfile.Data);
|
||||
string Magic = f.ReadMagic(0, 4);
|
||||
if (Magic == "BNTX")
|
||||
{
|
||||
BNTX bntx = new BNTX();
|
||||
bntx.Data = extfile.Data;
|
||||
bntx.FileName = Name;
|
||||
bntx.Load();
|
||||
bntx.IFileInfo.InArchive = true;
|
||||
Nodes["EXT"].Nodes.Add(bntx.EditorRoot);
|
||||
}
|
||||
else if (Magic == "FSHA")
|
||||
{
|
||||
Nodes["EXT"].Nodes.Add(new BfshaFileData(extfile.Data, Name));
|
||||
}
|
||||
else
|
||||
Nodes["EXT"].Nodes.Add(new ExternalFileData(extfile.Data, Name));
|
||||
|
||||
f.Dispose();
|
||||
f.Close();
|
||||
|
||||
ext++;
|
||||
}
|
||||
}
|
||||
private void NewTextureFile(object sender, EventArgs args)
|
||||
{
|
||||
string Name = "textures";
|
||||
for (int i = 0; i < BFRESRender.resFile.ExternalFiles.Count; i++)
|
||||
{
|
||||
if (BFRESRender.resFile.ExternalFileDict.GetKey(i) == Name)
|
||||
Name = Name + i;
|
||||
}
|
||||
if (!Nodes.ContainsKey("EXT"))
|
||||
{
|
||||
Nodes.Add(new EmbeddedFilesFolder());
|
||||
}
|
||||
BNTX bntx = new BNTX();
|
||||
bntx.Data = new byte[0];
|
||||
BinaryTextureContainer bntxTreeNode = new BinaryTextureContainer(new byte[0], "textures", BFRESRender.resFile.Name);
|
||||
Nodes["EXT"].Nodes.Add(bntxTreeNode);
|
||||
|
||||
}
|
||||
private void NewEmbeddedFile(object sender, EventArgs args)
|
||||
{
|
||||
}
|
||||
private void Save(object sender, EventArgs args)
|
||||
{
|
||||
((BFRES)FileHandler).SaveFile();
|
||||
}
|
||||
private void Rename(object sender, EventArgs args)
|
||||
{
|
||||
RenameDialog dialog = new RenameDialog();
|
||||
dialog.SetString(Text);
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Text = dialog.textBox1.Text;
|
||||
}
|
||||
}
|
||||
private void Remove(object sender, EventArgs args)
|
||||
{
|
||||
BFRESRender.DisposeFile();
|
||||
}
|
||||
private void UpdateTree(ResFile resFile)
|
||||
{
|
||||
if (resFile.Models.Count > 0)
|
||||
Nodes.Add(new FmdlFolder());
|
||||
if (resFile.SkeletalAnims.Count > 0)
|
||||
AddSkeletonAnims(resFile);
|
||||
if (resFile.MaterialAnims.Count > 0)
|
||||
Nodes.Add(new FmmaFolder());
|
||||
if (resFile.ShapeAnims.Count > 0)
|
||||
Nodes.Add(new FshpaFolder());
|
||||
if (resFile.BoneVisibilityAnims.Count > 0)
|
||||
Nodes.Add(new FbnvFolder());
|
||||
if (resFile.SceneAnims.Count > 0)
|
||||
Nodes.Add(new FscnFolder());
|
||||
if (resFile.ExternalFiles.Count > 0)
|
||||
Nodes.Add(new EmbeddedFilesFolder());
|
||||
}
|
||||
private void AddFTEXTextures(ResU.ResFile resFile)
|
||||
{
|
||||
FTEXContainer ftexContainer = new FTEXContainer();
|
||||
foreach (ResU.Texture tex in resFile.Textures.Values)
|
||||
{
|
||||
string TextureName = tex.Name;
|
||||
FTEX texture = new FTEX();
|
||||
texture.Read(tex);
|
||||
ftexContainer.Nodes.Add(texture);
|
||||
ftexContainer.Textures.Add(texture.Text, texture);
|
||||
}
|
||||
PluginRuntime.ftexContainers.Add(ftexContainer);
|
||||
Nodes.Add(ftexContainer);
|
||||
}
|
||||
private void AddSkeletonAnims(ResU.ResFile resFile)
|
||||
{
|
||||
FskaFolder FSKA = new FskaFolder();
|
||||
FSKA.LoadAnimations(resFile, BFRESRender);
|
||||
Nodes.Add(FSKA);
|
||||
}
|
||||
private void AddSkeletonAnims(ResFile resFile)
|
||||
{
|
||||
FskaFolder FSKA = new FskaFolder();
|
||||
FSKA.LoadAnimations(resFile, BFRESRender);
|
||||
Nodes.Add(FSKA);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
using Switch_Toolbox.Library;
|
||||
using System.Windows.Forms;
|
||||
using FirstPlugin;
|
||||
|
||||
namespace Bfres.Structs
|
||||
{
|
||||
public class TexSrtFolder : TreeNodeCustom
|
||||
{
|
||||
public TexSrtFolder()
|
||||
{
|
||||
Text = "Texture SRT Animations";
|
||||
Name = "TEXSRT";
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
public class FshuFolder : TreeNodeCustom
|
||||
{
|
||||
public FshuFolder()
|
||||
{
|
||||
Text = "Shader Parameter Animations";
|
||||
Name = "FSHA";
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
public class FshuColorFolder : TreeNodeCustom
|
||||
{
|
||||
public FshuColorFolder()
|
||||
{
|
||||
Text = "Color Animations";
|
||||
Name = "FSHAColor";
|
||||
}
|
||||
public override void OnClick(TreeView treeView)
|
||||
{
|
||||
FormLoader.LoadEditor(this, Text);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -145,16 +145,18 @@
|
|||
<Compile Include="FileFormats\BFLAN.cs" />
|
||||
<Compile Include="FileFormats\BFLYT.cs" />
|
||||
<Compile Include="FileFormats\BFRES.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\BfresStructs.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\ResourceFile.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\BFSHA.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\ExternalFiles.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FBNV.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FMAA.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FMAT.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FSCN.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FSHA.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\Wii U\FSHU.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FSHP.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FSKL.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FTXP.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\Wii U\FTXP.cs" />
|
||||
<Compile Include="FileFormats\BFRES\BfresSwitch.cs" />
|
||||
<Compile Include="FileFormats\BFRES\BfresWiiU.cs" />
|
||||
<Compile Include="FileFormats\BFRES\Bfres Structs\FMDL.cs" />
|
||||
|
|
Loading…
Reference in a new issue