From 4252cc691261df03889871bebb6a5bb6b1235b14 Mon Sep 17 00:00:00 2001 From: Ankitkumar Satapara Date: Mon, 20 Apr 2026 20:59:56 +0530 Subject: [PATCH] Implemented the knot node save load issues --- Examples/Nodify.Calculator/GraphSerializer.cs | 29 ++++++++++++++++++- .../Models/SaveGraphModel.cs | 1 + .../Operations/OperationFactory.cs | 5 ++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Examples/Nodify.Calculator/GraphSerializer.cs b/Examples/Nodify.Calculator/GraphSerializer.cs index ccdf34a..854ccf6 100644 --- a/Examples/Nodify.Calculator/GraphSerializer.cs +++ b/Examples/Nodify.Calculator/GraphSerializer.cs @@ -255,6 +255,9 @@ namespace Nodify.Calculator info.Output.Add(""); info.IsFlowNode = true; break; + case SystemOperations.KNOT: + // Knot nodes manage their own connectors; don't add any here + break; default: info.Output.Add(""); info.IsFlowNode = true; @@ -414,6 +417,28 @@ namespace Nodify.Calculator op.Output.Add(DeserializeConnector(sc, false)); } } + else if (sysVm.SystemOperationType == SystemOperations.KNOT) + { + // Restore knot connector shape/color/datatype from saved data + if (op is KnotOperationViewModel knotOp) + { + knotOp.Input.Clear(); + knotOp.Output.Clear(); + + foreach (var ic in nd.InputConnectors) + { + var conn = DeserializeConnector(ic, true); + conn.IsKnotConnector = true; + knotOp.Input.Add(conn); + } + foreach (var oc in nd.OutputConnectors) + { + var conn = DeserializeConnector(oc, false); + conn.IsKnotConnector = true; + knotOp.Output.Add(conn); + } + } + } } } @@ -426,7 +451,8 @@ namespace Nodify.Calculator ColorArgb = c.RawColor.ToArgb(), DataType = c.DataType ?? string.Empty, IsCopyConnector = c.IsCopyConnector, - IsTakeListConnector = c.IsTakeListConnector + IsTakeListConnector = c.IsTakeListConnector, + IsKnotConnector = c.IsKnotConnector }; } @@ -440,6 +466,7 @@ namespace Nodify.Calculator DataType = cd.DataType, IsCopyConnector = cd.IsCopyConnector, IsTakeListConnector = cd.IsTakeListConnector, + IsKnotConnector = cd.IsKnotConnector, IsInput = isInput }; } diff --git a/Examples/Nodify.Calculator/Models/SaveGraphModel.cs b/Examples/Nodify.Calculator/Models/SaveGraphModel.cs index 294d142..e21c846 100644 --- a/Examples/Nodify.Calculator/Models/SaveGraphModel.cs +++ b/Examples/Nodify.Calculator/Models/SaveGraphModel.cs @@ -53,6 +53,7 @@ namespace Nodify.Calculator.Models public string DataType { get; set; } = string.Empty; public bool IsCopyConnector { get; set; } public bool IsTakeListConnector { get; set; } + public bool IsKnotConnector { get; set; } } public class ConnectionData diff --git a/Examples/Nodify.Calculator/Operations/OperationFactory.cs b/Examples/Nodify.Calculator/Operations/OperationFactory.cs index e135ede..ac9c1ba 100644 --- a/Examples/Nodify.Calculator/Operations/OperationFactory.cs +++ b/Examples/Nodify.Calculator/Operations/OperationFactory.cs @@ -464,6 +464,11 @@ namespace Nodify.Calculator return assertOp; } + if (info.sysOp == SystemOperations.KNOT) + { + return new KnotOperationViewModel(); + } + if (info.sysOp == SystemOperations.DEBUG) { var debugOp = new SystemOperationViewModel