Adjustments for anims

This commit is contained in:
KillzXGaming 2019-05-18 17:55:22 -04:00
parent 8b00b8430e
commit e51b1e2382
16 changed files with 58 additions and 17 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
.vs/Switch_Toolbox/v15/Server/sqlite3/db.lock .vs/Switch_Toolbox/v15/Server/sqlite3/db.lock
*NodeEditorWinforms-master *NodeEditorWinforms-master
*GL_EditorFramework-master *GL_EditorFramework-master
*Assimp
*.resources *.resources
Debug/ Debug/
Release/ Release/

Binary file not shown.

View file

@ -1281,10 +1281,9 @@ namespace FirstPlugin
case BRESGroupType.SkeletalAnim: case BRESGroupType.SkeletalAnim:
foreach (FSKA ska in group.Nodes) foreach (FSKA ska in group.Nodes)
{ {
// ska.SkeletalAnim.BoneAnims.Clear(); ska.SkeletalAnim.BoneAnims.Clear();
foreach (FSKA.BoneAnimNode bone in ska.Bones)
// foreach (FSKA.BoneAnimNode bone in ska.Bones) ska.SkeletalAnim.BoneAnims.Add(bone.SaveData(ska.IsEdited));
// ska.SkeletalAnim.BoneAnims.Add(bone.SaveData());
ska.SkeletalAnim.Name = ska.Text; ska.SkeletalAnim.Name = ska.Text;
resFile.SkeletalAnims.Add(ska.SkeletalAnim); resFile.SkeletalAnims.Add(ska.SkeletalAnim);
@ -1299,7 +1298,7 @@ namespace FirstPlugin
{ {
fmaa.MaterialAnim.MaterialAnimDataList.Clear(); fmaa.MaterialAnim.MaterialAnimDataList.Clear();
foreach (FMAA.MaterialAnimEntry mat in fmaa.Materials) foreach (FMAA.MaterialAnimEntry mat in fmaa.Materials)
fmaa.MaterialAnim.MaterialAnimDataList.Add(mat.SaveData()); fmaa.MaterialAnim.MaterialAnimDataList.Add(mat.SaveData(fmaa.IsEdited));
fmaa.SetName(); fmaa.SetName();
fmaa.SaveAnimData(); fmaa.SaveAnimData();
@ -1415,7 +1414,7 @@ namespace FirstPlugin
{ {
ska.SkeletalAnimU.BoneAnims.Clear(); ska.SkeletalAnimU.BoneAnims.Clear();
foreach (FSKA.BoneAnimNode bone in ska.Bones) foreach (FSKA.BoneAnimNode bone in ska.Bones)
ska.SkeletalAnimU.BoneAnims.Add(bone.SaveDataU()); ska.SkeletalAnimU.BoneAnims.Add(bone.SaveDataU(ska.IsEdited));
ska.SkeletalAnimU.Name = ska.Text; ska.SkeletalAnimU.Name = ska.Text;
resFileU.SkeletalAnims.Add(ska.Text, ska.SkeletalAnimU); resFileU.SkeletalAnims.Add(ska.Text, ska.SkeletalAnimU);
@ -1426,7 +1425,7 @@ namespace FirstPlugin
{ {
anim.ShaderParamAnim.ShaderParamMatAnims.Clear(); anim.ShaderParamAnim.ShaderParamMatAnims.Clear();
foreach (FSHU.MaterialAnimEntry bone in anim.Materials) foreach (FSHU.MaterialAnimEntry bone in anim.Materials)
anim.ShaderParamAnim.ShaderParamMatAnims.Add(bone.SaveData()); anim.ShaderParamAnim.ShaderParamMatAnims.Add(bone.SaveData(anim.IsEdited));
anim.ShaderParamAnim.Name = anim.Text; anim.ShaderParamAnim.Name = anim.Text;
@ -1437,8 +1436,8 @@ namespace FirstPlugin
foreach (FSHU anim in group.Nodes) foreach (FSHU anim in group.Nodes)
{ {
anim.ShaderParamAnim.ShaderParamMatAnims.Clear(); anim.ShaderParamAnim.ShaderParamMatAnims.Clear();
foreach (FSHU.MaterialAnimEntry bone in anim.Materials) foreach (FSHU.MaterialAnimEntry mat in anim.Materials)
anim.ShaderParamAnim.ShaderParamMatAnims.Add(bone.SaveData()); anim.ShaderParamAnim.ShaderParamMatAnims.Add(mat.SaveData(anim.IsEdited));
anim.ShaderParamAnim.Name = anim.Text; anim.ShaderParamAnim.Name = anim.Text;
resFileU.ColorAnims.Add(anim.Text, anim.ShaderParamAnim); resFileU.ColorAnims.Add(anim.Text, anim.ShaderParamAnim);
@ -1448,8 +1447,8 @@ namespace FirstPlugin
foreach (FSHU anim in group.Nodes) foreach (FSHU anim in group.Nodes)
{ {
anim.ShaderParamAnim.ShaderParamMatAnims.Clear(); anim.ShaderParamAnim.ShaderParamMatAnims.Clear();
foreach (FSHU.MaterialAnimEntry bone in anim.Materials) foreach (FSHU.MaterialAnimEntry mat in anim.Materials)
anim.ShaderParamAnim.ShaderParamMatAnims.Add(bone.SaveData()); anim.ShaderParamAnim.ShaderParamMatAnims.Add(mat.SaveData(anim.IsEdited));
anim.ShaderParamAnim.Name = anim.Text; anim.ShaderParamAnim.Name = anim.Text;
resFileU.TexSrtAnims.Add(anim.Text, anim.ShaderParamAnim); resFileU.TexSrtAnims.Add(anim.Text, anim.ShaderParamAnim);
@ -1458,6 +1457,10 @@ namespace FirstPlugin
case BRESGroupType.TexPatAnim: case BRESGroupType.TexPatAnim:
foreach (FTXP anim in group.Nodes) foreach (FTXP anim in group.Nodes)
{ {
anim.TexPatternAnim.TexPatternMatAnims.Clear();
foreach (FTXP.MaterialAnimEntry mat in anim.Materials)
anim.TexPatternAnim.TexPatternMatAnims.Add(mat.SaveData(anim.IsEdited));
anim.TexPatternAnim.Name = anim.Text; anim.TexPatternAnim.Name = anim.Text;
resFileU.TexPatternAnims.Add(anim.Text, anim.TexPatternAnim); resFileU.TexPatternAnims.Add(anim.Text, anim.TexPatternAnim);
} }

View file

@ -83,9 +83,13 @@ namespace Bfres.Structs
} }
public MaterialAnimData SaveData() public MaterialAnimData SaveData(bool IsEdited)
{ {
MaterialAnimData.Name = Text; MaterialAnimData.Name = Text;
if (IsEdited)
{
}
return MaterialAnimData; return MaterialAnimData;
} }
} }
@ -476,7 +480,7 @@ namespace Bfres.Structs
return MatAnimWrapper.Textures[(int)val]; return MatAnimWrapper.Textures[(int)val];
} }
public void AddKeyFrame(string TextureName, int Frame, bool IsConstant = false) public void AddKeyFrame(string TextureName, float Frame = -1, bool IsConstant = false)
{ {
group.Constant = IsConstant; group.Constant = IsConstant;
@ -491,6 +495,11 @@ namespace Bfres.Structs
//Set our index //Set our index
int index = MatAnimWrapper.Textures.IndexOf(TextureName); int index = MatAnimWrapper.Textures.IndexOf(TextureName);
if (Frame == -1)
{
Frame = group.EndFrame + 1; //Add to the end of the list by default
}
//For non constants we load a curve //For non constants we load a curve
if (!group.Constant) if (!group.Constant)
{ {

View file

@ -148,9 +148,13 @@ namespace Bfres.Structs
materialAnimData = data; materialAnimData = data;
} }
public ShaderParamMatAnim SaveData() public ShaderParamMatAnim SaveData(bool IsEdited)
{ {
materialAnimData.Name = Text; materialAnimData.Name = Text;
if (IsEdited)
{
}
return materialAnimData; return materialAnimData;
} }
} }

View file

@ -533,17 +533,23 @@ namespace Bfres.Structs
public BoneAnim BoneAnim; public BoneAnim BoneAnim;
public ResU.BoneAnim BoneAnimU; public ResU.BoneAnim BoneAnimU;
public ResU.BoneAnim SaveDataU() public ResU.BoneAnim SaveDataU(bool IsEdited)
{ {
BoneAnimU.Name = Text; BoneAnimU.Name = Text;
if (IsEdited)
{
}
return BoneAnimU; return BoneAnimU;
} }
public BoneAnim SaveData() public BoneAnim SaveData(bool IsEdited)
{ {
BoneAnim.Name = Text; BoneAnim.Name = Text;
if (IsEdited)
{
}
return BoneAnim; return BoneAnim;
} }

View file

@ -116,9 +116,13 @@ namespace Bfres.Structs
TexPatternMatAnim = data; TexPatternMatAnim = data;
} }
public TexPatternMatAnim SaveData() public TexPatternMatAnim SaveData(bool IsEdited)
{ {
TexPatternMatAnim.Name = Text; TexPatternMatAnim.Name = Text;
if (IsEdited)
{
}
return TexPatternMatAnim; return TexPatternMatAnim;
} }
} }

View file

@ -464,8 +464,19 @@ namespace FirstPlugin.Forms
{ {
string NewTex = editor.GetSelectedTexture(); string NewTex = editor.GetSelectedTexture();
if (ActiveMaterialAnim.Textures == null)
ActiveMaterialAnim.Textures = new List<string>();
if (!ActiveMaterialAnim.Textures.Contains(NewTex)) if (!ActiveMaterialAnim.Textures.Contains(NewTex))
ActiveMaterialAnim.Textures.Add(NewTex); ActiveMaterialAnim.Textures.Add(NewTex);
if (activeSampler != null)
{
activeSampler.AddKeyFrame(NewTex);
}
else
{
}
} }
} }

View file

@ -488,7 +488,10 @@ namespace Switch_Toolbox.Library
if (msh.HasTangentBasis) if (msh.HasTangentBasis)
vert.tan = new Vector4(msh.Tangents[v].X, msh.Tangents[v].Y, msh.Tangents[v].Z, 1); vert.tan = new Vector4(msh.Tangents[v].X, msh.Tangents[v].Y, msh.Tangents[v].Z, 1);
if (msh.HasVertexColors(0)) if (msh.HasVertexColors(0))
{
vert.col = new Vector4(msh.VertexColorChannels[0][v].R, msh.VertexColorChannels[0][v].G, msh.VertexColorChannels[0][v].B, msh.VertexColorChannels[0][v].A); vert.col = new Vector4(msh.VertexColorChannels[0][v].R, msh.VertexColorChannels[0][v].G, msh.VertexColorChannels[0][v].B, msh.VertexColorChannels[0][v].A);
Console.WriteLine("VTX Col " + vert.col);
}
if (msh.HasTangentBasis) if (msh.HasTangentBasis)
vert.bitan = new Vector4(msh.BiTangents[v].X, msh.BiTangents[v].Y, msh.BiTangents[v].Z, 1); vert.bitan = new Vector4(msh.BiTangents[v].X, msh.BiTangents[v].Y, msh.BiTangents[v].Z, 1);
vertices.Add(vert); vertices.Add(vert);

BIN
Toolbox/Assimp32.zip Normal file

Binary file not shown.

BIN
Toolbox/Lib/AssimpNet.pdb Normal file

Binary file not shown.

BIN
Toolbox/Lib/AssimpNet.zip Normal file

Binary file not shown.