Browse Source

Merge branch 'master' into pixiauth

Krzysztof Krysiński 4 months ago
parent
commit
a477f83bb4

+ 1 - 1
src/Drawie

@@ -1 +1 @@
-Subproject commit 631c8e4cda079ae6872ff90ca2528bf6be09a69d
+Subproject commit e0dc4185b84cfd9f8fa5bb5234e8cbf9e0bb851e

+ 9 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/InputProperty.cs

@@ -39,7 +39,14 @@ public class InputProperty : IInputProperty
 
 
             if (!ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is Delegate connectionField)
             if (!ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is Delegate connectionField)
             {
             {
-                return connectionField.DynamicInvoke(FuncContext.NoContext);
+                try
+                {
+                    return connectionField.DynamicInvoke(FuncContext.NoContext);
+                }
+                catch
+                {
+                    return null;
+                }
             }
             }
 
 
             if (ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is not Delegate)
             if (ValueType.IsAssignableTo(typeof(Delegate)) && connectionValue is not Delegate)
@@ -217,7 +224,7 @@ public class InputProperty : IInputProperty
         HashCode hash = new();
         HashCode hash = new();
         hash.Add(InternalPropertyName);
         hash.Add(InternalPropertyName);
         hash.Add(ValueType);
         hash.Add(ValueType);
-        if(Value is ICacheable cacheable)
+        if (Value is ICacheable cacheable)
         {
         {
             hash.Add(cacheable.GetCacheHash());
             hash.Add(cacheable.GetCacheHash());
         }
         }

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/ModifyImageLeftNode.cs

@@ -27,7 +27,7 @@ public class ModifyImageLeftNode : Node, IPairNode, IPreviewRenderable
     public ModifyImageLeftNode()
     public ModifyImageLeftNode()
     {
     {
         Image = CreateInput<Texture?>("Surface", "IMAGE", null);
         Image = CreateInput<Texture?>("Surface", "IMAGE", null);
-        Coordinate = CreateFuncOutput("Coordinate", "UV", ctx => ctx.OriginalPosition);
+        Coordinate = CreateFuncOutput("Coordinate", "UV", ctx => ctx.OriginalPosition ?? new Float2(""));
         Color = CreateFuncOutput("Color", "COLOR", GetColor);
         Color = CreateFuncOutput("Color", "COLOR", GetColor);
         SampleMode = CreateInput("SampleMode", "COLOR_SAMPLE_MODE", ColorSampleMode.ColorManaged);
         SampleMode = CreateInput("SampleMode", "COLOR_SAMPLE_MODE", ColorSampleMode.ColorManaged);
     }
     }

+ 1 - 1
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/VectorLayerNode.cs

@@ -120,7 +120,7 @@ public class VectorLayerNode : LayerNode, ITransformableObject, IReadOnlyVectorN
         if (!context.ProcessingColorSpace.IsSrgb)
         if (!context.ProcessingColorSpace.IsSrgb)
         {
         {
             int saved = renderOn.Canvas.Save();
             int saved = renderOn.Canvas.Save();
-            Texture tex = Texture.ForProcessing(renderOn, ColorSpace.CreateSrgb());
+            using Texture tex = Texture.ForProcessing(renderOn, ColorSpace.CreateSrgb());
             renderOn.Canvas.SetMatrix(Matrix3X3.Identity);
             renderOn.Canvas.SetMatrix(Matrix3X3.Identity);
             Rasterize(tex.DrawingSurface, paint);
             Rasterize(tex.DrawingSurface, paint);
             renderOn.Canvas.DrawSurface(tex.DrawingSurface, 0, 0);
             renderOn.Canvas.DrawSurface(tex.DrawingSurface, 0, 0);

+ 0 - 3
src/PixiEditor/Models/Files/ImageFileType.cs

@@ -152,9 +152,6 @@ internal abstract class ImageFileType : IoFileType
     {
     {
         try
         try
         {
         {
-            if (!encoder.SupportsTransparency)
-                bitmap.DrawingSurface.Canvas.DrawColor(Colors.White, BlendMode.Multiply);
-
             await using var stream = new FileStream(savePath, FileMode.Create);
             await using var stream = new FileStream(savePath, FileMode.Create);
             await encoder.SaveAsync(stream, bitmap);
             await encoder.SaveAsync(stream, bitmap);
         }
         }

+ 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
 // 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.0.75")]
-[assembly: AssemblyFileVersion("2.0.0.75")]
+[assembly: AssemblyVersion("2.0.0.76")]
+[assembly: AssemblyFileVersion("2.0.0.76")]

+ 2 - 0
src/PixiEditor/ViewModels/Document/DocumentViewModel.cs

@@ -1113,6 +1113,8 @@ internal partial class DocumentViewModel : PixiObservableObject, IDocument
         int firstFrame = 0;
         int firstFrame = 0;
         int lastFrame = AnimationDataViewModel.GetVisibleFramesCount();
         int lastFrame = AnimationDataViewModel.GetVisibleFramesCount();
 
 
+        lastFrame = Math.Max(1, lastFrame);
+
         if (keyFrames.Count > 0)
         if (keyFrames.Count > 0)
         {
         {
             firstFrame = AnimationDataViewModel.GetFirstVisibleFrame();
             firstFrame = AnimationDataViewModel.GetFirstVisibleFrame();

+ 2 - 1
src/PixiEditor/ViewModels/Document/StructureTree.cs

@@ -96,7 +96,8 @@ internal class StructureTree
             if (oldRoot != root)
             if (oldRoot != root)
             {
             {
                 oldRoot.Remove(member);
                 oldRoot.Remove(member);
-                root.Insert(relativeIndex, member);
+                int clampIndex = Math.Clamp(relativeIndex, 0, root.Count);
+                root.Insert(clampIndex, member);
                 _memberMap[member] = root;
                 _memberMap[member] = root;
             }
             }
         }
         }