diff --git a/.vs/Switch_Toolbox/v15/.suo b/.vs/Switch_Toolbox/v15/.suo index 0455f9d9..ddf6fc70 100644 Binary files a/.vs/Switch_Toolbox/v15/.suo and b/.vs/Switch_Toolbox/v15/.suo differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide index 1241a6bd..aacd7d15 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal index c508ef8b..a50fcfd9 100644 Binary files a/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal and b/.vs/Switch_Toolbox/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Switch_FileFormatsMain/GUI/BFRES/TexturePattern/BfresTexturePatternEditor.cs b/Switch_FileFormatsMain/GUI/BFRES/TexturePattern/BfresTexturePatternEditor.cs index 3ec7bae5..90cc1282 100644 --- a/Switch_FileFormatsMain/GUI/BFRES/TexturePattern/BfresTexturePatternEditor.cs +++ b/Switch_FileFormatsMain/GUI/BFRES/TexturePattern/BfresTexturePatternEditor.cs @@ -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); diff --git a/Switch_FileFormatsMain/YAML/YamlFmaa.cs b/Switch_FileFormatsMain/YAML/YamlFmaa.cs index 580a5118..52416b56 100644 --- a/Switch_FileFormatsMain/YAML/YamlFmaa.cs +++ b/Switch_FileFormatsMain/YAML/YamlFmaa.cs @@ -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(); matAnimData.Curves = new List(); + matAnimData.TexturePatternAnimInfos = new List(); + matAnimData.ParamAnimInfos = new List(); 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 GenerateTextureList() diff --git a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache index 40af46bb..8657c337 100644 Binary files a/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache and b/Switch_FileFormatsMain/obj/Release/DesignTimeResolveAssemblyReferences.cache differ