2018-11-22 21:54:52 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Syroot.NintenTools.NSW.Bfres;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Switch_Toolbox.Library;
|
|
|
|
|
using ResU = Syroot.NintenTools.Bfres;
|
|
|
|
|
using FirstPlugin;
|
|
|
|
|
|
|
|
|
|
namespace Bfres.Structs
|
|
|
|
|
{
|
2018-11-22 22:17:03 +01:00
|
|
|
|
|
2018-11-22 21:54:52 +01:00
|
|
|
|
public class FSKL : STSkeleton
|
|
|
|
|
{
|
|
|
|
|
public int[] Node_Array;
|
|
|
|
|
public fsklNode node;
|
|
|
|
|
public class fsklNode : TreeNodeCustom
|
|
|
|
|
{
|
|
|
|
|
public Skeleton Skeleton;
|
|
|
|
|
public ResU.Skeleton SkeletonU;
|
|
|
|
|
|
|
|
|
|
public BFRESRender BFRESRender;
|
|
|
|
|
public fsklNode()
|
|
|
|
|
{
|
|
|
|
|
Text = "Skeleton";
|
|
|
|
|
ImageKey = "skeleton";
|
|
|
|
|
SelectedImageKey = "skeleton";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 += Replace;
|
|
|
|
|
}
|
|
|
|
|
public void Export(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
|
|
|
|
sfd.Filter = "Bfres Skeleton|*.bfskl;";
|
|
|
|
|
sfd.FileName = Text;
|
|
|
|
|
sfd.DefaultExt = ".bfskl";
|
|
|
|
|
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
2018-11-23 01:40:36 +01:00
|
|
|
|
Skeleton.Export(sfd.FileName, ((FMDL)Parent).GetResFile());
|
2018-11-22 21:54:52 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void Replace(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
|
|
|
ofd.Filter = "Supported Formats|*.bfska;|" +
|
|
|
|
|
"Bfres Object (shape/vertices) |*.bfska|" +
|
|
|
|
|
"All files(*.*)|*.*";
|
|
|
|
|
|
|
|
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
Skeleton.Import(ofd.FileName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override void OnClick(TreeView treeView)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public FSKL()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public FSKL(Skeleton skl)
|
|
|
|
|
{
|
|
|
|
|
node = new fsklNode();
|
|
|
|
|
node.Skeleton = skl;
|
2018-11-23 21:39:16 +01:00
|
|
|
|
BfresSwitch.ReadSkeleton(node, skl, this);
|
2018-11-22 21:54:52 +01:00
|
|
|
|
}
|
|
|
|
|
public FSKL(ResU.Skeleton skl)
|
|
|
|
|
{
|
|
|
|
|
node = new fsklNode();
|
|
|
|
|
node.SkeletonU = skl;
|
|
|
|
|
BfresWiiU.SetSkeleton(node, skl, this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public class BfresBone : STBone
|
|
|
|
|
{
|
|
|
|
|
public bool IsVisable = true;
|
|
|
|
|
public BoneFlagsBillboard billboard;
|
|
|
|
|
public BoneFlagsRotation rotationFlags;
|
|
|
|
|
public BoneFlagsTransform transformFlags;
|
|
|
|
|
|
|
|
|
|
public Bone Bone;
|
|
|
|
|
public ResU.Bone BoneU;
|
|
|
|
|
|
|
|
|
|
public BFRESRender BFRESRender;
|
|
|
|
|
public BfresBone()
|
|
|
|
|
{
|
|
|
|
|
ImageKey = "bone";
|
|
|
|
|
SelectedImageKey = "bone";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 += Replace;
|
|
|
|
|
}
|
2018-11-23 01:40:36 +01:00
|
|
|
|
public ResFile GetResFile()
|
|
|
|
|
{
|
|
|
|
|
//ResourceFile -> FMDL -> Material Folder -> this
|
|
|
|
|
return ((FMDL)Parent.Parent).GetResFile();
|
|
|
|
|
}
|
2018-11-22 21:54:52 +01:00
|
|
|
|
public void Export(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
|
|
|
|
sfd.Filter = "Bfres Bone|*.bfbn;";
|
|
|
|
|
sfd.FileName = Text;
|
|
|
|
|
sfd.DefaultExt = ".bfbn";
|
|
|
|
|
|
|
|
|
|
if (sfd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
2018-11-23 01:40:36 +01:00
|
|
|
|
Bone.Export(sfd.FileName, GetResFile());
|
2018-11-22 21:54:52 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void Replace(object sender, EventArgs args)
|
|
|
|
|
{
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
|
|
|
ofd.Filter = "Supported Formats|*.bfska;|" +
|
|
|
|
|
"Bfres Object (shape/vertices) |*.bfska|" +
|
|
|
|
|
"All files(*.*)|*.*";
|
|
|
|
|
|
|
|
|
|
if (ofd.ShowDialog() == DialogResult.OK)
|
|
|
|
|
{
|
|
|
|
|
Bone.Import(ofd.FileName);
|
|
|
|
|
}
|
|
|
|
|
Bone.Name = Text;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public BfresBone(STSkeleton skeleton)
|
|
|
|
|
{
|
|
|
|
|
skeletonParent = skeleton;
|
|
|
|
|
}
|
|
|
|
|
public override void OnClick(TreeView treeView)
|
|
|
|
|
{
|
|
|
|
|
FormLoader.LoadBoneEditor(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|