public Link ConvertLogicalNodeToLitegraphLink(LogicalLink logicalLink)
        {
            if (logicalLink == null)
                return null;
            LiteGraph.Link link = new LiteGraph.Link
            {
                origin_id = engine.GetOutputOwner(logicalLink.OutputId).Id,
                target_id = engine.GetInputOwner(logicalLink.InputId).Id,
                origin_slot = GetOutputSlot(logicalLink.OutputId),
                target_slot = GetInputSlot(logicalLink.InputId),
            };

            return link;
        }
 public bool CreateLink(Link link)
 {
     LogicalNode outNode = SerialController.logicalNodesEngine.GetNode(link.origin_id);
     LogicalNode inNode = SerialController.logicalNodesEngine.GetNode(link.target_id);
     engine.AddLink(outNode.Outputs[link.origin_slot], inNode.Inputs[link.target_slot]);
     return true;
 }
        public bool DeleteLink(Link link)
        {
            if (link.origin_id == null || link.target_id == null)
                return false;

            LogicalNode outNode = SerialController.logicalNodesEngine.GetNode(link.origin_id);
            LogicalNode inNode = SerialController.logicalNodesEngine.GetNode(link.target_id);
            engine.DeleteLink(outNode.Outputs[link.origin_slot], inNode.Inputs[link.target_slot]);
            return true;
        }