Esempio n. 1
0
 public virtual void DrawCanvas(uNodeEditor window, GraphData graphData)
 {
     this.graphData = graphData;
     this.window    = window;
     openedGraph    = this;
     topMousePos    = Event.current.mousePosition;
 }
Esempio n. 2
0
 public override void DrawCanvas(uNodeEditor window, GraphData graphData)
 {
     base.DrawCanvas(window, graphData);
     window.RemoveNotification();
     if (rootView == null)
     {
         OnEnable();
     }
     rootView.SetLayout(graphData.backgroundRect);
     if (!hasInitialize)
     {
         ReloadView();
         hasInitialize = true;
     }
     if (Event.current.type == EventType.Repaint && uNodeThreadUtility.frame % 2 == 0)
     {
         zoomScale = graphView.scale;
         if (position != Vector3.zero)
         {
             editorData.position = position;
         }
     }
     if (graphData.canvasRect.Contains(topMousePos))
     {
         graphView.IMGUIEvent(Event.current);
     }
     _debugData = GetDebugData();
 }
Esempio n. 3
0
        protected override IList <TreeViewItem> BuildRows(TreeViewItem root)
        {
            graphEditor = uNodeEditor.window;
            var rows = GetRows() ?? new List <TreeViewItem>();

            rows.Clear();
            nodeTreesMap.Clear();
            flowPortsMap.Clear();
            if (graphEditor == null)
            {
                return(rows);
            }
            if (editorData.graph != null)
            {
                var graph = editorData.graph;
                this.graph = graph;
                CreateGraphTree(graph, root, rows);
                //int prevCount = rows.Count;
                //var item = new HierarchyGraphTree(graph, -1);
                //if(expandStates != null && !expandStates.Contains(item.id)) {
                //	SetExpanded(item.id, true);
                //}
                //if(IsExpanded(item.id)) {
                //	AddChildren(item, rows);
                //} else {
                //	item.children = CreateChildListForCollapsedParent();
                //}
                //root.AddChild(item);
                //rows.Insert(rows.Count - (rows.Count - prevCount), item);
            }
            SetupDepthsFromParentsAndChildren(root);
            return(rows);
        }
Esempio n. 4
0
 public GraphHierarchyTree(TreeViewState state) : base(state)
 {
     graphEditor = uNodeEditor.window;
     showAlternatingRowBackgrounds = true;
     showBorder = true;
     Reload(true);
 }
Esempio n. 5
0
        void PrepareGenerate()
        {
            uNodeEditor editor = uNodeEditor.window;

            if (editor != null)
            {
                DoGenerate(editor.editorData.owner);
            }
            Repaint();
        }
Esempio n. 6
0
        public void OnGUI()
        {
            uNodeEditor editor = uNodeEditor.window;

            if (editor == null)
            {
                EditorGUILayout.HelpBox("uNode Editor is not opened", MessageType.Warning);
                return;
            }
            else if (editor.editorData.graph == null)
            {
                EditorGUILayout.HelpBox("No opened graph on uNode Editor", MessageType.Warning);
                return;
            }
            {
                Rect areaRect = new Rect(0, 0, position.width, position.height);
                //if(position.width >= 500) {
                //	areaRect = new Rect(0, 0, position.width - 300, position.height);
                //}
                GUILayout.BeginArea(areaRect);
                DoTreeView(areaRect);
                GUILayout.EndArea();
            }
            //if(position.width >= 500) {
            //	Rect areaRect = new Rect(position.width - 300, 0, 300, position.height);
            //	GUI.Box(new Rect(areaRect.x, areaRect.y, areaRect.width + 20, areaRect.height), "", "Box");
            //	GUILayout.BeginArea(areaRect);
            //	if(data.selected != null) {
            //		CustomInspector.ShowInspector(data);
            //	}
            //	GUILayout.EndArea();
            //}
            //if(GUI.changed) {
            //	if(uNodeEditor.window != null) {
            //		uNodeEditor.GUIChanged();
            //	}
            //}
        }