Browse Source

Merge branch 'master' into release

Krzysztof Krysiński 1 week ago
parent
commit
c5bfa1efc6

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit 592622a39992789d96d3ebba580eb3c24298c285
+Subproject commit 539a77bffc3ec75ae99d101434280c176fea80df

+ 22 - 4
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/LerpColorNode.cs

@@ -10,11 +10,11 @@ namespace PixiEditor.ChangeableDocument.Changeables.Graph.Nodes;
 [NodeInfo("Lerp")]
 [NodeInfo("Lerp")]
 public class LerpColorNode : Node // TODO: ILerpable as inputs? 
 public class LerpColorNode : Node // TODO: ILerpable as inputs? 
 {
 {
-    public FuncOutputProperty<Half4> Result { get; } 
+    public FuncOutputProperty<Half4> Result { get; }
     public FuncInputProperty<Half4> From { get; }
     public FuncInputProperty<Half4> From { get; }
     public FuncInputProperty<Half4> To { get; }
     public FuncInputProperty<Half4> To { get; }
     public FuncInputProperty<Float1> Time { get; }
     public FuncInputProperty<Float1> Time { get; }
-    
+
     public LerpColorNode()
     public LerpColorNode()
     {
     {
         Result = CreateFuncOutput<Half4>("Result", "RESULT", Lerp);
         Result = CreateFuncOutput<Half4>("Result", "RESULT", Lerp);
@@ -28,8 +28,26 @@ public class LerpColorNode : Node // TODO: ILerpable as inputs?
         var from = arg.GetValue(From);
         var from = arg.GetValue(From);
         var to = arg.GetValue(To);
         var to = arg.GetValue(To);
         var time = arg.GetValue(Time);
         var time = arg.GetValue(Time);
-        
-        return arg.NewHalf4(ShaderMath.Lerp(from, to, time)); 
+
+        if (arg.HasContext)
+        {
+            return arg.NewHalf4(ShaderMath.Lerp(from, to, time));
+        }
+
+        var constFrom = (Color)from.GetConstant();
+        var constTo = (Color)to.GetConstant();
+        var constTime = time.GetConstant();
+
+        double dTime = constTime switch
+        {
+            double d => d,
+            int i => i,
+            float f => f,
+            _ => throw new InvalidOperationException("Unsupported constant type for time.")
+        };
+
+        Color result = Color.Lerp(constFrom, constTo, dTime);
+        return new Half4("") { ConstantValue = result };
     }
     }
 
 
     protected override void OnExecute(RenderContext context)
     protected override void OnExecute(RenderContext context)

+ 2 - 2
src/PixiEditor.ChangeableDocument/Rendering/DocumentRenderer.cs

@@ -212,7 +212,7 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
     public void RenderDocument(DrawingSurface toRenderOn, KeyFrameTime frameTime, VecI renderSize,
     public void RenderDocument(DrawingSurface toRenderOn, KeyFrameTime frameTime, VecI renderSize,
         string? customOutput = null)
         string? customOutput = null)
     {
     {
-        var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
+        using var ctx = DrawingBackendApi.Current.RenderingDispatcher.EnsureContext();
         IsBusy = true;
         IsBusy = true;
 
 
         if (renderTexture == null || renderTexture.Size != renderSize)
         if (renderTexture == null || renderTexture.Size != renderSize)
@@ -264,7 +264,6 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
         renderTexture.DrawingSurface.Canvas.Restore();
         renderTexture.DrawingSurface.Canvas.Restore();
         toRenderOn.Canvas.Restore();
         toRenderOn.Canvas.Restore();
 
 
-        ctx.Dispose();
         IsBusy = false;
         IsBusy = false;
     }
     }
 
 
@@ -273,6 +272,7 @@ public class DocumentRenderer : IPreviewRenderable, IDisposable
         if (isExecuting) return;
         if (isExecuting) return;
 
 
         isExecuting = true;
         isExecuting = true;
+        using var ctx = DrawingBackendApi.Current?.RenderingDispatcher.EnsureContext();
         while (renderRequests.Count > 0)
         while (renderRequests.Count > 0)
         {
         {
             RenderRequest request = renderRequests.Dequeue();
             RenderRequest request = renderRequests.Dequeue();

+ 2 - 2
src/PixiEditor.Desktop/Program.cs

@@ -21,12 +21,12 @@ public class Program
             .UsePlatformDetect()
             .UsePlatformDetect()
             .With(new Win32PlatformOptions()
             .With(new Win32PlatformOptions()
             {
             {
-                RenderingMode = new Win32RenderingMode[] { Win32RenderingMode.Vulkan },
+                RenderingMode = new Win32RenderingMode[] { Win32RenderingMode.Vulkan, Win32RenderingMode.Wgl },
                 OverlayPopups = true,
                 OverlayPopups = true,
             })
             })
             .With(new X11PlatformOptions()
             .With(new X11PlatformOptions()
             {
             {
-                RenderingMode = new X11RenderingMode[] { X11RenderingMode.Vulkan },
+                RenderingMode = new X11RenderingMode[] { X11RenderingMode.Vulkan, X11RenderingMode.Glx },
                 OverlayPopups = true,
                 OverlayPopups = true,
             })
             })
             .With(new SkiaOptions()
             .With(new SkiaOptions()

+ 9 - 0
src/PixiEditor.UI.Common/Localization/Translate.cs

@@ -12,6 +12,15 @@ public class Translate : MarkupExtension
 
 
     public Translate()
     public Translate()
     {
     {
+        if (ILocalizationProvider.Current == null)
+        {
+            ILocalizationProvider.OnLocalizationProviderChanged += (provider) =>
+            {
+                ILocalizationProvider.Current.OnLanguageChanged += (lang) => LanguageChanged();
+            };
+            return;
+        }
+
         ILocalizationProvider.Current.OnLanguageChanged += (lang) => LanguageChanged();
         ILocalizationProvider.Current.OnLanguageChanged += (lang) => LanguageChanged();
     }
     }
 
 

+ 2 - 2
src/PixiEditor/Properties/AssemblyInfo.cs

@@ -43,5 +43,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("2.0.1.2")]
-[assembly: AssemblyFileVersion("2.0.1.2")]
+[assembly: AssemblyVersion("2.0.1.3")]
+[assembly: AssemblyFileVersion("2.0.1.3")]

+ 2 - 1
src/PixiEditor/Views/Rendering/Scene.cs

@@ -465,7 +465,7 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
                 }
                 }
             }
             }
 
 
-            if(Cursor.ToString() != finalCursor.ToString())
+            if (Cursor.ToString() != finalCursor.ToString())
                 Cursor = finalCursor;
                 Cursor = finalCursor;
             e.Handled = args.Handled;
             e.Handled = args.Handled;
         }
         }
@@ -766,6 +766,7 @@ internal class Scene : Zoombox.Zoombox, ICustomHitTest
     {
     {
         if (resources != null && !resources.IsDisposed)
         if (resources != null && !resources.IsDisposed)
         {
         {
+            using var ctx = IDrawieInteropContext.Current.EnsureContext();
             if (size.Width == 0 || size.Height == 0)
             if (size.Width == 0 || size.Height == 0)
             {
             {
                 return;
                 return;