|  |  |  | @ -4,6 +4,7 @@ using System.Linq; | 
			
		
	
		
			
				
					|  |  |  |  | using System.Reflection; | 
			
		
	
		
			
				
					|  |  |  |  | using System.Threading.Tasks; | 
			
		
	
		
			
				
					|  |  |  |  | using TNode.TNodeCore.Editor.Blackboard; | 
			
		
	
		
			
				
					|  |  |  |  | using TNode.TNodeCore.Editor.CommentView; | 
			
		
	
		
			
				
					|  |  |  |  | using TNode.TNodeCore.Editor.EditorPersistence; | 
			
		
	
		
			
				
					|  |  |  |  | using TNode.TNodeCore.Editor.Models; | 
			
		
	
		
			
				
					|  |  |  |  | using TNode.TNodeGraphViewImpl.Editor.Cache; | 
			
		
	
	
		
			
				
					|  |  |  | @ -23,6 +24,7 @@ using TNodeCore.Runtime.RuntimeCache; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | using UnityEditor; | 
			
		
	
		
			
				
					|  |  |  |  | using UnityEditor.Experimental.GraphView; | 
			
		
	
		
			
				
					|  |  |  |  | using UnityEditor.UIElements; | 
			
		
	
		
			
				
					|  |  |  |  | using UnityEngine; | 
			
		
	
		
			
				
					|  |  |  |  | using UnityEngine.UIElements; | 
			
		
	
		
			
				
					|  |  |  |  | using BlackboardField = TNode.TNodeGraphViewImpl.Editor.GraphBlackboard.BlackboardField; | 
			
		
	
	
		
			
				
					|  |  |  | @ -43,6 +45,8 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |         private IBlackboardView _blackboard; | 
			
		
	
		
			
				
					|  |  |  |  |         private bool _loaded; | 
			
		
	
		
			
				
					|  |  |  |  |         private GraphViewModel _graphViewModel; | 
			
		
	
		
			
				
					|  |  |  |  |         private List<Comment> _comments; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         public T Data{ | 
			
		
	
		
			
				
					|  |  |  |  |             get{ return _data; } | 
			
		
	
		
			
				
					|  |  |  |  |             set{ | 
			
		
	
	
		
			
				
					|  |  |  | @ -211,9 +215,35 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |                     AddPlacemat(placematData); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (this.selection.Any()){ | 
			
		
	
		
			
				
					|  |  |  |  |                     evt.menu.AppendAction("Comment", dma => { | 
			
		
	
		
			
				
					|  |  |  |  |                         BuildCommentForSelected(); | 
			
		
	
		
			
				
					|  |  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |  |                     evt.menu.AppendAction("Delete", dma => { | 
			
		
	
		
			
				
					|  |  |  |  |                         DeleteSelected(); | 
			
		
	
		
			
				
					|  |  |  |  |                     }); | 
			
		
	
		
			
				
					|  |  |  |  |                      | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private void BuildCommentForSelected(){ | 
			
		
	
		
			
				
					|  |  |  |  |             var selection  = this.selection.OfType<IBaseNodeView>().ToList(); | 
			
		
	
		
			
				
					|  |  |  |  |             foreach (var baseNodeView in selection){ | 
			
		
	
		
			
				
					|  |  |  |  |                 var comment = new CommentView(); | 
			
		
	
		
			
				
					|  |  |  |  |                 comment.Bind(new Comment(){ | 
			
		
	
		
			
				
					|  |  |  |  |                      | 
			
		
	
		
			
				
					|  |  |  |  |                 }); | 
			
		
	
		
			
				
					|  |  |  |  |                 ((GraphElement)baseNodeView).Add(comment); | 
			
		
	
		
			
				
					|  |  |  |  |                 comment.Data.CommentedModel = baseNodeView.GetNodeData(); | 
			
		
	
		
			
				
					|  |  |  |  |                 this._data.EditorModels.Add(comment.Data); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private void DeleteSelected(){ | 
			
		
	
		
			
				
					|  |  |  |  |             throw new NotImplementedException(); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private void AddPlacemat(PlacematModel model){ | 
			
		
	
		
			
				
					|  |  |  |  |             _data.EditorModels.Add(model); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -294,7 +324,9 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |                 text = "Run Once" | 
			
		
	
		
			
				
					|  |  |  |  |             }; | 
			
		
	
		
			
				
					|  |  |  |  |             runButton.RegisterCallback<ClickEvent>(evt => { | 
			
		
	
		
			
				
					|  |  |  |  |                 Debug.Log(IsRuntimeGraph); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (IsRuntimeGraph){ | 
			
		
	
		
			
				
					|  |  |  |  |                  | 
			
		
	
		
			
				
					|  |  |  |  |                     _runtimeGraph.TraverseAll(); | 
			
		
	
		
			
				
					|  |  |  |  |                     AfterGraphResolved?.Invoke(); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
	
		
			
				
					|  |  |  | @ -379,10 +411,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |             ClearAll(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             LoadPersistentGraphViewData(); | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |             if (_nodeDict == null) throw new ArgumentNullException(nameof(_nodeDict)); | 
			
		
	
		
			
				
					|  |  |  |  |              | 
			
		
	
		
			
				
					|  |  |  |  |             foreach (var dataNode in _data.NodeDictionary.Values){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if(dataNode==null) | 
			
		
	
		
			
				
					|  |  |  |  |                     continue; | 
			
		
	
	
		
			
				
					|  |  |  | @ -424,6 +453,16 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |                 res.PlacematModel = placemat; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             var comments = _data.EditorModels.OfType<Comment>(); | 
			
		
	
		
			
				
					|  |  |  |  |             foreach (var comment in comments){ | 
			
		
	
		
			
				
					|  |  |  |  |                 var res = new CommentView(); | 
			
		
	
		
			
				
					|  |  |  |  |                 res.Bind(comment); | 
			
		
	
		
			
				
					|  |  |  |  |                 var node = _nodeDict[comment.CommentedModel.id]; | 
			
		
	
		
			
				
					|  |  |  |  |                 if (node != null){ | 
			
		
	
		
			
				
					|  |  |  |  |                     node.Add(res); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             _nodeDict.Clear(); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -548,12 +587,21 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private void SaveEditorModels(){ | 
			
		
	
		
			
				
					|  |  |  |  |             var placemats = placematContainer.Placemats.ToList(); | 
			
		
	
		
			
				
					|  |  |  |  |             var comments = this.Query<CommentView>().ToList(); | 
			
		
	
		
			
				
					|  |  |  |  |             Debug.Log(placemats.Count); | 
			
		
	
		
			
				
					|  |  |  |  |             foreach (var placemat in placemats){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if (placemat is PlacematView placematView){ | 
			
		
	
		
			
				
					|  |  |  |  |                     _data.EditorModels.Add(placematView.PlacematModel); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             foreach (var commentView in comments){ | 
			
		
	
		
			
				
					|  |  |  |  |                 _data.EditorModels.Add(commentView.Data); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         public List<Comment> Comments{ | 
			
		
	
		
			
				
					|  |  |  |  |             get => _comments; | 
			
		
	
		
			
				
					|  |  |  |  |             set => _comments = value; | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         private void SaveBlackboard(){ | 
			
		
	
	
		
			
				
					|  |  |  | @ -765,6 +813,8 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public class DataChangedEventArgs<T>{ | 
			
		
	
		
			
				
					|  |  |  |  |         public DataChangedEventArgs(T data){ | 
			
		
	
		
			
				
					|  |  |  |  |             NewData = data; | 
			
		
	
	
		
			
				
					|  |  |  | 
 |