More yaml improvements

This commit is contained in:
KillzXGaming 2019-07-13 21:08:59 -04:00
parent 39ab6d820a
commit 859303408c
5 changed files with 25 additions and 3 deletions

Binary file not shown.

View file

@ -16,6 +16,7 @@ namespace FirstPlugin
{ {
public string Name { get; set; } public string Name { get; set; }
public string Path { get; set; } public string Path { get; set; }
public bool Loop { get; set; }
public int FrameCount { get; set; } public int FrameCount { get; set; }
public List<MatAnimConfig> MaterialAnimConfigs = new List<MatAnimConfig>(); public List<MatAnimConfig> MaterialAnimConfigs = new List<MatAnimConfig>();
@ -25,6 +26,7 @@ namespace FirstPlugin
Name = materialAnim.Name; Name = materialAnim.Name;
Path = materialAnim.Path; Path = materialAnim.Path;
FrameCount = materialAnim.FrameCount; FrameCount = materialAnim.FrameCount;
Loop = materialAnim.Loop;
foreach (var mat in materialAnim.MaterialAnimDataList) foreach (var mat in materialAnim.MaterialAnimDataList)
{ {
@ -87,15 +89,24 @@ namespace FirstPlugin
MaterialAnim matAnim = new MaterialAnim(); MaterialAnim matAnim = new MaterialAnim();
matAnim.Name = Name; matAnim.Name = Name;
matAnim.Path = Path; matAnim.Path = Path;
matAnim.Loop = Loop;
matAnim.FrameCount = FrameCount; matAnim.FrameCount = FrameCount;
matAnim.TextureNames = GenerateTextureList(); matAnim.TextureNames = GenerateTextureList();
matAnim.BindIndices = new ushort[MaterialAnimConfigs.Count];
for (int i = 0; i < matAnim.BindIndices.Length; i++)
matAnim.BindIndices[i] = ushort.MaxValue;
foreach (var matCfg in MaterialAnimConfigs) foreach (var matCfg in MaterialAnimConfigs)
{ {
var matAnimData = new MaterialAnimData(); var matAnimData = new MaterialAnimData();
matAnimData.Constants = new List<AnimConstant>(); matAnimData.Constants = new List<AnimConstant>();
matAnimData.Curves = new List<AnimCurve>(); matAnimData.Curves = new List<AnimCurve>();
matAnimData.BeginVisalConstantIndex = 0; matAnimData.BeginVisalConstantIndex = -1;
matAnimData.ShaderParamCurveIndex = -1;
matAnimData.VisualConstantIndex = -1;
matAnimData.TexturePatternCurveIndex = -1;
matAnimData.VisalCurveIndex = -1;
matAnim.MaterialAnimDataList.Add(matAnimData);
foreach (var texturePatternCfg in matCfg.TexturePatternInfos) foreach (var texturePatternCfg in matCfg.TexturePatternInfos)
{ {
@ -107,6 +118,9 @@ namespace FirstPlugin
} }
else if (texturePatternCfg.CurveData != null) else if (texturePatternCfg.CurveData != null)
{ {
matAnimData.TexturePatternCurveIndex = 0;
matAnimData.BeginVisalConstantIndex = 0;
AnimCurve curve = new AnimCurve(); AnimCurve curve = new AnimCurve();
matAnimData.Curves.Add(curve); matAnimData.Curves.Add(curve);
@ -231,8 +245,16 @@ namespace FirstPlugin
public static MaterialAnim FromYaml(string Name) public static MaterialAnim FromYaml(string Name)
{ {
var serializer = new Serializer(); var serializerSettings = new SerializerSettings()
var config = serializer.Deserialize(Name); {
EmitTags = false
};
serializerSettings.DefaultStyle = YamlStyle.Any;
serializerSettings.ComparerForKeySorting = null;
var serializer = new Serializer(serializerSettings);
var config = serializer.Deserialize<AnimConfig>(Name);
return ((AnimConfig)config).FromYaml(); return ((AnimConfig)config).FromYaml();
} }