mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Fixed batch processing with refactored code
This commit is contained in:
@@ -54,6 +54,7 @@ namespace Flowframes
|
||||
public static async Task ImportImages(string inpath, string outpath, bool delSrc = false, bool showLog = true)
|
||||
{
|
||||
if (showLog) Logger.Log("Importing images...");
|
||||
Logger.Log($"Importing images from {inpath} to {outpath}.");
|
||||
IOUtils.CreateDir(outpath);
|
||||
string concatFile = Path.Combine(Paths.GetDataPath(), "png-concat-temp.ini");
|
||||
string concatFileContent = "";
|
||||
|
||||
@@ -35,10 +35,32 @@ namespace Flowframes
|
||||
outMode = outModeArg;
|
||||
tilesize = tilesizeArg;
|
||||
|
||||
try
|
||||
{
|
||||
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
|
||||
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
||||
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
||||
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
||||
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
|
||||
}
|
||||
catch
|
||||
{
|
||||
Logger.Log("Tried to create InterpSettings struct without an inpath. Can't set tempFolder, framesFolder and interpFolder.", true);
|
||||
tempFolder = "";
|
||||
framesFolder = "";
|
||||
interpFolder = "";
|
||||
inputIsFrames = false;
|
||||
outFilename = "";
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdatePaths (string inPathArg, string outPathArg)
|
||||
{
|
||||
inPath = inPathArg;
|
||||
outPath = outPathArg;
|
||||
tempFolder = InterpolateUtils.GetTempFolderLoc(inPath, outPath);
|
||||
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
||||
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
||||
|
||||
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
||||
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
|
||||
}
|
||||
|
||||
@@ -115,9 +115,10 @@ namespace Flowframes.Forms
|
||||
}
|
||||
|
||||
public async Task LoadDroppedPaths (string[] droppedPaths)
|
||||
{
|
||||
{
|
||||
foreach (string path in droppedPaths)
|
||||
{
|
||||
Logger.Log($"Dropped file: '{path}'", true);
|
||||
string frame1 = Path.Combine(path, "00000001.png");
|
||||
if (IOUtils.IsPathDirectory(path) && !File.Exists(frame1))
|
||||
{
|
||||
@@ -125,11 +126,11 @@ namespace Flowframes.Forms
|
||||
continue;
|
||||
}
|
||||
|
||||
InterpSettings dragDropEntry = Program.mainForm.GetCurrentSettings();
|
||||
dragDropEntry.inPath = path;
|
||||
dragDropEntry.outPath = path.GetParentDir();
|
||||
dragDropEntry.inFps = GetFramerate(path);
|
||||
Program.batchQueue.Enqueue(dragDropEntry);
|
||||
InterpSettings current = Program.mainForm.GetCurrentSettings();
|
||||
current.UpdatePaths(path, path.GetParentDir());
|
||||
current.inFps = GetFramerate(path);
|
||||
current.outFps = current.inFps * current.interpFactor;
|
||||
Program.batchQueue.Enqueue(current);
|
||||
RefreshGui();
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ namespace Flowframes.Main
|
||||
SetBusy(true);
|
||||
Program.mainForm.LoadBatchEntry(entry); // Load entry into GUI
|
||||
Interpolate.current = entry;
|
||||
// Interpolate.interpFactor = entry.interpFactor;
|
||||
// Interpolate.SetFps(entry.inFps);
|
||||
Program.mainForm.runBtn_Click(null, null);
|
||||
|
||||
await Task.Delay(2000);
|
||||
|
||||
@@ -32,13 +32,6 @@ namespace Flowframes
|
||||
|
||||
static Stopwatch sw = new Stopwatch();
|
||||
|
||||
|
||||
public static void SetFps(float inFps)
|
||||
{
|
||||
// TODO: Can't I remove this?
|
||||
current.SetFps(inFps);
|
||||
}
|
||||
|
||||
public static async void Start()
|
||||
{
|
||||
canceled = false;
|
||||
|
||||
@@ -269,7 +269,7 @@ namespace Flowframes.Main
|
||||
}
|
||||
else
|
||||
{
|
||||
return resolution;
|
||||
return new Size(RoundDiv2(resolution.Width), RoundDiv2(resolution.Height));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user