public static void PopulateNodeEntry(EditorNodeEntry entry, Node node, Dictionary <ConnectionPoint, int> connectionPointMap)
    {
        entry.rect        = new RectEntry(node.rect.x, node.rect.y, node.rect.width, node.rect.height);
        entry.wPad        = node.widthPad;
        entry.hPad        = node.heightPad;
        entry.SVOffset    = node.scrollViewOffset;
        entry.nodeType    = node.nodeType;
        entry.bottomLevel = node.bottomLevel;

        if (entry.nodeType == NodeType.SetLocalFlag || entry.nodeType == NodeType.CheckLocalFlag)
        {
            // populate the selected item of the local flag entry
            if (node.localFlagDropdown.selectedItem != null)
            {
                entry.selectedFlag = node.localFlagDropdown.selectedItem.text;
            }
        }
        else if (entry.nodeType == NodeType.SetGlobalFlag || entry.nodeType == NodeType.CheckGlobalFlag)
        {
            // populate the selected item of the global flag entry
            entry.selectedFlag = node.globalItemDropdown.selectedItem;
        }
        else if (entry.nodeType == NodeType.SetGlobalVariable || entry.nodeType == NodeType.CheckGlobalVariable)
        {
            // populate the selected item and the global variable value of the global variable entry
            entry.selectedFlag        = node.globalItemDropdown.selectedItem;
            entry.globalVariableValue = node.globalVariableField.text;
        }

        // assign inPoint links
        List <int> linkedCPEIDs = new List <int>();

        foreach (Connection connection in node.inPoint.connections)
        {
            linkedCPEIDs.Add(connectionPointMap[connection.outPoint]);
        }
        entry.inPoint.linkedCPEIDs = linkedCPEIDs;
    }
    // goes through everything and assigns CPEIDs to every ConnectionPointEntry and populates container data
    public static List <EditorNodeEntry> PrepassNodeEntries(List <Node> nodes, Dictionary <EditorNodeEntry, Node> nodeMap, Dictionary <ConnectionPoint, int> connectionPointMap)
    {
        List <EditorNodeEntry> entries = new List <EditorNodeEntry>();
        EditorNodeEntry        tempNode;

        for (int i = 0; i < nodes.Count; i++)
        {
            tempNode          = new EditorNodeEntry();
            nodeMap[tempNode] = nodes[i];

            tempNode.inPoint       = new InPointEntry();
            tempNode.inPoint.CPEID = GenerateCPEID();
            connectionPointMap[nodes[i].inPoint] = tempNode.inPoint.CPEID;

            // assign CPEID to outpoints and splitter points based on NodeType
            NodeType type = nodes[i].nodeType;
            if ((type == NodeType.Interrupt ||
                 type == NodeType.SetGlobalFlag ||
                 type == NodeType.SetLocalFlag ||
                 type == NodeType.SetGlobalVariable) &&
                nodes[i].outPoint != null)
            {
                tempNode.outPoint       = new ConnectionPointEntry();
                tempNode.outPoint.CPEID = GenerateCPEID();
                connectionPointMap[nodes[i].outPoint] = tempNode.outPoint.CPEID;
            }

            if ((type == NodeType.CheckGlobalFlag ||
                 type == NodeType.CheckLocalFlag ||
                 type == NodeType.CheckGlobalVariable) &&
                nodes[i].splitter != null)
            {
                tempNode.outPos       = new ConnectionPointEntry();
                tempNode.outNeg       = new ConnectionPointEntry();
                tempNode.outPos.CPEID = GenerateCPEID();
                tempNode.outNeg.CPEID = GenerateCPEID();
                connectionPointMap[nodes[i].splitter.positiveOutpoint] = tempNode.outPos.CPEID;
                connectionPointMap[nodes[i].splitter.negativeOutpoint] = tempNode.outNeg.CPEID;
            }

            // check if it has child elements based on NodeType
            if ((type == NodeType.Interrupt ||
                 type == NodeType.Dialog ||
                 type == NodeType.Decision) &&
                nodes[i].childContainer != null)
            {
                // traverse through the child components and populate the CPEIDs
                SDEContainer      container     = nodes[i].childContainer;
                SDEContainerEntry tempContainer = new SDEContainerEntry();
                tempNode.childContainer = tempContainer;
                while (container != null)
                {
                    tempContainer.outPoint                 = new ConnectionPointEntry();
                    tempContainer.outPoint.CPEID           = GenerateCPEID();
                    connectionPointMap[container.outPoint] = tempContainer.outPoint.CPEID;

                    // get container data
                    switch (container.containerType)
                    {
                    case SDEContainerType.DecisionBox:
                        tempContainer.text = ((DecisionBox)container).textArea.text;
                        break;

                    case SDEContainerType.DialogBox:
                        tempContainer.text = ((DialogBox)container).textArea.text;
                        break;

                    case SDEContainerType.DialogInterrupt:
                        tempContainer.text = ((DialogInterrupt)container).label.text;
                        break;

                    default:
                        throw new UnityException("Malformed SDEContainerType on Save!");
                    }

                    container = container.child;

                    if (container != null)
                    {
                        tempContainer.child = new SDEContainerEntry();
                        tempContainer       = tempContainer.child;
                    }
                }
            }

            entries.Add(tempNode);
        }

        // reset the CPEID counter after assignments are done
        CPEIDCounter = 0;
        return(entries);
    }