mirror of
https://github.com/KillzXGaming/Switch-Toolbox
synced 2024-12-26 04:43:09 +00:00
d1f03b161f
Rework UI from scratch with proper themes and custom controls. MDI windows are now used for workspaces, comparing docs, and multiple usages. Tabs organise multiple workspaces and you can keep mdi windows maximized if you want to only use tabs. Themes currently include dark and white theme but plan to have XML files with list of color and styles Alot of things optimized. UI is very fast and snappy now Dae rigging fixed. Dae bones can be imported. Dae with textures can be imported and exported to a folder Custom sampler editor for sampler data. Texture refs, shader options, params, render info, and basically all material data can be added/removed and edited User data editor Update opengl framework by JuPaHe64 to the newest. Includes an origintation cube, multiple models in a scene, and many improvements Skeleton can be viewed GFPAK with some fixes in saving NUTEXB has proper mip map viewing PTCL Editor (Wii U and Switch). Can edit colors ( Wii U) and view textures. Also EFFN files in smash ultimate can be previewed Files can be associated with the program and opened with on clicking them ASTC textures can be viewed UVs can be viewed. Includes wrap modes and also translating and scaling for some basic edits Textures use a new editor. It includes channel viewing and some new editing options Fixed black textures on some wii u bfres Fixed saving sarcs in sarcs Shortcut keys have been added in. CTRL + S can save the active file in the currently used window Fix more issues with bfres crashing File - New includes BNTX for creating new bntx files from scatch Raw shader binaries can be extracted from bnsh and bfsha. Yuzu and Ryujinx can decompile these Sharc files can have source data previewed and shader programs in XML Aamp v1 and v2 data can be previewed. v1 can be edited and saved atm, v2 will be at a later update Byaml uses it's own editor instead of a seperate window for easy saving within sarcs Archives have a hex viewer Dae exporting greatly improved and can export rigged meshes Scene, shader param, srt, color, and texture pattern animations can all be previewed (in a list) Memory usage is greatly improved Narc (Nitro Archives) can be viewed and extracted. Fixed importing TGA images Support importing ASTC textures for bntx Added in PBR lighting for bfres from my implimentaion in forge Added gradient background for viewport. This can be edited in the settings Added skybox background option for viewport. Can load cubemaps Added grid with customizable cells for viewport. DDS decompression no longer requires Direct X tex. Zlib decompression has been improved for opening files that use it Rigid bones are properly ordered on importing a mesh. May fix some exploding issues. Endianness for KCL can be toggled for saving. Will be set to what it was using orignally Tangents can be filled with a constant value. Will allow them to not cause seams nor flat lighting however normal maps may not work as good Vertex buffers can be added and removed. Also re encoded Parameters now use drop down panels with values for easier editing Reworked the bone editor. Everything for a bone can be fully edited now besides the index, billboard index and parent index which get set automatically Fixed animation scaling for skeletal animations finally! Textures can be loaded in a tab now with thumbnail displaying for easy real time edits while previewing in the viewport Fixed support for audio files to be big endian in BARS Textures for switch now use their own folder. You can easily add textures to this and add textures to bfres that have no bntx. If there are no textures then the bfres will automatically not have one on save. Animations are split into multiple sub sections for switch's material animation for easier access Bfres for wii u has better binary exporting and is fully compatiable with Wexos Toolbox (to and from) Every section can be added in as new for both wii u and switch. Every section can be renamed properly and mostly everything can be edited. (Key frame editing and a more in depth curve editor later) Added option to copy UV channel Bone weights can be previewed Tons of fixes for the switch bfres library with more games working. Splatoon 2 (more work now), BOTW, Kirby Star Allies, and more! Fixed 3.3 Wii U bfres from not opening Wii U Sharcfb files can have shader program data previewed (XML) And possibly alot more things i missed! All this is still experimental but will improve over the next few weeks
437 lines
16 KiB
C#
437 lines
16 KiB
C#
using System;
|
|
using System.Windows.Forms;
|
|
using Switch_Toolbox.Library.NodeWrappers;
|
|
using Switch_Toolbox.Library.Animations;
|
|
using Switch_Toolbox.Library.Forms;
|
|
using Switch_Toolbox.Library;
|
|
using ResU = Syroot.NintenTools.Bfres;
|
|
using ResNX = Syroot.NintenTools.NSW.Bfres;
|
|
using FirstPlugin;
|
|
|
|
namespace Bfres.Structs
|
|
{
|
|
public class BFRESAnimFolder : STGenericWrapper
|
|
{
|
|
public BFRESAnimFolder()
|
|
{
|
|
Text = "Animations";
|
|
}
|
|
|
|
public bool IsWiiU { get; set; }
|
|
|
|
public override void OnClick(TreeView treeview)
|
|
{
|
|
if (Parent is BFRES)
|
|
((BFRES)Parent).LoadEditors(this);
|
|
else if (Parent.Parent is BFRES)
|
|
{
|
|
((BFRES)Parent.Parent).LoadEditors(this);
|
|
}
|
|
else
|
|
{
|
|
((BFRES)Parent.Parent.Parent).LoadEditors(this);
|
|
}
|
|
}
|
|
|
|
public ResNX.ResFile GetResFile()
|
|
{
|
|
return ((BFRES)Parent).resFile;
|
|
}
|
|
|
|
public ResU.ResFile GetResFileU()
|
|
{
|
|
return ((BFRES)Parent).resFileU;
|
|
}
|
|
|
|
public void AddNode(BFRESGroupNode node)
|
|
{
|
|
Nodes.Add(node);
|
|
}
|
|
|
|
public void LoadMenus(bool isWiiUBfres)
|
|
{
|
|
IsWiiU = isWiiUBfres;
|
|
|
|
ContextMenuStrip.Items.Clear();
|
|
|
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("New", null,
|
|
new ToolStripMenuItem("Skeletal Animation", null, NewSkeletalAnimAction),
|
|
new ToolStripMenuItem("Shader Param Animation", null, NewShaderParamAnimAction),
|
|
new ToolStripMenuItem("Color Animation", null, NewColorAnimAction),
|
|
new ToolStripMenuItem("Texture SRT Animations", null, NewTexSrtAnimAction),
|
|
new ToolStripMenuItem("Texture Pattern Animation", null, NewTexPatAnimAction),
|
|
new ToolStripMenuItem("Bone Visibility Animation", null, NewBoneVisAnimAction),
|
|
new ToolStripMenuItem("Material Visibility Animation", null, NewMatVisAnimAction),
|
|
new ToolStripMenuItem("Shape Aniation", null, NewShapeAnimAction),
|
|
new ToolStripMenuItem("Scene Aniation", null, NewSceneAnimAction)
|
|
));
|
|
|
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Import", null,
|
|
new ToolStripMenuItem("Skeletal Animation", null, ImportSkeletalAnimAction),
|
|
new ToolStripMenuItem("Shader Param Animation", null, ImportShaderParamAnimAction),
|
|
new ToolStripMenuItem("Color Animation", null, ImportColorAnimAction),
|
|
new ToolStripMenuItem("Texture SRT Animations", null, ImportTexSrtAnimAction),
|
|
new ToolStripMenuItem("Texture Pattern Animation", null, ImportTexPatAnimAction),
|
|
new ToolStripMenuItem("Bone Visibility Animation", null, ImportBoneVisAnimAction),
|
|
new ToolStripMenuItem("Material Visibility Animation", null, ImportMatVisAnimAction),
|
|
new ToolStripMenuItem("Shape Aniation", null, ImportShapeAnimAction),
|
|
new ToolStripMenuItem("Scene Aniation", null, ImportSceneAnimAction)
|
|
));
|
|
|
|
ContextMenuStrip.Items.Add(new ToolStripMenuItem("Clear", null, ClearAction, Keys.Control | Keys.C));
|
|
}
|
|
|
|
protected void NewSkeletalAnimAction(object sender, EventArgs e) { NewSkeletalAnim(); }
|
|
protected void NewShaderParamAnimAction(object sender, EventArgs e) { NewShaderParamAnim(); }
|
|
protected void NewColorAnimAction(object sender, EventArgs e) { NewColorAnim(); }
|
|
protected void NewTexSrtAnimAction(object sender, EventArgs e) { NewTexSrtAnim(); }
|
|
protected void NewTexPatAnimAction(object sender, EventArgs e) { NewTexPatAnim(); }
|
|
protected void NewBoneVisAnimAction(object sender, EventArgs e) { NewBoneVisAnim(); }
|
|
protected void NewMatVisAnimAction(object sender, EventArgs e) { NewMatVisAnim(); }
|
|
protected void NewShapeAnimAction(object sender, EventArgs e) { NewShapeAnim(); }
|
|
protected void NewSceneAnimAction(object sender, EventArgs e) { NewSceneAnim(); }
|
|
|
|
protected void ImportSkeletalAnimAction(object sender, EventArgs e) { ImportSkeletalAnim(); }
|
|
protected void ImportShaderParamAnimAction(object sender, EventArgs e) { ImportShaderParamAnim(); }
|
|
protected void ImportColorAnimAction(object sender, EventArgs e) { ImportColorAnim(); }
|
|
protected void ImportTexSrtAnimAction(object sender, EventArgs e) { ImportTexSrtAnim(); }
|
|
protected void ImportTexPatAnimAction(object sender, EventArgs e) { ImportTexPatAnim(); }
|
|
protected void ImportBoneVisAnimAction(object sender, EventArgs e) { ImportBoneVisAnim(); }
|
|
protected void ImportMatVisAnimAction(object sender, EventArgs e) { ImportMatVisAnim(); }
|
|
protected void ImportShapeAnimAction(object sender, EventArgs e) { ImportShapeAnim(); }
|
|
protected void ImportSceneAnimAction(object sender, EventArgs e) { ImportSceneAnim(); }
|
|
|
|
public void ImportSkeletalAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = GetOrCreateFolder<FSKA>();
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportShaderParamAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
group = GetOrCreateFolder<FSHU>(MaterialAnimation.AnimationType.ShaderParam);
|
|
else
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.ShaderParam);
|
|
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportColorAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
group = GetOrCreateFolder<FSHU>(MaterialAnimation.AnimationType.Color);
|
|
else
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.Color);
|
|
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportTexSrtAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
group = GetOrCreateFolder<FSHU>(MaterialAnimation.AnimationType.ShaderParam);
|
|
else
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.ShaderParam);
|
|
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportTexPatAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
group = GetOrCreateFolder<FTXP>();
|
|
else
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.TexturePattern);
|
|
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportBoneVisAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = GetOrCreateFolder<FVIS>(VisibiltyAnimType.Bone);
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportMatVisAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
group = GetOrCreateFolder<FVIS>(VisibiltyAnimType.Material);
|
|
else
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.Visibilty);
|
|
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportSceneAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = GetOrCreateFolder<FSCN>();
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void ImportShapeAnim()
|
|
{
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
return;
|
|
|
|
BFRESGroupNode group = GetOrCreateFolder<FSHA>();
|
|
group.Import(ofd.FileNames, GetResFile(), GetResFileU());
|
|
AddFolder(group);
|
|
}
|
|
public void NewSkeletalAnim()
|
|
{
|
|
BFRESGroupNode group = GetOrCreateFolder<FSKA>();
|
|
FSKA anim = null;
|
|
if (IsWiiU)
|
|
anim = new FSKA(new ResU.SkeletalAnim());
|
|
else
|
|
anim = new FSKA(new ResNX.SkeletalAnim());
|
|
|
|
group.AddNode(anim, "NewSkeletalAnim");
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewShaderParamAnim()
|
|
{
|
|
var type = MaterialAnimation.AnimationType.ShaderParam;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
{
|
|
group = GetOrCreateFolder<FSHU>(type);
|
|
FSHU fshu = new FSHU(new ResU.ShaderParamAnim(), type);
|
|
group.AddNode(fshu, "NewShaderParamAnim");
|
|
}
|
|
else
|
|
{
|
|
group = GetOrCreateFolder<FMAA>(type);
|
|
FMAA fmaa = new FMAA(new ResNX.MaterialAnim(), type);
|
|
group.AddNode(fmaa, "NewShaderParamAnim");
|
|
}
|
|
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewColorAnim()
|
|
{
|
|
var type = MaterialAnimation.AnimationType.Color;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
{
|
|
group = GetOrCreateFolder<FSHU>(type);
|
|
FSHU fshu = new FSHU(new ResU.ShaderParamAnim(), type);
|
|
group.AddNode(fshu, "NewColorAnim");
|
|
}
|
|
else
|
|
{
|
|
group = GetOrCreateFolder<FMAA>(type);
|
|
FMAA fmaa = new FMAA(new ResNX.MaterialAnim(), type);
|
|
group.AddNode(fmaa, "NewColorAnim");
|
|
}
|
|
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewTexSrtAnim()
|
|
{
|
|
var type = MaterialAnimation.AnimationType.TextureSrt;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
{
|
|
group = GetOrCreateFolder<FSHU>(type);
|
|
FSHU fshu = new FSHU(new ResU.ShaderParamAnim(), type);
|
|
group.AddNode(fshu, "NewTextureTransformAnim");
|
|
}
|
|
else
|
|
{
|
|
group = GetOrCreateFolder<FMAA>(type);
|
|
FMAA fmaa = new FMAA(new ResNX.MaterialAnim(), type);
|
|
group.AddNode(fmaa, "NewTextureTransformAnim");
|
|
}
|
|
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewTexPatAnim()
|
|
{
|
|
var type = MaterialAnimation.AnimationType.TexturePattern;
|
|
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
{
|
|
group = GetOrCreateFolder<FTXP>();
|
|
FTXP anim = new FTXP(new ResU.TexPatternAnim());
|
|
group.AddNode(anim, "NewTexturePatternAnim");
|
|
}
|
|
else
|
|
{
|
|
group = GetOrCreateFolder<FMAA>(type);
|
|
FMAA fmaa = new FMAA(new ResNX.MaterialAnim(), type);
|
|
group.AddNode(fmaa, "NewTexturePatternAnim");
|
|
}
|
|
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewBoneVisAnim()
|
|
{
|
|
BFRESGroupNode group = GetOrCreateFolder<FVIS>(VisibiltyAnimType.Bone);
|
|
|
|
FVIS anim = null;
|
|
if (IsWiiU)
|
|
{
|
|
anim = new FVIS(new ResU.VisibilityAnim() { Type = ResU.VisibilityAnimType.Bone });
|
|
}
|
|
else
|
|
{
|
|
anim = new FVIS(new ResNX.VisibilityAnim());
|
|
}
|
|
|
|
group.AddNode(anim, "NewBoneVisAnim");
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewMatVisAnim()
|
|
{
|
|
BFRESGroupNode group = null;
|
|
if (IsWiiU)
|
|
{
|
|
group = GetOrCreateFolder<FVIS>(VisibiltyAnimType.Material);
|
|
FVIS anim = new FVIS(new ResU.VisibilityAnim() { Type = ResU.VisibilityAnimType.Material });
|
|
group.AddNode(anim, "NewMatVisAnim");
|
|
}
|
|
else
|
|
{
|
|
group = GetOrCreateFolder<FMAA>(MaterialAnimation.AnimationType.Visibilty);
|
|
FMAA fmaa = new FMAA(new ResNX.MaterialAnim(), MaterialAnimation.AnimationType.Visibilty);
|
|
group.AddNode(fmaa, "NewMatVisAnim");
|
|
}
|
|
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewShapeAnim()
|
|
{
|
|
BFRESGroupNode group = GetOrCreateFolder<FSHA>();
|
|
FSHA anim = null;
|
|
if (IsWiiU)
|
|
anim = new FSHA(new ResU.ShapeAnim());
|
|
else
|
|
anim = new FSHA(new ResNX.ShapeAnim());
|
|
|
|
group.AddNode(anim, "NewShapeAnim");
|
|
AddFolder(group);
|
|
}
|
|
|
|
public void NewSceneAnim()
|
|
{
|
|
BFRESGroupNode group = GetOrCreateFolder<FSCN>();
|
|
FSCN fshu = null;
|
|
if (IsWiiU)
|
|
fshu = new FSCN(new ResU.SceneAnim());
|
|
else
|
|
fshu = new FSCN(new ResNX.SceneAnim());
|
|
|
|
group.AddNode(fshu, "NewSceneVisAnim");
|
|
AddFolder(group);
|
|
}
|
|
|
|
private void AddFolder(BFRESGroupNode group)
|
|
{
|
|
if (!Nodes.Contains(group))
|
|
Nodes.Add(group);
|
|
}
|
|
|
|
public BFRESGroupNode GetOrCreateFolder<T>(object CheckAnimEffect = null) where T : STGenericWrapper
|
|
{
|
|
BFRESGroupNode group = new BFRESGroupNode();
|
|
|
|
if (typeof(T) == typeof(FSKA)) { group.Type = BRESGroupType.SkeletalAnim; }
|
|
if (typeof(T) == typeof(FMAA)) { group.Type = BRESGroupType.MaterialAnim; }
|
|
if (typeof(T) == typeof(FSHU)) { group.Type = BRESGroupType.ShaderParamAnim; }
|
|
if (typeof(T) == typeof(FVIS)) { group.Type = BRESGroupType.BoneVisAnim; }
|
|
if (typeof(T) == typeof(FSHA)) { group.Type = BRESGroupType.ShapeAnim; }
|
|
if (typeof(T) == typeof(FSCN)) { group.Type = BRESGroupType.SceneAnim; }
|
|
if (typeof(T) == typeof(FTXP)) { group.Type = BRESGroupType.TexPatAnim; }
|
|
|
|
if (CheckAnimEffect != null)
|
|
{
|
|
if (CheckAnimEffect is MaterialAnimation.AnimationType)
|
|
{
|
|
var type = (MaterialAnimation.AnimationType)CheckAnimEffect;
|
|
|
|
if (type == MaterialAnimation.AnimationType.Color) { group.Type = BRESGroupType.ColorAnim; }
|
|
if (type == MaterialAnimation.AnimationType.TextureSrt) { group.Type = BRESGroupType.TexSrtAnim; }
|
|
if (type == MaterialAnimation.AnimationType.ShaderParam) { group.Type = BRESGroupType.ShaderParamAnim; }
|
|
if (type == MaterialAnimation.AnimationType.TexturePattern) { group.Type = BRESGroupType.TexPatAnim; }
|
|
if (type == MaterialAnimation.AnimationType.Visibilty) { group.Type = BRESGroupType.MatVisAnim; }
|
|
}
|
|
if (CheckAnimEffect is VisibiltyAnimType)
|
|
{
|
|
var type = (VisibiltyAnimType)CheckAnimEffect;
|
|
|
|
if (type == VisibiltyAnimType.Bone) { group.Type = BRESGroupType.BoneVisAnim; }
|
|
if (type == VisibiltyAnimType.Material) { group.Type = BRESGroupType.MatVisAnim; }
|
|
}
|
|
}
|
|
group.SetNameByType();
|
|
|
|
foreach (BFRESGroupNode node in Nodes)
|
|
{
|
|
if (node.Type == group.Type)
|
|
return node;
|
|
}
|
|
|
|
return group;
|
|
}
|
|
}
|
|
}
|