Example #1
0
        void AddNode(INode node)
        {
            var nodeView = new NodeView {
                userData = node
            };

            m_GraphView.AddElement(nodeView);
            nodeView.Initialize(node as AbstractNode, m_EdgeConnectorListener);
            node.RegisterCallback(OnNodeChanged);
            nodeView.Dirty(ChangeType.Repaint);

            if (m_SearchWindowProvider.nodeNeedsRepositioning && m_SearchWindowProvider.targetSlotReference.nodeGuid.Equals(node.guid))
            {
                m_SearchWindowProvider.nodeNeedsRepositioning = false;
                foreach (var element in nodeView.inputContainer.Union(nodeView.outputContainer))
                {
                    var port = element as NodePort;
                    if (port == null)
                    {
                        continue;
                    }
                    if (port.slot.slotReference.Equals(m_SearchWindowProvider.targetSlotReference))
                    {
                        port.RegisterCallback <GeometryChangedEvent>(RepositionNode);
                        return;
                    }
                }
            }
        }