예제 #1
0
        public void ChangeTypeWithRestrictions(WirePortDataType newType, int restrictions)
        {
            if (m_dataType != newType)
            {
                DataType = newType;
                for (int i = 0; i < m_externalReferences.Count; i++)
                {
                    ParentNode inNode    = UIUtils.GetNode(m_externalReferences[i].NodeId);
                    InputPort  inputPort = inNode.GetInputPortByUniqueId(m_externalReferences[i].PortId);

                    bool valid = false;
                    if (restrictions == 0)
                    {
                        valid = true;
                    }
                    else
                    {
                        valid = (restrictions & ( int )inputPort.DataType) != 0;
                    }

                    if (valid)
                    {
                        inNode.CheckSpherePreview();
                        inputPort.UpdateInfoOnExternalConn(m_nodeId, m_portId, m_dataType);
                        inNode.OnConnectedOutputNodeChanges(m_externalReferences[i].PortId, m_nodeId, m_portId, m_name, m_dataType);
                    }
                    else
                    {
                        InvalidateConnection(m_externalReferences[i].NodeId, m_externalReferences[i].PortId);
                        inputPort.InvalidateConnection(NodeId, PortId);
                        i--;
                    }
                }
            }
        }