public void Initialize(EventActionData data, INodeBlock owner) { this.data = data; this.owner = owner; base.expanded = true; if (data.eventType == EventActionData.EventType.Or) { title = "OR"; EnableInClassList("or-block", true); m_CollapseButton.RemoveFromHierarchy(); } else { if (UIElementGraph.richText) { this.Q("title-label").RemoveFromHierarchy(); richTitle = new RichLabel { name = "title-label" }; titleContainer.Insert(0, richTitle); } if (richTitle != null) { title = ""; richTitle.text = data.displayName; } } Repaint(); try { InitializeView(); } catch (System.Exception ex) { uNodeDebug.LogException(ex, owner.nodeView.targetNode); Debug.LogException(ex, owner.nodeView.targetNode); } RefreshPorts(); expanded = data.expanded; }
public static List <UNodeView> FindConnectedInputValueNodes(UNodeView source, HashSet <UNodeView> oldNodes = null) { List <UNodeView> nodes = new List <UNodeView>(); if (oldNodes == null) { oldNodes = new HashSet <UNodeView>(); } if (oldNodes.Contains(source)) { return(nodes); } oldNodes.Add(source); var inputs = source.inputPorts. Where((p) => p.connected && p.orientation == Orientation.Horizontal && !p.IsProxy()). SelectMany(p => p.GetConnectedNodes()).ToList(); if (source is INodeBlock) { INodeBlock block = source as INodeBlock; var inputBlock = block.blockViews.SelectMany(b => b.portViews).Where((p) => p.connected && p.orientation == Orientation.Horizontal && !p.IsProxy()). SelectMany(p => p.GetConnectedNodes()).Distinct(); inputs.AddRange(inputBlock); } inputs.RemoveAll((n) => oldNodes.Contains(n)); nodes.AddRange(inputs); foreach (var n in inputs) { var nestedNodes = FindConnectedInputValueNodes(n, oldNodes); nestedNodes.RemoveAll(c => nodes.Contains(c)); nodes.AddRange(nestedNodes); } return(nodes); }