Browse Source

Merge branch 'master' into fixes/linux-FromReleaseFile-NullReferenceException

Krzysztof Krysiński 4 months ago
parent
commit
9422db0e51

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit 67e28c2a97d6002457875a3e81eb5c51ca8f4201
+Subproject commit 631c8e4cda079ae6872ff90ca2528bf6be09a69d

+ 3 - 3
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/CombineSeparate/SeparateColorNode.cs

@@ -56,13 +56,13 @@ public class SeparateColorNode : Node
         };
 
     private Half4 GetRgba(FuncContext ctx) => 
-        contextVariables.GetOrAttachNew(ctx, Color, () => ctx.GetValue(Color));
+        ctx.HasContext ? contextVariables.GetOrAttachNew(ctx, Color, () => ctx.GetValue(Color)) : ctx.GetValue(Color);
 
     private Half4 GetHsva(FuncContext ctx) =>
-        contextVariables.GetOrAttachNew(ctx, Color, () => ctx.RgbaToHsva(ctx.GetValue(Color)));
+        ctx.HasContext ? contextVariables.GetOrAttachNew(ctx, Color, () => ctx.RgbaToHsva(ctx.GetValue(Color))) : ctx.RgbaToHsva(ctx.GetValue(Color));
 
     private Half4 GetHsla(FuncContext ctx) =>
-        contextVariables.GetOrAttachNew(ctx, Color, () => ctx.RgbaToHsla(ctx.GetValue(Color)));
+        ctx.HasContext ? contextVariables.GetOrAttachNew(ctx, Color, () => ctx.RgbaToHsla(ctx.GetValue(Color))) : ctx.RgbaToHsla(ctx.GetValue(Color));
 
     public override Node CreateCopy() => new SeparateColorNode();
 }

+ 18 - 5
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/SampleImageNode.cs

@@ -30,21 +30,34 @@ public class SampleImageNode : Node
 
     private Half4 GetColor(FuncContext context)
     {
-        context.ThrowOnMissingContext();
-
         if (Image.Value is null)
         {
             return new Half4("");
         }
 
-        Expression uv = context.GetValue(Coordinate);
+        if (context.HasContext)
+        {
+            Expression uv = context.GetValue(Coordinate);
+
+            return context.SampleSurface(Image.Value.DrawingSurface, uv, SampleMode.Value);
+        }
+
+        Color color;
+        VecI pixelCoordinate = (VecI)context.GetValue(Coordinate).ConstantValue.Round();
+        if (SampleMode.Value == ColorSampleMode.ColorManaged)
+        {
+            color = Image.Value.GetSRGBPixel(pixelCoordinate);
+        }
+        else
+        {
+            color = Image.Value.GetPixel(pixelCoordinate);
+        }
 
-        return context.SampleSurface(Image.Value.DrawingSurface, uv, SampleMode.Value);
+        return new Half4("") { ConstantValue = color };
     }
 
     protected override void OnExecute(RenderContext context)
     {
-
     }
 
     public override Node CreateCopy() => new SampleImageNode();

+ 1 - 1
src/PixiEditor/Initialization/ClassicDesktopEntry.cs

@@ -61,7 +61,7 @@ internal class ClassicDesktopEntry
 
         InitOperatingSystem();
 
-        if (ParseArgument("--crash (\"?)([A-z0-9:\\/\\ -_.]+)\\1", arguments, out Group[] groups))
+        if (ParseArgument(@"--crash (""?)([\w:\/\ -_.]+)\1", arguments, out Group[] groups))
         {
             try
             {

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

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

+ 11 - 6
src/PixiEditor/ViewModels/SubViewModels/FileViewModel.cs

@@ -405,12 +405,12 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
 
         var i = 0;
 
-        Exception firstException = null;
-        Exception secondException = null;
-        Exception thirdException = null;
-
         foreach (var document in documents)
         {
+            Exception firstException = null;
+            Exception secondException = null;
+            Exception thirdException = null;
+
             try
             {
                 OpenRecoveredDotPixi(document.OriginalPath, document.AutosavePath,
@@ -441,8 +441,13 @@ internal class FileViewModel : SubViewModel<ViewModelMain>
                 }
             }
 
-            var exceptions = new[] { firstException, secondException, thirdException };
-            CrashHelper.SendExceptionInfo(new AggregateException(exceptions.Where(x => x != null).ToArray()));
+            var exceptions = new[] { firstException, secondException, thirdException }
+                .Where(x => x != null).ToArray();
+
+            if (exceptions.Length > 0)
+            {
+                CrashHelper.SendExceptionInfo(new AggregateException(exceptions));
+            }
         }
 
         showMissingFilesDialog = documents.Count != i;