Adjust material anim saving
This commit is contained in:
parent
b29538408b
commit
e4b5729788
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -126,33 +126,31 @@ namespace Bfres.Structs
|
||||
|
||||
public void SaveAnimData()
|
||||
{
|
||||
if (!IsEdited)
|
||||
return;
|
||||
|
||||
MaterialAnim.FrameCount = FrameCount;
|
||||
MaterialAnim.TextureNames = Textures;
|
||||
|
||||
int TexturePatternCurveIndex = 0;
|
||||
int ParamCurveIndex = 0;
|
||||
|
||||
MaterialAnimData data = new MaterialAnimData();
|
||||
MaterialAnim.MaterialAnimDataList.Add(data);
|
||||
|
||||
foreach (MaterialAnimEntry mat in Materials)
|
||||
{
|
||||
mat.MaterialAnimData = new MaterialAnimData();
|
||||
mat.MaterialAnimData.Name = mat.Text;
|
||||
MaterialAnim.MaterialAnimDataList.Add(mat.MaterialAnimData);
|
||||
|
||||
//Set default indices as unused for now
|
||||
mat.MaterialAnimData.BeginVisalConstantIndex = -1;
|
||||
mat.MaterialAnimData.ShaderParamCurveIndex = -1;
|
||||
mat.MaterialAnimData.TexturePatternCurveIndex = -1;
|
||||
mat.MaterialAnimData.VisalCurveIndex = -1;
|
||||
mat.MaterialAnimData.VisualConstantIndex = -1;
|
||||
if (IsEdited)
|
||||
{
|
||||
//Set default indices as unused for now
|
||||
mat.MaterialAnimData.BeginVisalConstantIndex = -1;
|
||||
mat.MaterialAnimData.ShaderParamCurveIndex = -1;
|
||||
mat.MaterialAnimData.TexturePatternCurveIndex = -1;
|
||||
mat.MaterialAnimData.VisalCurveIndex = -1;
|
||||
mat.MaterialAnimData.VisualConstantIndex = -1;
|
||||
|
||||
//Load our first curve index if a sampler or param has one
|
||||
SavePatternInfos(data, mat, TexturePatternCurveIndex);
|
||||
SaveParamInfos(data, mat, ParamCurveIndex);
|
||||
//Load our first curve index if a sampler or param has one
|
||||
// SavePatternInfos(data, mat, TexturePatternCurveIndex);
|
||||
// SaveParamInfos(data, mat, ParamCurveIndex);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateMaterialBinds();
|
||||
|
@ -24,7 +24,7 @@ namespace FirstPlugin
|
||||
public static string FSKA_EXPORT = GetFilter(".bfska", ".anim", ".seanim", ".smd", ".chr0");
|
||||
public static string FSKA_REPLACE = GetFilter(".bfska",".anim", ".seanim", ".smd", ".chr0");
|
||||
|
||||
public static string FMAA = GetFilter(".bfmaa", ".gif");
|
||||
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");
|
||||
@ -133,6 +133,7 @@ namespace FirstPlugin
|
||||
case ".astc": filters.Add(ext, "Adaptable Scalable Texture Compression"); break;
|
||||
case ".chr0": filters.Add(ext, "CHR0 Animation"); break;
|
||||
case ".anim": filters.Add(ext, "Maya Animation"); break;
|
||||
case ".yaml": filters.Add(ext, "Yet Another Markup Language"); break;
|
||||
default:
|
||||
filters.Add(ext, ""); break;
|
||||
}
|
||||
|
@ -30,10 +30,23 @@ namespace FirstPlugin
|
||||
{
|
||||
MatAnimConfig matConfig = new MatAnimConfig();
|
||||
matConfig.Name = mat.Name;
|
||||
MaterialAnimConfigs.Add(matConfig);
|
||||
|
||||
foreach (var paramInfo in mat.ParamAnimInfos)
|
||||
{
|
||||
ParamInfo paramCfg = new ParamInfo();
|
||||
paramCfg.Name = paramInfo.Name;
|
||||
paramCfg.IsConstant = paramInfo.BeginConstant != ushort.MaxValue;
|
||||
matConfig.ParamInfos.Add(paramCfg);
|
||||
|
||||
if (paramInfo.BeginCurve != ushort.MaxValue)
|
||||
{
|
||||
var curve = mat.Curves[(int)paramInfo.BeginCurve];
|
||||
for (int i = 0; i < paramInfo.IntCurveCount + paramInfo.FloatCurveCount; i++)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var patternInfo in mat.TexturePatternAnimInfos)
|
||||
@ -41,10 +54,23 @@ namespace FirstPlugin
|
||||
PatternInfo infoCfg = new PatternInfo();
|
||||
infoCfg.Name = patternInfo.Name;
|
||||
infoCfg.IsConstant = patternInfo.BeginConstant != ushort.MaxValue;
|
||||
matConfig.TexturePatternInfos.Add(infoCfg);
|
||||
|
||||
if (patternInfo.CurveIndex != uint.MaxValue)
|
||||
{
|
||||
var curve = mat.Curves[(int)patternInfo.CurveIndex];
|
||||
infoCfg.CurveData = new CurveTPConfig();
|
||||
|
||||
if (curve.Scale == 0)
|
||||
curve.Scale = 1;
|
||||
|
||||
for (int f = 0; f < curve.Frames.Length; f++)
|
||||
{
|
||||
int frame = (int)curve.Frames[f];
|
||||
int Value = (int)curve.Offset + (int)curve.Keys[f, 0] * (int)curve.Scale;
|
||||
|
||||
infoCfg.CurveData.KeyFrames.Add(frame, materialAnim.TextureNames[Value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -53,7 +79,7 @@ namespace FirstPlugin
|
||||
|
||||
public class CurveTPConfig
|
||||
{
|
||||
|
||||
public Dictionary<int, string> KeyFrames = new Dictionary<int, string>();
|
||||
}
|
||||
|
||||
public class MatAnimConfig
|
||||
@ -62,7 +88,12 @@ namespace FirstPlugin
|
||||
|
||||
public List<PatternInfo> TexturePatternInfos { get; set; }
|
||||
public List<ParamInfo> ParamInfos { get; set; }
|
||||
public List<PatternInfo> TexturePatternInfo { get; set; }
|
||||
|
||||
public MatAnimConfig()
|
||||
{
|
||||
TexturePatternInfos = new List<PatternInfo>();
|
||||
ParamInfos = new List<ParamInfo>();
|
||||
}
|
||||
}
|
||||
|
||||
public class ParamInfo
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user