Ejemplo n.º 1
0
        // ######################## DATA ######################## //
        /// <summary>
        /// Saves a created Connection
        /// </summary>
        /// <param name="connection"></param>
        private void SaveConnection(Connection <T, TData> connection)
        {
            // if the inPoint of the Connection belongs to this node, save the Node of the Outpoint at the appropriate place
            if (connection.InPoint.PointNode == this)
            {
                ConnectionPointData Inputs = Data.Inputs[connection.InPoint.Index];
                if (Inputs.Connections == null)
                {
                    Inputs.Connections = new List <NodeConnectionData>();
                }

                if (!Inputs.Contains(connection.OutPoint.PointNode.ID, connection.OutPoint.Index))
                {
                    Inputs.Add(connection.OutPoint.PointNode.ID, connection.OutPoint.Index);
                }
            }

            // if the outPoint of the Connection belongs to this node, save the Node of the inPoint at the appropriate place
            if (connection.OutPoint.PointNode == this)
            {
                ConnectionPointData Outputs = Data.Outputs[connection.OutPoint.Index];
                if (Outputs.Connections == null)
                {
                    Outputs.Connections = new List <NodeConnectionData>();
                }

                if (!Outputs.Contains(connection.InPoint.PointNode.ID, connection.InPoint.Index))
                {
                    Outputs.Add(connection.InPoint.PointNode.ID, connection.InPoint.Index);
                }
            }

            Editor.SetDataDirty();
        }