mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-09-01 19:51:28 +02:00
Added status change for scene blending
This commit is contained in:
@@ -150,6 +150,11 @@ namespace Flowframes
|
||||
statusLabel.Text = str;
|
||||
}
|
||||
|
||||
public string GetStatus ()
|
||||
{
|
||||
return statusLabel.Text;
|
||||
}
|
||||
|
||||
public void SetProgress(int percent)
|
||||
{
|
||||
percent = percent.Clamp(0, 100);
|
||||
|
||||
@@ -14,12 +14,17 @@ namespace Flowframes.Magick
|
||||
{
|
||||
class Blend
|
||||
{
|
||||
public static async Task BlendSceneChanges(string framesFilePath)
|
||||
public static async Task BlendSceneChanges(string framesFilePath, bool setStatus = true)
|
||||
{
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Restart();
|
||||
int totalFrames = 0;
|
||||
|
||||
string oldStatus = Program.mainForm.GetStatus();
|
||||
|
||||
if(setStatus)
|
||||
Program.mainForm.SetStatus("Blending scene transitions...");
|
||||
|
||||
string keyword = "SCN:";
|
||||
string[] framesLines = IOUtils.ReadLines(framesFilePath); // Array with frame filenames
|
||||
int amountOfBlendFrames = (int)Interpolate.current.interpFactor - 1;
|
||||
@@ -40,8 +45,6 @@ namespace Flowframes.Magick
|
||||
string ext = Path.GetExtension(firstOutputFrameName);
|
||||
int firstOutputFrameNum = firstOutputFrameName.GetInt();
|
||||
List<string> outputFilenames = new List<string>();
|
||||
//Logger.Log("BlendSceneChanges: 1 = " + img1, true);
|
||||
//Logger.Log("BlendSceneChanges: 2 = " + img2, true);
|
||||
|
||||
for (int blendFrameNum = 1; blendFrameNum <= amountOfBlendFrames; blendFrameNum++)
|
||||
{
|
||||
@@ -49,7 +52,6 @@ namespace Flowframes.Magick
|
||||
string outputPath = Path.Combine(Interpolate.current.interpFolder, outputNum.ToString().PadLeft(Padding.interpFrames, '0'));
|
||||
outputPath = Path.ChangeExtension(outputPath, ext);
|
||||
outputFilenames.Add(outputPath);
|
||||
//Logger.Log("BlendSceneChanges: Added output path " + outputPath, true);
|
||||
}
|
||||
|
||||
BlendImages(img1, img2, outputFilenames.ToArray());
|
||||
@@ -64,6 +66,9 @@ namespace Flowframes.Magick
|
||||
}
|
||||
}
|
||||
|
||||
if (setStatus)
|
||||
Program.mainForm.SetStatus(oldStatus);
|
||||
|
||||
Logger.Log($"Created {totalFrames} blend frames in {FormatUtils.TimeSw(sw)} ({(totalFrames / (sw.ElapsedMilliseconds / 1000f)).ToString("0.00")} FPS)", true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user