Browse Source

Distribute points and remove close points optimizations

Krzysztof Krysiński 4 months ago
parent
commit
b62d5f5f58

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

@@ -11,6 +11,8 @@ public class DistributePointsNode : ShapeNode<PointsVectorData>
 
     public InputProperty<int> Seed { get; }
 
+    protected override bool ExecuteOnlyOnCacheChange => true;
+
     public DistributePointsNode()
     {
         MaxPointCount = CreateInput("MaxPointCount", "MAX_POINTS", 10).

+ 5 - 2
src/PixiEditor.ChangeableDocument/Changeables/Graph/Nodes/Shapes/RemoveClosePointsNode.cs

@@ -1,4 +1,5 @@
-using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
+using System.Diagnostics;
+using PixiEditor.ChangeableDocument.Changeables.Graph.Nodes.Shapes.Data;
 using PixiEditor.ChangeableDocument.Rendering;
 using Drawie.Backend.Core;
 using Drawie.Numerics;
@@ -14,6 +15,8 @@ public class RemoveClosePointsNode : ShapeNode<PointsVectorData>
 
     public InputProperty<int> Seed { get; }
 
+    protected override bool ExecuteOnlyOnCacheChange => true;
+
     public RemoveClosePointsNode()
     {
         Input = CreateInput<PointsVectorData>("Input", "POINTS", null);
@@ -33,7 +36,7 @@ public class RemoveClosePointsNode : ShapeNode<PointsVectorData>
             return null;
         }
 
-        var availablePoints = data.Points.Distinct().ToList();
+        var availablePoints = data.Points.ToList();
         List<VecD> newPoints = new List<VecD>();
 
         var random = new Random(Seed.Value);