Esempio n. 1
0
        public void SaveGraph(bool shouldRefreshAssets = true)
        {
            ValidateSaveButton();
            var newGraphObject = SaveUtility.GetInstance(GraphView).Save(GraphObject.CodeGraphData.AssetPath, shouldRefreshAssets);

            GraphObject = newGraphObject;
        }
Esempio n. 2
0
        private void ConstructGraphView()
        {
            Instance  = this;
            GraphView = new CodeGraphView(this)
            {
                name = "Code Graph"
            };
            GraphView.StretchToParentSize();
            rootVisualElement.Add(GraphView);
            if (GraphObject != null)
            {
                SaveUtility.GetInstance(GraphView).LoadGraph(GraphObject);
            }

            GraphView.RegisterCallback <KeyDownEvent>(evt => {
                if (evt.keyCode == KeyCode.S && evt.ctrlKey)
                {
                    SaveGraph();
                    evt.StopPropagation();
                }
                if (evt.keyCode == KeyCode.G && evt.ctrlKey && !evt.shiftKey && GraphView.selection.Count > 0)
                {
                    GraphView.GroupSelection();
                    evt.StopPropagation();
                }
                if (evt.keyCode == KeyCode.G && evt.ctrlKey && evt.shiftKey && GraphView.selection.Count > 0)
                {
                    GraphView.UngroupSelection();
                    evt.StopPropagation();
                }
            }, TrickleDown.TrickleDown);
        }
Esempio n. 3
0
 public void LoadGraph()
 {
     SaveUtility.GetInstance(GraphView).LoadGraph(GraphObject);
 }