浏览代码

Use temp for gif rendering

flabbet 1 月之前
父节点
当前提交
35d816e985
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14 14
      src/PixiEditor.AnimationRenderer.FFmpeg/FFMpegRenderer.cs

+ 14 - 14
src/PixiEditor.AnimationRenderer.FFmpeg/FFMpegRenderer.cs

@@ -33,7 +33,13 @@ public class FFMpegRenderer : IAnimationRenderer
             MakeExecutableIfNeeded(binaryPath);
             MakeExecutableIfNeeded(binaryPath);
         }
         }
 
 
-        string paletteTempPath = Path.Combine(Path.GetDirectoryName(outputPath), "RenderTemp", "palette.png");
+        string tempPath = Path.Combine(Path.GetTempPath(), "PixiEditor", "Rendering");
+        if (!Directory.Exists(tempPath))
+        {
+            Directory.CreateDirectory(tempPath);
+        }
+
+        string paletteTempPath = Path.Combine(tempPath, "palette.png");
 
 
         try
         try
         {
         {
@@ -46,12 +52,6 @@ public class FFMpegRenderer : IAnimationRenderer
 
 
             RawVideoPipeSource streamPipeSource = new(frames) { FrameRate = FrameRate, };
             RawVideoPipeSource streamPipeSource = new(frames) { FrameRate = FrameRate, };
 
 
-
-            if (!Directory.Exists(Path.GetDirectoryName(paletteTempPath)))
-            {
-                Directory.CreateDirectory(Path.GetDirectoryName(paletteTempPath));
-            }
-
             if (RequiresPaletteGeneration())
             if (RequiresPaletteGeneration())
             {
             {
                 GeneratePalette(streamPipeSource, paletteTempPath);
                 GeneratePalette(streamPipeSource, paletteTempPath);
@@ -98,7 +98,13 @@ public class FFMpegRenderer : IAnimationRenderer
             MakeExecutableIfNeeded(binaryPath);
             MakeExecutableIfNeeded(binaryPath);
         }
         }
 
 
-        string paletteTempPath = Path.Combine(Path.GetDirectoryName(outputPath), "RenderTemp", "palette.png");
+        string tempPath = Path.Combine(Path.GetTempPath(), "PixiEditor", "Rendering");
+        if (!Directory.Exists(tempPath))
+        {
+            Directory.CreateDirectory(tempPath);
+        }
+
+        string paletteTempPath = Path.Combine(tempPath, "palette.png");
 
 
         try
         try
         {
         {
@@ -111,12 +117,6 @@ public class FFMpegRenderer : IAnimationRenderer
 
 
             RawVideoPipeSource streamPipeSource = new(frames) { FrameRate = FrameRate, };
             RawVideoPipeSource streamPipeSource = new(frames) { FrameRate = FrameRate, };
 
 
-
-            if (!Directory.Exists(Path.GetDirectoryName(paletteTempPath)))
-            {
-                Directory.CreateDirectory(Path.GetDirectoryName(paletteTempPath));
-            }
-
             if (RequiresPaletteGeneration())
             if (RequiresPaletteGeneration())
             {
             {
                 GeneratePalette(streamPipeSource, paletteTempPath);
                 GeneratePalette(streamPipeSource, paletteTempPath);