public void SaveGraph(bool shouldRefreshAssets = true) { ValidateSaveButton(); var newGraphObject = SaveUtility.GetInstance(GraphView).Save(GraphObject.CodeGraphData.AssetPath, shouldRefreshAssets); GraphObject = newGraphObject; }
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); }
public void LoadGraph() { SaveUtility.GetInstance(GraphView).LoadGraph(GraphObject); }