From 98c6aedac6f8569e1f3ffc6b6830400d23821c9d Mon Sep 17 00:00:00 2001 From: N00MKRAD Date: Tue, 5 Jan 2021 23:55:16 +0100 Subject: [PATCH] Fixed scene detection in combination with deduplication --- Code/Form1.cs | 2 +- Code/Main/FrameTiming.cs | 22 +++++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Code/Form1.cs b/Code/Form1.cs index 88165b5..a598957 100644 --- a/Code/Form1.cs +++ b/Code/Form1.cs @@ -234,7 +234,7 @@ namespace Flowframes public void SetWorking(bool state, bool allowCancel = true) { - Logger.Log($"SetWorking({state})"); + Logger.Log($"SetWorking({state})", true); Control[] controlsToDisable = new Control[] { runBtn, runStepBtn, stepSelector, settingsBtn, installerBtn }; Control[] controlsToHide = new Control[] { runBtn, runStepBtn, stepSelector }; progressCircle.Visible = state; diff --git a/Code/Main/FrameTiming.cs b/Code/Main/FrameTiming.cs index 42e1950..bb900dc 100644 --- a/Code/Main/FrameTiming.cs +++ b/Code/Main/FrameTiming.cs @@ -217,14 +217,16 @@ namespace Flowframes.Main int lastNum = totalFileCount; if (debug) Logger.Log($"Writing frame {totalFileCount} [Discarding Next]", true); - fileContent += $"file '{interpPath}/{totalFileCount.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; + //fileContent += $"file '{interpPath}/{totalFileCount.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; + fileContent = WriteFrameWithDupes(dupesAmount, fileContent, totalFileCount, interpPath, ext, debug); totalFileCount++; if (debug) Logger.Log("Discarding interp frames with out num " + totalFileCount); for (int dupeCount = 1; dupeCount < interpFramesAmount; dupeCount++) { if (debug) Logger.Log($"Writing frame {totalFileCount} which is actually repeated frame {lastNum}"); - fileContent += $"file '{interpPath}/{lastNum.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; + //fileContent += $"file '{interpPath}/{lastNum.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; + fileContent = WriteFrameWithDupes(dupesAmount, fileContent, totalFileCount, interpPath, ext, debug); totalFileCount++; } @@ -232,11 +234,7 @@ namespace Flowframes.Main } else { - for(int writtenDupes = -1; writtenDupes < dupesAmount; writtenDupes++) // Write duplicates - { - if (debug) Logger.Log($"Writing frame {totalFileCount} (writtenDupes {writtenDupes})", true, false); - fileContent += $"file '{interpPath}/{totalFileCount.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; - } + fileContent = WriteFrameWithDupes(dupesAmount, fileContent, totalFileCount, interpPath, ext, debug); totalFileCount++; } } @@ -270,5 +268,15 @@ namespace Flowframes.Main if (debug) Logger.Log($"Copied loop frame to {loopFrameTargetPath}.", true); } } + + static string WriteFrameWithDupes (int dupesAmount, string fileContent, int totalFileCount, string interpPath, string ext, bool debug) + { + for (int writtenDupes = -1; writtenDupes < dupesAmount; writtenDupes++) // Write duplicates + { + if (debug) Logger.Log($"Writing frame {totalFileCount} (writtenDupes {writtenDupes})", true, false); + fileContent += $"file '{interpPath}/{totalFileCount.ToString().PadLeft(Padding.interpFrames, '0')}.{ext}'\n"; + } + return fileContent; + } } }