Exemplo n.º 1
0
        private void CreateGraphView()
        {
            _graphView = new PatchworkView(this)
            {
                name = "Patchwork Graph"
            };

            _graphView.StretchToParentSize();
            rootVisualElement.Add(_graphView);
        }
Exemplo n.º 2
0
        public void DeserializeConnections(NodeData nodeData, PatchworkView _graphView)
        {
            if (outputPort != null)
            {
                List <NodeBase> nodes = _graphView.nodes.ToList().Cast <NodeBase>().ToList();
                foreach ((string guid, int portID) in nodeData.connections)
                {
                    NodeBase node = nodes.Where(n => n.GUID == guid).FirstOrDefault();
                    if (node != null)
                    {
                        var edge = new Edge()
                        {
                            output = outputPort,
                            input  = node.inputContainer[portID] as Port
                        };

                        edge.input.Connect(edge);
                        edge.output.Connect(edge);
                        _graphView.Add(edge);
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void Init(PatchworkView graphView, EditorWindow window)
 {
     _graphView = graphView;
     _window    = window;
 }