1
0
mirror of synced 2024-11-12 10:10:50 +01:00

Convert switch to wii u param anims and also convert yaml

This commit is contained in:
KillzXGaming 2019-08-26 20:24:14 -04:00
parent 4ea3e5967f
commit 2ce4ff14b9
3 changed files with 85 additions and 12 deletions

View File

@ -62,19 +62,35 @@ namespace Bfres.Structs
ShaderParamAnim.Name = Text;
LoadAnim(ShaderParamAnim, AnimationType.ShaderParam);
}
if (ext == ".bfcsh")
else if (ext == ".bfcsh")
{
ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.Color);
ShaderParamAnim.Name = Text;
LoadAnim(ShaderParamAnim, AnimationType.Color);
}
if (ext == ".bftsh")
else if (ext == ".bftsh")
{
ShaderParamAnim.Import(FileName, resFile, ShaderParamAnimType.TextureSRT);
ShaderParamAnim.Name = Text;
LoadAnim(ShaderParamAnim, AnimationType.TexturePattern);
}
if (ext == ".clr0")
else if (ext == ".bfmaa")
{
var fmaa = new Syroot.NintenTools.NSW.Bfres.MaterialAnim(); ;
fmaa.Import(FileName);
ShaderParamAnim = BfresPlatformConverter.FSHUConvertSwitchToWiiU(fmaa);
ShaderParamAnim.Name = Text;
LoadAnim(ShaderParamAnim, AnimationType.ShaderParam);
}
else if (ext == ".yaml")
{
var fmaa = new Syroot.NintenTools.NSW.Bfres.MaterialAnim();
fmaa = YamlFmaa.FromYaml(FileName);
ShaderParamAnim = BfresPlatformConverter.FSHUConvertSwitchToWiiU(fmaa);
ShaderParamAnim.Name = Text;
LoadAnim(ShaderParamAnim, AnimationType.ShaderParam);
}
else if (ext == ".clr0")
{
ShaderParamAnim = BrawlboxHelper.FSHUConverter.Clr02Fshu(FileName);
ShaderParamAnim.Name = Text;
@ -101,15 +117,25 @@ namespace Bfres.Structs
{
ShaderParamAnim.Export(FileName, GetResFile(), ShaderParamAnimType.ShaderParameter);
}
if (ext == ".bfcsh")
else if (ext == ".bfcsh")
{
ShaderParamAnim.Export(FileName, GetResFile(), ShaderParamAnimType.Color);
}
if (ext == ".bftsh")
else if (ext == ".bftsh")
{
ShaderParamAnim.Export(FileName, GetResFile(), ShaderParamAnimType.TextureSRT);
}
if (ext == ".clr0")
else if (ext == ".bfmaa")
{
var fmaa = BfresPlatformConverter.FSHUConvertWiiUToSwitch(ShaderParamAnim);
fmaa.Export(FileName, new Syroot.NintenTools.NSW.Bfres.ResFile());
}
else if (ext == ".yaml")
{
var yaml = YamlFmaa.ToYaml(FileName, BfresPlatformConverter.FSHUConvertWiiUToSwitch(ShaderParamAnim), AnimationType.ShaderParam);
System.IO.File.WriteAllText(FileName, yaml);
}
else if (ext == ".clr0")
{
}
}

View File

@ -73,6 +73,53 @@ namespace FirstPlugin
return matAnim;
}
public static ResU.ShaderParamAnim FSHUConvertSwitchToWiiU(ResNX.MaterialAnim materialAnim)
{
var shaderParamAnim = new ResU.ShaderParamAnim();
shaderParamAnim.Name = materialAnim.Name;
shaderParamAnim.Path = materialAnim.Path;
shaderParamAnim.BindIndices = materialAnim.BindIndices;
shaderParamAnim.FrameCount = materialAnim.FrameCount;
if (materialAnim.Loop)
shaderParamAnim.Flags |= ResU.ShaderParamAnimFlags.Looping;
for (int m = 0; m < materialAnim.MaterialAnimDataList.Count; m++)
{
if (materialAnim.MaterialAnimDataList[m].Constants == null)
materialAnim.MaterialAnimDataList[m].Constants = new List<ResNX.AnimConstant>();
if (materialAnim.MaterialAnimDataList[m].Curves == null)
materialAnim.MaterialAnimDataList[m].Curves = new List<ResNX.AnimCurve>();
ResU.ShaderParamMatAnim matAnimData = new ResU.ShaderParamMatAnim();
shaderParamAnim.ShaderParamMatAnims.Add(matAnimData);
matAnimData.Name = materialAnim.MaterialAnimDataList[m].Name;
matAnimData.Curves = ConvertAnimCurveSwitchToWiiU(materialAnim.MaterialAnimDataList[m].Curves);
foreach (var constants in materialAnim.MaterialAnimDataList[m].Constants)
{
matAnimData.Constants.Add(new ResU.AnimConstant()
{
AnimDataOffset = constants.AnimDataOffset,
Value = (float)constants.Value,
});
}
foreach (var paramInfoNX in materialAnim.MaterialAnimDataList[m].ParamAnimInfos)
{
var paramInfoU = new ResU.ParamAnimInfo();
paramInfoU.Name = paramInfoNX.Name;
paramInfoU.BeginCurve = paramInfoNX.BeginCurve;
paramInfoU.BeginConstant = paramInfoNX.BeginConstant;
paramInfoU.FloatCurveCount = paramInfoNX.FloatCurveCount;
paramInfoU.IntCurveCount = paramInfoNX.IntCurveCount;
paramInfoU.SubBindIndex = paramInfoNX.SubBindIndex;
matAnimData.ParamAnimInfos.Add(paramInfoU);
}
}
return shaderParamAnim;
}
public static ResNX.MaterialAnim FSHUConvertWiiUToSwitch(ResU.ShaderParamAnim ShaderAnim)
{
ResNX.MaterialAnim matAnim = new ResNX.MaterialAnim();

View File

@ -26,12 +26,12 @@ namespace FirstPlugin
public static string FMAA = GetFilter(".bfmaa",".yaml", ".gif");
public static string FSHU_REPLACE_PARAM = GetFilter(".bfmaa", ".bfshu");
public static string FSHU_REPLACE_SRT = GetFilter(".bfmaa", ".bftsh");
public static string FSHU_REPLACE_COLOR = GetFilter(".bfmaa", ".bfcsh", ".clr0");
public static string FSHU_EXPORT_PARAM = GetFilter(".bfmaa", ".bfshu");
public static string FSHU_EXPORT_SRT = GetFilter(".bfmaa", ".bftsh");
public static string FSHU_EXPORT_COLOR = GetFilter(".bfmaa", ".bfcsh");
public static string FSHU_REPLACE_PARAM = GetFilter(".bfmaa", ".bfshu", ".yaml");
public static string FSHU_REPLACE_SRT = GetFilter(".bfmaa", ".bftsh", ".yaml");
public static string FSHU_REPLACE_COLOR = GetFilter(".bfmaa", ".bfcsh", ".yaml", ".clr0");
public static string FSHU_EXPORT_PARAM = GetFilter(".bfmaa", ".bfshu", ".yaml");
public static string FSHU_EXPORT_SRT = GetFilter(".bfmaa", ".bftsh", ".yaml");
public static string FSHU_EXPORT_COLOR = GetFilter(".bfmaa", ".bfcsh", ".yaml");
public static string FCLH = GetFilter(".bfcsh");
public static string FSTH = GetFilter(".bfsth");