public void Rebuild() { Clear(); if (_Editor.Tree != null) { foreach (var node in _Editor.Tree) { AnimNodeItem item = CreateItem(node); _Panel.Controls.Add(item); } if (_Editor.Tree.Connections != null) { foreach (ConnectionData connection in _Editor.Tree.Connections) { AnimNodeItem startNode = Find(connection.Start); AnimNodeItem endNode = Find(connection.End); if (startNode != null && endNode != null) { Skill.Editor.UI.IConnector startConnector = startNode.OutConnector; Skill.Editor.UI.IConnector endConnector = endNode.GetInputConnector(connection.EndConnectorIndex); if (startConnector != null && endConnector != null) { Skill.Editor.UI.Connection c = new UI.Connection(startConnector, endConnector); this.Controls.Add(c); } } } } _Panel.ZoomFactor = _Editor.Tree.Zoom; _Panel.PanPosition = new Vector2(_Editor.Tree.PanX, _Editor.Tree.PanY); } }
public int GetConnectorIndex(Skill.Editor.UI.IConnector connector) { int index = -1; foreach (var item in _PnlItems.Controls) { if (item is InputConnectorItem) { index++; if (((InputConnectorItem)item).Connector == connector) { return(index); } } } return(-1); }