Browse Source

Fixed export

flabbet 10 months ago
parent
commit
3d49c11a11

+ 2 - 0
src/PixiEditor.AnimationRenderer.FFmpeg/PixiEditor.AnimationRenderer.FFmpeg.csproj

@@ -4,6 +4,8 @@
         <TargetFramework>net8.0</TargetFramework>
         <TargetFramework>net8.0</TargetFramework>
         <ImplicitUsings>enable</ImplicitUsings>
         <ImplicitUsings>enable</ImplicitUsings>
         <Nullable>enable</Nullable>
         <Nullable>enable</Nullable>
+        <Configurations>Release;Debug</Configurations>
+        <Platforms>arm64;x64</Platforms>
     </PropertyGroup>
     </PropertyGroup>
 
 
     <ItemGroup>
     <ItemGroup>

+ 5 - 10
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ImageLayerNode.cs

@@ -85,28 +85,23 @@ public class ImageLayerNode : LayerNode, IReadOnlyImageNode
     protected override void DrawWithoutFilters(SceneObjectRenderContext ctx, DrawingSurface workingSurface,
     protected override void DrawWithoutFilters(SceneObjectRenderContext ctx, DrawingSurface workingSurface,
         Paint paint)
         Paint paint)
     {
     {
-        DrawLayer(workingSurface, paint, ctx.FrameTime); 
+        DrawLayer(workingSurface, paint, ctx); 
     }
     }
 
 
     protected override void DrawWithFilters(SceneObjectRenderContext context, DrawingSurface workingSurface,
     protected override void DrawWithFilters(SceneObjectRenderContext context, DrawingSurface workingSurface,
         Paint paint)
         Paint paint)
     {
     {
-        DrawLayer(workingSurface, paint, context.FrameTime);
+        DrawLayer(workingSurface, paint, context);
     }
     }
 
 
-    private void DrawLayer(DrawingSurface workingSurface, Paint paint, KeyFrameTime frameTime)
+    private void DrawLayer(DrawingSurface workingSurface, Paint paint, SceneObjectRenderContext ctx)
     {
     {
-        if (fullResrenderedSurface is null)
-        {
-            return;
-        }
-
         int saved = workingSurface.Canvas.Save();
         int saved = workingSurface.Canvas.Save();
 
 
         VecD topLeft = SceneSize / 2f;
         VecD topLeft = SceneSize / 2f;
-        if (frameTime.Frame != renderedSurfaceFrame)
+        if (renderedSurfaceFrame == null || ctx.IsExportRender || ctx.FrameTime.Frame != renderedSurfaceFrame)
         {
         {
-            GetLayerImageAtFrame(frameTime.Frame).DrawMostUpToDateRegionOn(
+            GetLayerImageAtFrame(ctx.FrameTime.Frame).DrawMostUpToDateRegionOn(
                 new RectI(0, 0, layerImage.LatestSize.X, layerImage.LatestSize.Y),
                 new RectI(0, 0, layerImage.LatestSize.X, layerImage.LatestSize.Y),
                 ChunkResolution.Full,
                 ChunkResolution.Full,
                 workingSurface, -(VecI)topLeft, paint);   
                 workingSurface, -(VecI)topLeft, paint);   

+ 2 - 0
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/StructureNode.cs

@@ -105,6 +105,8 @@ public abstract class StructureNode : Node, IReadOnlyStructureNode, IRenderInput
         SceneObjectRenderContext renderObjectContext = new SceneObjectRenderContext(renderTarget, localBounds,
         SceneObjectRenderContext renderObjectContext = new SceneObjectRenderContext(renderTarget, localBounds,
             context.FrameTime, context.ChunkResolution, context.DocumentSize, renderTarget == context.RenderSurface,
             context.FrameTime, context.ChunkResolution, context.DocumentSize, renderTarget == context.RenderSurface,
             context.Opacity);
             context.Opacity);
+        
+        renderObjectContext.IsExportRender = context.IsExportRender;
 
 
         Render(renderObjectContext);
         Render(renderObjectContext);
 
 

+ 6 - 0
src/PixiEditor.ChangeableDocument/Rendering/DocumentRenderer.cs

@@ -310,4 +310,10 @@ public class DocumentRenderer : IPreviewRenderable
         
         
         return true;
         return true;
     }
     }
+
+    public void RenderDocument(DrawingSurface toRenderOn, KeyFrameTime frameTime)
+    {
+        using RenderContext context = new(toRenderOn, frameTime, ChunkResolution.Full, Document.Size) { IsExportRender = true };
+        Document.NodeGraph.Execute(context);
+    }
 }
 }

+ 1 - 0
src/PixiEditor.ChangeableDocument/Rendering/RenderContext.cs

@@ -25,6 +25,7 @@ public class RenderContext : IDisposable
     public VecI DocumentSize { get; set; }
     public VecI DocumentSize { get; set; }
     
     
     public DrawingSurface RenderSurface { get; set; }
     public DrawingSurface RenderSurface { get; set; }
+    public bool IsExportRender { get; set; } = false;
 
 
     public bool IsDisposed { get; private set; }
     public bool IsDisposed { get; private set; }
 
 

+ 28 - 28
src/PixiEditor.sln

@@ -140,6 +140,8 @@ Global
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Debug|ARM64.Build.0 = Debug|Any CPU
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Debug|ARM64.Build.0 = Debug|Any CPU
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Release|x64.ActiveCfg = Release|Any CPU
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Release|x64.ActiveCfg = Release|Any CPU
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Release|x64.Build.0 = Release|Any CPU
 		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Release|x64.Build.0 = Release|Any CPU
+		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Steam|x64.ActiveCfg = Release|Any CPU
+		{80BB2920-3DC0-406C-9E2B-30B08D5CC7A8}.Steam|x64.Build.0 = Release|Any CPU
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.ActiveCfg = Debug|x64
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.ActiveCfg = Debug|x64
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.Build.0 = Debug|x64
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.Build.0 = Debug|x64
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.Deploy.0 = Debug|x64
 		{1F97F972-F9E8-4F35-A8B5-3F71408D2230}.Debug|x64.Deploy.0 = Debug|x64
@@ -645,34 +647,6 @@ Global
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|ARM64.Build.0 = Debug|Any CPU
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|ARM64.Build.0 = Debug|Any CPU
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|x64.ActiveCfg = Release|Any CPU
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|x64.ActiveCfg = Release|Any CPU
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|x64.Build.0 = Release|Any CPU
 		{9B552A44-9587-4410-8673-254B31E2E4F7}.Steam|x64.Build.0 = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|x64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|x64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|x64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|x64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|x64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|x64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|x64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|x64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|x64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|x64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|x64.ActiveCfg = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|x64.Build.0 = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|ARM64.ActiveCfg = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|ARM64.Build.0 = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|ARM64.ActiveCfg = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|ARM64.Build.0 = Debug|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|x64.ActiveCfg = Release|Any CPU
-		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|x64.Build.0 = Release|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|x64.ActiveCfg = Debug|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|x64.Build.0 = Debug|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|x64.Build.0 = Debug|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
 		{E92E7B0E-C24B-4087-9DD9-AD10DA3BE80A}.Debug|ARM64.ActiveCfg = Debug|Any CPU
@@ -879,6 +853,32 @@ Global
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|x64.Build.0 = Debug|Any CPU
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|x64.Build.0 = Debug|Any CPU
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|ARM64.ActiveCfg = Debug|Any CPU
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|ARM64.ActiveCfg = Debug|Any CPU
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|ARM64.Build.0 = Debug|Any CPU
 		{786E1F87-4A10-493E-88BD-3F2461DBFCA0}.Steam|ARM64.Build.0 = Debug|Any CPU
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|x64.ActiveCfg = Debug|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Debug|x64.Build.0 = Debug|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|x64.ActiveCfg = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevRelease|x64.Build.0 = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.DevSteam|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|x64.ActiveCfg = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX|x64.Build.0 = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|ARM64.ActiveCfg = Debug|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|ARM64.Build.0 = Debug|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|x64.ActiveCfg = Debug|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.MSIX Debug|x64.Build.0 = Debug|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|x64.ActiveCfg = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Release|x64.Build.0 = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|ARM64.ActiveCfg = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|ARM64.Build.0 = Release|arm64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|x64.ActiveCfg = Release|x64
+		{CD863C88-72E3-40F4-9AAE-5696BBB4460C}.Steam|x64.Build.0 = Release|x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE

+ 0 - 2
src/PixiEditor/Models/Rendering/AnimationPreviewRenderer.cs

@@ -9,8 +9,6 @@ namespace PixiEditor.Models.Rendering;
 
 
 internal class AnimationKeyFramePreviewRenderer(DocumentInternalParts internals) : IPreviewRenderable
 internal class AnimationKeyFramePreviewRenderer(DocumentInternalParts internals) : IPreviewRenderable
 {
 {
-    private readonly DocumentInternalParts internals = internals;
-    
     public RectD? GetPreviewBounds(int frame, string elementToRenderName = "")
     public RectD? GetPreviewBounds(int frame, string elementToRenderName = "")
     {
     {
         if (internals.Tracker.Document.AnimationData.TryFindKeyFrame(
         if (internals.Tracker.Document.AnimationData.TryFindKeyFrame(

+ 1 - 16
src/PixiEditor/ViewModels/Document/DocumentViewModel.cs

@@ -520,24 +520,9 @@ internal partial class DocumentViewModel : PixiObservableObject, IDocument
         try
         try
         {
         {
             Surface finalSurface = new Surface(SizeBindable);
             Surface finalSurface = new Surface(SizeBindable);
-            VecI sizeInChunks = (VecI)((VecD)SizeBindable / ChunkyImage.FullChunkSize).Ceiling();
             DrawingBackendApi.Current.RenderingDispatcher.Invoke(() =>
             DrawingBackendApi.Current.RenderingDispatcher.Invoke(() =>
             {
             {
-                for (int i = 0; i < sizeInChunks.X; i++)
-                {
-                    for (int j = 0; j < sizeInChunks.Y; j++)
-                    {
-                        // TODO: Implement this
-                        /*
-                        Renderer.RenderChunk(new(i, j), ChunkResolution.Full, frameTime);
-                        
-                        using Chunk chunk = maybeChunk.AsT0;
-                        finalSurface.DrawingSurface.Canvas.DrawSurface(
-                            chunk.Surface.DrawingSurface,
-                            i * ChunkyImage.FullChunkSize, j * ChunkyImage.FullChunkSize);
-                    */
-                    }
-                }
+                Renderer.RenderDocument(finalSurface.DrawingSurface, frameTime); 
             });
             });
 
 
             return finalSurface;
             return finalSurface;