Browse Source

Fixed loop connections

flabbet 8 months ago
parent
commit
5779194a7d

+ 13 - 1
src/PixiEditor.ChangeableDocument/Changes/NodeGraph/ConnectProperties_Change.cs

@@ -70,8 +70,20 @@ internal class ConnectProperties_Change : Change
         {
             return true;
         }
+        
+        bool isLoop = false;
+        input.Node.TraverseForwards(x =>
+        {
+            if (x == output.Node)
+            {
+                isLoop = true;
+                return false;
+            }
 
-        return false;
+            return true;
+        });
+
+        return isLoop;
     }
 
     public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, bool firstApply,