1
0
mirror of synced 2025-01-19 01:14:08 +01:00

Improve index setting

This commit is contained in:
KillzXGaming 2019-07-14 10:55:26 -04:00
parent a2070109e0
commit 3d671ac8a2
6 changed files with 17 additions and 3 deletions

Binary file not shown.

View File

@ -201,6 +201,9 @@ namespace FirstPlugin.Forms
}
}
if (Thread != null && Thread.IsAlive)
Thread.Abort();
Thread = new Thread((ThreadStart)(() =>
{
for (int Frame = 0; Frame <= anim.FrameCount; Frame++)
@ -279,6 +282,10 @@ namespace FirstPlugin.Forms
if (activeSampler == null)
return;
bool IsValidIndex = Index < ActiveMaterialAnim.Textures.Count && Index != -1;
if (!IsValidIndex) //Indices can be invalid for example if an animation is switched quickly in editor
return;
string TextureKey = activeSampler.GetActiveTextureNameByIndex((int)Index);
var tex = activeSampler.GetActiveTexture((int)Index);

View File

@ -102,6 +102,9 @@ namespace FirstPlugin
for (int i = 0; i < matAnim.BindIndices.Length; i++)
matAnim.BindIndices[i] = ushort.MaxValue;
int ShaderParamCurveIndex = 0;
int TexturePatternCurveIndex = 0;
Console.WriteLine("MaterialAnimConfigs " + MaterialAnimConfigs.Count);
foreach (var matCfg in MaterialAnimConfigs)
{
@ -109,6 +112,8 @@ namespace FirstPlugin
matAnimData.Name = matCfg.Name;
matAnimData.Constants = new List<AnimConstant>();
matAnimData.Curves = new List<AnimCurve>();
matAnimData.TexturePatternAnimInfos = new List<TexturePatternAnimInfo>();
matAnimData.ParamAnimInfos = new List<ParamAnimInfo>();
matAnimData.BeginVisalConstantIndex = -1;
matAnimData.ShaderParamCurveIndex = -1;
matAnimData.VisualConstantIndex = -1;
@ -119,7 +124,6 @@ namespace FirstPlugin
uint CurveIndex = 0;
ushort BeginConstantIndex = 0;
Console.WriteLine("texturePatternCfg " + matCfg.TexturePatternInfos.Count);
foreach (var texturePatternCfg in matCfg.TexturePatternInfos)
{
TexturePatternAnimInfo patternInfo = new TexturePatternAnimInfo();
@ -142,7 +146,7 @@ namespace FirstPlugin
{
patternInfo.CurveIndex = CurveIndex++;
matAnimData.TexturePatternCurveIndex = 0;
matAnimData.TexturePatternCurveIndex = TexturePatternCurveIndex;
matAnimData.BeginVisalConstantIndex = 0;
AnimCurve curve = new AnimCurve();
@ -204,9 +208,12 @@ namespace FirstPlugin
{
}
TexturePatternCurveIndex += matAnimData.TexturePatternAnimInfos.Where(item => item.CurveIndex != uint.MaxValue).ToList().Count;
ShaderParamCurveIndex += matAnimData.ParamAnimInfos.Where(item => item.BeginCurve != ushort.MaxValue).ToList().Count;
}
return matAnim;
return matAnim;
}
private List<string> GenerateTextureList()