public void AddNewOutport(PortView outport) { OutportContainer outportContainer = new OutportContainer(outport); OutportContainers.Add(outportContainer); AllOutportsContainer.Add(outportContainer); }
public InportContainer(PortView portView) { var uxmlAsset = Resources.Load <VisualTreeAsset>(ResourceAssetPaths.ImportContainer_UXML); uxmlAsset.CloneTree(this); InportHeader = this.Q <VisualElement>(INPORT_HEADER); InportFooter = this.Q <VisualElement>(INPORT_FOOTER); InportBody = this.Q <VisualElement>(INPORT_BODY); InportArea = this.Q <VisualElement>(INPORT_AREA); PortView = portView; InportArea.Add(portView); }
public void CreateOutports() { m_outports.Clear(); for (int j = 0; j < SerializedNode.FindPropertyRelative(ANode.OutportsVarName).arraySize; j++) { PortView newPort = new PortView(this, Orientation.Horizontal, Direction.Output, Port.Capacity.Single, typeof(bool), j, m_nodeViewDrawer.NodeColor, m_edgeConnectorListener); newPort.portName = ""; m_outports.Add(newPort); } }
public override List <Port> GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter) { PortView portOne = startPort as PortView; List <Port> compatiblePorts = new List <Port>(); compatiblePorts.AddRange(ports.ToList().Where(port => { PortView portTwo = port as PortView; if (portOne.direction == portTwo.direction) { return(false); } if (portOne.Node == portTwo.Node) { return(false); } return(true); })); return(compatiblePorts); }
public void SetInport(PortView inport) { InportContainer = new InportContainer(inport); NodeView.inputContainer.Add(InportContainer); NodeView.inputContainer.style.flexGrow = 0; }
public void Setup() { FirstPort = output as PortView; SecondPort = input as PortView; }
public NodeView(ANode node, SerializedProperty serializedNode, NodeGraphView nodeGraphView, IEdgeConnectorListener edgeConnectorListener, NodeViewDrawer nodeViewDrawer) : base() { if (serializedNode == null) { return; } Node = node; NodeType = Node.GetType(); SerializedNode = serializedNode; m_nodeGraphView = nodeGraphView; m_edgeConnectorListener = edgeConnectorListener; NodeId = SerializedNode.FindPropertyRelative(ANode.IdVarname).stringValue; m_nodeViewDrawer = nodeViewDrawer; m_nodeDisplayContainers = new NodeDisplayContainers(this, m_nodeViewDrawer); m_nodeViewDrawer.SetNodeView(this, SerializedNode, nodeGraphView.NodeGraph, m_nodeDisplayContainers); m_nodeViewDrawer.OnSetup(); title = m_nodeViewDrawer.DisplayName; bool isEntryNode = (typeof(BuiltInNodes.EntryNode)).IsAssignableFrom(NodeType); if (isEntryNode) { this.capabilities = this.capabilities & (~Capabilities.Deletable); } if (!isEntryNode) { //Add ports m_inport = new PortView(this, Orientation.Horizontal, Direction.Input, Port.Capacity.Single, typeof(bool), 0, m_nodeViewDrawer.NodeColor, m_edgeConnectorListener); m_inport.portName = ""; m_nodeDisplayContainers.SetInport(m_inport); } CreateOutports(); // Draw node m_nodeViewDrawer.Repaint(m_outports); RefreshExpandedState(); RefreshPorts(); Vector2 pos = SerializedNode.FindPropertyRelative(ANode.PositionVarName).vector2Value; SetPosition(new Rect(pos, Vector2.zero)); //this.RegisterCallback<GeometryChangedEvent>((GeometryChangedEvent gce) => { Debug.Log(gce.newRect.position); }); }