Fix skeletal animation importing/exporting for wii u bfres,
This commit is contained in:
parent
86ccd5f023
commit
e82d065255
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,6 +3,3 @@
|
||||
*.resources
|
||||
Debug/
|
||||
Release/
|
||||
Switch_Toolbox/Lib/Syroot.NintenTools.Bfres.dll
|
||||
Switch_Toolbox/Lib/Syroot.NintenTools.Bfres.pdb
|
||||
Switch_Toolbox/Lib/Syroot.NintenTools.Bfres.xml
|
||||
|
@ -366,8 +366,8 @@ namespace FirstPlugin
|
||||
Nodes.Add(fksaFolder);
|
||||
foreach (ResU.SkeletalAnim ska in resFile.SkeletalAnims.Values)
|
||||
{
|
||||
BfresSkeletonAnim skeletonAnim = new BfresSkeletonAnim(ska.Name);
|
||||
skeletonAnim.Read(ska, resFile);
|
||||
FSKA skeletonAnim = new FSKA(ska.Name);
|
||||
skeletonAnim.Read(ska);
|
||||
fksaFolder.Nodes.Add(skeletonAnim);
|
||||
}
|
||||
}
|
||||
@ -377,8 +377,8 @@ namespace FirstPlugin
|
||||
Nodes.Add(fksaFolder);
|
||||
foreach (SkeletalAnim ska in resFile.SkeletalAnims)
|
||||
{
|
||||
BfresSkeletonAnim skeletonAnim = new BfresSkeletonAnim(ska.Name);
|
||||
skeletonAnim.Read(ska, resFile);
|
||||
FSKA skeletonAnim = new FSKA(ska.Name);
|
||||
skeletonAnim.Read(ska);
|
||||
fksaFolder.Nodes.Add(skeletonAnim);
|
||||
}
|
||||
}
|
||||
@ -462,7 +462,7 @@ namespace FirstPlugin
|
||||
}
|
||||
if (Nodes.ContainsKey("FSKA"))
|
||||
{
|
||||
foreach (BfresSkeletonAnim ska in Nodes["FSKA"].Nodes)
|
||||
foreach (FSKA ska in Nodes["FSKA"].Nodes)
|
||||
resFile.SkeletalAnims.Add(ska.SkeletalAnim);
|
||||
}
|
||||
if (Nodes.ContainsKey("FMAA"))
|
||||
@ -495,7 +495,7 @@ namespace FirstPlugin
|
||||
{
|
||||
var resFileU = BFRESRender.ResFileNode.resFileU;
|
||||
resFileU.Models.Clear();
|
||||
// resFileU.SkeletalAnims.Clear();
|
||||
resFileU.SkeletalAnims.Clear();
|
||||
// resFileU.SceneAnims.Clear();
|
||||
// resFileU.ShapeAnims.Clear();
|
||||
// resFileU.BoneVisibilityAnims.Clear();
|
||||
@ -516,6 +516,15 @@ namespace FirstPlugin
|
||||
resFileU.Textures.Add(tex.Text, tex.texture);
|
||||
}
|
||||
}
|
||||
if (Nodes.ContainsKey("FSKA"))
|
||||
{
|
||||
foreach (FSKA ska in Nodes["FSKA"].Nodes)
|
||||
{
|
||||
ska.SkeletalAnimU.Name = ska.Text;
|
||||
resFileU.SkeletalAnims.Add(ska.Text, ska.SkeletalAnimU);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
throw new Exception("Failed to find textures");
|
||||
|
||||
|
@ -37,10 +37,14 @@ namespace Bfres.Structs
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string folderPath = sfd.SelectedPath;
|
||||
foreach (BfresSkeletonAnim fska in Nodes)
|
||||
foreach (FSKA fska in Nodes)
|
||||
{
|
||||
string FileName = folderPath + '\\' + fska.Text + ".bfska";
|
||||
((BfresSkeletonAnim)fska).SkeletalAnim.Export(FileName, fska.GetResFile());
|
||||
|
||||
if (fska.GetResFileU() != null)
|
||||
((FSKA)fska).SkeletalAnimU.Export(FileName, fska.GetResFileU());
|
||||
else
|
||||
((FSKA)fska).SkeletalAnim.Export(FileName, fska.GetResFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -54,7 +58,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
}
|
||||
|
||||
public class BfresSkeletonAnim : Animation
|
||||
public class FSKA : Animation
|
||||
{
|
||||
public enum TrackType
|
||||
{
|
||||
@ -71,7 +75,7 @@ namespace Bfres.Structs
|
||||
public SkeletalAnim SkeletalAnim;
|
||||
public ResU.SkeletalAnim SkeletalAnimU;
|
||||
|
||||
public BfresSkeletonAnim()
|
||||
public FSKA()
|
||||
{
|
||||
ImageKey = "skeletonAnimation";
|
||||
SelectedImageKey = "skeletonAnimation";
|
||||
@ -84,7 +88,7 @@ namespace Bfres.Structs
|
||||
ContextMenu.MenuItems.Add(replace);
|
||||
replace.Click += Replace;
|
||||
}
|
||||
public BfresSkeletonAnim(string name)
|
||||
public FSKA(string name)
|
||||
{
|
||||
Text = name;
|
||||
|
||||
@ -120,7 +124,7 @@ namespace Bfres.Structs
|
||||
{
|
||||
if (GetResFileU() != null)
|
||||
{
|
||||
throw new Exception("Wii U unsupported!");
|
||||
SkeletalAnimU.Export(sfd.FileName, GetResFileU());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -137,19 +141,24 @@ namespace Bfres.Structs
|
||||
{
|
||||
if (GetResFileU() != null)
|
||||
{
|
||||
throw new Exception("Wii U unsupported!");
|
||||
SkeletalAnimU.Import(ofd.FileName, GetResFileU());
|
||||
SkeletalAnimU.Name = Text;
|
||||
Read(SkeletalAnimU);
|
||||
}
|
||||
else
|
||||
{
|
||||
SkeletalAnim.Import(ofd.FileName);
|
||||
SkeletalAnim.Name = Text;
|
||||
Read(SkeletalAnim);
|
||||
}
|
||||
}
|
||||
SkeletalAnim.Name = Text;
|
||||
}
|
||||
|
||||
public static List<Animation> SkeletonAnimations = new List<Animation>();
|
||||
public void Read(ResU.SkeletalAnim ska, ResU.ResFile b)
|
||||
public void Read(ResU.SkeletalAnim ska)
|
||||
{
|
||||
Nodes.Clear();
|
||||
Bones.Clear();
|
||||
|
||||
FrameCount = ska.FrameCount;
|
||||
SkeletalAnimU = ska;
|
||||
|
||||
@ -220,8 +229,11 @@ namespace Bfres.Structs
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Read(SkeletalAnim ska, ResFile b)
|
||||
public void Read(SkeletalAnim ska)
|
||||
{
|
||||
Nodes.Clear();
|
||||
Bones.Clear();
|
||||
|
||||
FrameCount = ska.FrameCount;
|
||||
SkeletalAnim = ska;
|
||||
|
||||
@ -311,8 +323,6 @@ namespace Bfres.Structs
|
||||
public List<FSKATrack> tracks = new List<FSKATrack>();
|
||||
public FSKANode(ResU.BoneAnim b)
|
||||
{
|
||||
return;
|
||||
|
||||
Text = b.Name;
|
||||
|
||||
sca = new Vector3(b.BaseData.Scale.X, b.BaseData.Scale.Y, b.BaseData.Scale.Z);
|
||||
|
@ -338,7 +338,7 @@ namespace FirstPlugin
|
||||
VertexBufferHelperAttrib attd = helper[attName];
|
||||
return attd.Data;
|
||||
}
|
||||
public static SkeletalAnim SetSkeletalAniamtion(BfresSkeletonAnim anim)
|
||||
public static SkeletalAnim SetSkeletalAniamtion(FSKA anim)
|
||||
{
|
||||
SkeletalAnim animation = new SkeletalAnim();
|
||||
|
||||
@ -359,7 +359,7 @@ namespace FirstPlugin
|
||||
|
||||
return animation;
|
||||
}
|
||||
private static BoneAnim createBoneAnim(Animation.KeyNode bone, BfresSkeletonAnim anim)
|
||||
private static BoneAnim createBoneAnim(Animation.KeyNode bone, FSKA anim)
|
||||
{
|
||||
BoneAnim boneAnim = new BoneAnim();
|
||||
boneAnim.Name = bone.Name;
|
||||
|
Binary file not shown.
Binary file not shown.
@ -2417,6 +2417,11 @@
|
||||
Starts serializing the data from the <see cref="P:Syroot.NintenTools.Bfres.Core.ResFileSaver.Material"/> root.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.Core.ResFileSaver.ExportSkeletalAnimation">
|
||||
<summary>
|
||||
Starts serializing the data from the <see cref="P:Syroot.NintenTools.Bfres.Core.ResFileSaver.SkeletalAnim"/> root.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.Core.ResFileSaver.Execute">
|
||||
<summary>
|
||||
Starts serializing the data from the <see cref="P:Syroot.NintenTools.Bfres.Core.ResFileSaver.ResFile"/> root.
|
||||
@ -5316,6 +5321,34 @@
|
||||
Gets or sets customly attached <see cref="P:Syroot.NintenTools.Bfres.SkeletalAnim.UserData"/> instances.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.SkeletalAnim.Import(System.IO.Stream,Syroot.NintenTools.Bfres.ResFile,System.Boolean)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Syroot.NintenTools.Bfres.Material"/> class from the given <paramref name="stream"/> which
|
||||
is optionally left open.
|
||||
</summary>
|
||||
<param name="stream">The <see cref="T:System.IO.Stream"/> to load the data from.</param>
|
||||
<param name="leaveOpen"><c>true</c> to leave the stream open after reading, otherwise <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.SkeletalAnim.Import(System.String,Syroot.NintenTools.Bfres.ResFile)">
|
||||
<summary>
|
||||
Initializes a new instance of the <see cref="T:Syroot.NintenTools.Bfres.ResFile"/> class from the file with the given
|
||||
<paramref name="fileName"/>.
|
||||
</summary>
|
||||
<param name="fileName">The name of the file to load the data from.</param>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.SkeletalAnim.Export(System.IO.Stream,Syroot.NintenTools.Bfres.ResFile,System.Boolean)">
|
||||
<summary>
|
||||
Saves the contents in the given <paramref name="stream"/> and optionally leaves it open
|
||||
</summary>
|
||||
<param name="stream">The <see cref="T:System.IO.Stream"/> to save the contents into.</param>
|
||||
<param name="leaveOpen"><c>true</c> to leave the stream open after writing, otherwise <c>false</c>.</param>
|
||||
</member>
|
||||
<member name="M:Syroot.NintenTools.Bfres.SkeletalAnim.Export(System.String,Syroot.NintenTools.Bfres.ResFile)">
|
||||
<summary>
|
||||
Saves the contents in the file with the given <paramref name="fileName"/>.
|
||||
</summary>
|
||||
<param name="fileName">The name of the file to save the contents into.</param>
|
||||
</member>
|
||||
<member name="T:Syroot.NintenTools.Bfres.SkeletalAnimFlags">
|
||||
<summary>
|
||||
Represents flags specifying how animation data is stored or should be played.
|
||||
|
BIN
Switch_Toolbox/Lib/Syroot.NintenTools.Bfres.zip
Normal file
BIN
Switch_Toolbox/Lib/Syroot.NintenTools.Bfres.zip
Normal file
Binary file not shown.
@ -16,7 +16,7 @@ namespace Switch_Toolbox.Library
|
||||
public virtual void OnMouseRightClick(TreeView treeview) { }
|
||||
public virtual void OnDoubleMouseClick(TreeView treeview) { }
|
||||
|
||||
public void Sort(TreeNode node)
|
||||
public void SortNodes(TreeNode node)
|
||||
{
|
||||
/* string[] array = new string[Nodes.Count];
|
||||
for (int i = 0; i < Nodes.Count; ++i)
|
||||
@ -29,7 +29,7 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
//Good enough for now. I'll update with a more cleaner method later
|
||||
foreach (TreeNode n in node.Nodes)
|
||||
Sort(n);
|
||||
SortNodes(n);
|
||||
try
|
||||
{
|
||||
TreeNode temp = null;
|
||||
|
Loading…
Reference in New Issue
Block a user