public void LoadGraph(NoduxLinkGraph component) { NoduxGraphOperation.ClearGraph(_graphView); _graphView.SetSerializeTarget(component); var graphNodeMap = new Dictionary <string, NoduxGraphNodeView>(); // create nodes for (var i = 0; i < component.GraphContainer.Nodes.Count; i++) { var graphNode = NoduxGraphNodeViewCreator.Load(_graphView.SerializedGraph, component.GraphContainer.Nodes[i], i); _graphView.AddElement(graphNode); graphNodeMap[graphNode.Guid] = graphNode; } // connect nodes foreach (var link in component.GraphContainer.Links) { if (link.TargetNodeGuid == null || link.SourceNodeGuid == null) { continue; } if (!graphNodeMap.ContainsKey(link.TargetNodeGuid) || !graphNodeMap.ContainsKey(link.SourceNodeGuid)) { Debug.LogWarning($"Link nodes failed {link.SourceNodeGuid} -> {link.TargetNodeGuid}"); continue; } var source = graphNodeMap[link.SourceNodeGuid]; var target = graphNodeMap[link.TargetNodeGuid]; NoduxGraphOperation.LinkNode(_graphView, source, target); } }
public void SetSerializeTarget(NoduxLinkGraph graph) { this._serializedGraph = new SerializedNoduxLinkGraph(graph); var title = SelectionUtil.GetSceneGameObjectPath(graph); _windowDelegate.SetGraphName(title); }
public void SaveGraph(NoduxLinkGraph component) { // node, link, LinkedNodeの更新 _graphView.SerializedGraph.RemoveUnExistNodes(_nodes); _graphView.SerializedGraph.UpdateNodeMeta(_nodes); _graphView.SerializedGraph.UpdateLinks(_edges); var nodesArray = NoduxGraphOperation.ExtractGraphNodeChains(_graphView.SerializedGraph.Container); _graphView.SerializedGraph.UpdateLinkedNodes(nodesArray); }
public SerializedNoduxLinkGraph(NoduxLinkGraph graph) { this._graph = new SerializedObject(graph); this._graph.Update(); this.GraphSceneName = graph.gameObject.scene.name; }