1
0
mirror of synced 2024-12-03 11:37:21 +01:00
Switch-Toolbox/Switch_FileFormatsMain/NodeWrappers/Archives/BFRESWrapper.cs
KillzXGaming 2a92afa122 Chr0 animation importing, dae exporting and tons more improvements!
Chr0 can be imported/replaced.
More fixes to importing sections including some errors and proper filtering.
Dae epxorting now has a progress bar and an option to idsable texture exporting.
Bfska can now be swapped between platforms. More sections will handle this method soon!.
Fixed spaces on files from "Export All".
Display multiple texture maps in bcres materials
2019-05-24 15:15:35 -04:00

90 lines
2.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Switch_Toolbox.Library.NodeWrappers;
using Switch_Toolbox.Library;
using System.Windows.Forms;
using ResU = Syroot.NintenTools.Bfres;
using ResNX = Syroot.NintenTools.NSW.Bfres;
using Bfres.Structs;
namespace FirstPlugin.NodeWrappers
{
public class BFRESWrapper : STGenericWrapper
{
public override void OnClick(TreeView treeview)
{
base.OnClick(treeview);
}
public bool IsWiiU { get; set; }
public void LoadMenus(bool isWiiUBfres)
{
}
public override void Delete()
{
var editor = LibraryGUI.Instance.GetObjectEditor();
if (editor != null)
{
editor.RemoveFile(this);
editor.ResetControls();
}
}
protected void ImportModelAction(object sender, EventArgs e) { ImportModel(); }
protected void ImportEmbeddedFileAction(object sender, EventArgs e) { ImportEmbeddedFile(); }
public void ImportModel()
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() != DialogResult.OK)
return;
BFRESGroupNode group = new BFRESGroupNode(IsWiiU);
group.Import(ofd.FileNames);
}
public void ImportEmbeddedFile()
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() != DialogResult.OK)
return;
BFRESGroupNode group = new BFRESGroupNode(IsWiiU);
group.Import(ofd.FileNames);
}
public void NewModel()
{
BFRESGroupNode group = new BFRESGroupNode(IsWiiU);
FMDL anim = new FMDL();
if (IsWiiU)
BfresWiiU.ReadModel(anim, new ResU.Model());
else
BfresSwitch.ReadModel(anim, new ResNX.Model());
group.AddNode(anim, "NewModel");
}
private void SetupAddedNode(BFRESGroupNode group, STGenericWrapper node)
{
Nodes.Add(group);
TreeView.SelectedNode = node;
}
public void NewEmbeddedFile()
{
BFRESGroupNode group = new BFRESGroupNode(IsWiiU);
ExternalFileData fshu = new ExternalFileData("NewFile", new byte[0]);
group.AddNode(fshu, "NewFile");
SetupAddedNode(group, fshu);
}
}
}