Siccity / xNode

Unity Node Editor: Lets you view and edit node graphs inside Unity
MIT License
3.3k stars 582 forks source link

There seems to be a problem with the source code #366

Open onepeopleheart opened 1 year ago

onepeopleheart commented 1 year ago

First of all, I am a netizen from abroad. Your tool is very convenient. Thank you very much. I found that in NodePort.cs, the code for AddConnections and MoveConnections was compared, and I felt a bit similar. According to the comments, my understanding of the method of MoveConnections is to transfer all of its own connections to the targetPort and clear all of its own. By the way, I'm using version 1.7. It seems consistent within the for loop?

`

    /// <summary> Copy all connections pointing to a node and add them to this one </summary>
    public void AddConnections(NodePort targetPort) {
        int connectionCount = targetPort.ConnectionCount;
        for (int i = 0; i < connectionCount; i++) {
            PortConnection connection = targetPort.connections[i];
            NodePort otherPort = connection.Port;
            Connect(otherPort);
        }
    }

    /// <summary> Move all connections pointing to this node, to another node </summary>
    public void MoveConnections(NodePort targetPort) {
        int connectionCount = connections.Count;

        // Add connections to target port
        for (int i = 0; i < connectionCount; i++) {
            PortConnection connection = targetPort.connections[i];
            NodePort otherPort = connection.Port;
            Connect(otherPort);
        }
        ClearConnections();
    }

`