@ -12,12 +12,12 @@ using TNodeCore.Editor; 
			
		
	
		
		
			
				
					
					using  TNodeCore.Editor.Blackboard ; using  TNodeCore.Editor.Blackboard ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Editor.EditorPersistence ; using  TNodeCore.Editor.EditorPersistence ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Editor.NodeGraphView ; using  TNodeCore.Editor.NodeGraphView ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Editor.Serialization ; 
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					using  TNodeCore.Editor.Tools.NodeCreator ; using  TNodeCore.Editor.Tools.NodeCreator ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Runtime.Components ; using  TNodeCore.Runtime.Components ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Runtime.Models ; using  TNodeCore.Runtime.Models ;  
			
		
	
		
		
			
				
					
					using  TNodeCore.Runtime.RuntimeCache ; using  TNodeCore.Runtime.RuntimeCache ;  
			
		
	
		
		
			
				
					
					using  Unity.VisualScripting ; 
  
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					using  UnityEditor ; using  UnityEditor ;  
			
		
	
		
		
			
				
					
					using  UnityEditor.Experimental.GraphView ; using  UnityEditor.Experimental.GraphView ;  
			
		
	
		
		
			
				
					
					using  UnityEngine ; using  UnityEngine ;  
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -36,7 +36,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					        private  bool  _ isInspectorOn ;          private  bool  _ isInspectorOn ;   
			
		
	
		
		
			
				
					
					        private  NodeSearchWindowProvider  _ nodeSearchWindowProvider ;          private  NodeSearchWindowProvider  _ nodeSearchWindowProvider ;   
			
		
	
		
		
			
				
					
					        private  NodeInspector  _ nodeInspector ;          private  NodeInspector  _ nodeInspector ;   
			
		
	
		
		
			
				
					
					        private  Dictionary < string , Node >  _ nodeDict  =  new ( ) ;          private  Dictionary < string , Node >  _ nodeDict  =  new  Dictionary < string , Node >  ( ) ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					        private  IBlackboardView  _ blackboard ;          private  IBlackboardView  _ blackboard ;   
			
		
	
		
		
			
				
					
					        private  bool  _l oaded ;          private  bool  _l oaded ;   
			
		
	
		
		
			
				
					
					        public  T  Data {          public  T  Data {   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -215,18 +215,6 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					                    var  dmaPosRect  =  new  Rect ( dmaPos , new  Vector2 ( 5 0 0 , 5 0 0 ) ) ;                      var  dmaPosRect  =  new  Rect ( dmaPos , new  Vector2 ( 5 0 0 , 5 0 0 ) ) ;   
			
		
	
		
		
			
				
					
					                    placematContainer . CreatePlacemat < Placemat > ( dmaPosRect , 1 , "Title" ) ;                      placematContainer . CreatePlacemat < Placemat > ( dmaPosRect , 1 , "Title" ) ;   
			
		
	
		
		
			
				
					
					                                           
			
		
	
		
		
			
				
					
					                    // Placemat placemat = new Placemat{   
			
		
	
		
		
			
				
					
					                    //     Collapsed = false,   
			
		
	
		
		
			
				
					
					                    //     title = "Placemat",   
			
		
	
		
		
			
				
					
					                    //     visible = true   
			
		
	
		
		
			
				
					
					                    // };   
			
		
	
		
		
			
				
					
					                    // placemat.style.minWidth = 500;   
			
		
	
		
		
			
				
					
					                    // placemat.style.minHeight = 500;   
			
		
	
		
		
			
				
					
					                    // var dmaPos = dma.eventInfo.mousePosition+editorPosition;   
			
		
	
		
		
			
				
					
					                    // placemat.SetPosition(new  Rect(dmaPos,new Vector2(500,500)));   
			
		
	
		
		
			
				
					
					                    // AddElement(placemat);   
			
		
	
		
		
			
				
					
					                    // Debug.Log(placemat);   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					                } ) ;                  } ) ;   
			
		
	
		
		
			
				
					
					            } ) ;              } ) ;   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -326,7 +314,10 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        private  void  OnDragPerform ( DragPerformEvent  evt ) {          private  void  OnDragPerform ( DragPerformEvent  evt ) {   
			
		
	
		
		
			
				
					
					                   
			
		
	
		
		
			
				
					
					            if  ( DragAndDrop . GetGenericData ( "DragSelection" )  is  List < ISelectable > { Count :  >  0 }  data ) {              if  ( DragAndDrop . GetGenericData ( "DragSelection" )  is  List < ISelectable >  data ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                if  ( data . Count  = =  0 ) {   
			
		
	
		
		
			
				
					
					                    return ;   
			
		
	
		
		
			
				
					
					                }   
			
		
	
		
		
			
				
					
					                var  blackboardFields  =  data . OfType < BlackboardField  > ( ) ;                  var  blackboardFields  =  data . OfType < BlackboardField  > ( ) ;   
			
		
	
		
		
			
				
					
					                foreach  ( var  selectable  in  blackboardFields ) {                  foreach  ( var  selectable  in  blackboardFields ) {   
			
		
	
		
		
			
				
					
					                    if ( selectable  is  {  }  field )  {                      if ( selectable  is  {  }  field )  {   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -349,12 +340,14 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					                    }                      }   
			
		
	
		
		
			
				
					
					                }                  }   
			
		
	
		
		
			
				
					
					                                   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        private  void  OnDragUpdated ( DragUpdatedEvent  evt ) {          private  void  OnDragUpdated ( DragUpdatedEvent  evt ) {   
			
		
	
		
		
			
				
					
					            //check if the drag data is BlackboardField              //check if the drag data is BlackboardField   
			
		
	
		
		
			
				
					
					            if  ( DragAndDrop . GetGenericData ( "DragSelection" )  is  List < ISelectable > { Count :  >  0 }  data ) {              if  ( DragAndDrop . GetGenericData ( "DragSelection" )  is  List < ISelectable >  data ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                if  ( data . Count  < =  0 )  return ;   
			
		
	
		
		
			
				
					
					                DragAndDrop . visualMode  =  DragAndDropVisualMode . Move ;                  DragAndDrop . visualMode  =  DragAndDropVisualMode . Move ;   
			
		
	
		
		
			
				
					
					                //high light the                   //high light the    
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -365,10 +358,10 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        public  void  ResetGraphView ( ) {          public  void  ResetGraphView ( ) {   
			
		
	
		
		
			
				
					
					            //Clear all nodes              //Clear all nodes   
			
		
	
		
		
			
				
					
					            foreach  ( var  node  in  nodes ) {              foreach  ( var  node  in  nodes . ToList ( ) ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                RemoveElement ( node ) ;                  RemoveElement ( node ) ;   
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
		
		
			
				
					
					            foreach  ( var  edge  in  edges ) {              foreach  ( var  edge  in  edges . ToList ( ) ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                RemoveElement ( edge ) ;                  RemoveElement ( edge ) ;   
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
		
		
			
				
					
					            if  ( _ nodeDict  = =  null )  throw  new  ArgumentNullException ( nameof ( _ nodeDict ) ) ;              if  ( _ nodeDict  = =  null )  throw  new  ArgumentNullException ( nameof ( _ nodeDict ) ) ;   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -486,7 +479,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					
 
			
		
	
		
		
			
				
					
					        private  void  SaveNode ( ) {          private  void  SaveNode ( ) {   
			
		
	
		
		
			
				
					
					                   
			
		
	
		
		
			
				
					
					            foreach  ( var  node  in  nodes ) {              foreach  ( var  node  in  nodes . ToList ( ) ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                if  ( node  is  IBaseNodeView  nodeView ) {                  if  ( node  is  IBaseNodeView  nodeView ) {   
			
		
	
		
		
			
				
					
					                    var  nodeData  =  nodeView . GetNodeData ( ) ;                      var  nodeData  =  nodeView . GetNodeData ( ) ;   
			
		
	
		
		
			
				
					
					                    if  ( ! _d ata . NodeDictionary . ContainsKey ( nodeData . id ) ) {                      if  ( ! _d ata . NodeDictionary . ContainsKey ( nodeData . id ) ) {   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -497,7 +490,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					        }          }   
			
		
	
		
		
			
				
					
					        private  void  SaveEdge ( ) {          private  void  SaveEdge ( ) {   
			
		
	
		
		
			
				
					
					            var  links  =  new  List < NodeLink > ( ) ;              var  links  =  new  List < NodeLink > ( ) ;   
			
		
	
		
		
			
				
					
					            foreach  ( var  edge  in  edges ) {              foreach  ( var  edge  in  edges . ToList ( ) ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                var  inputNode  =  edge . input . node  as  IBaseNodeView ;                  var  inputNode  =  edge . input . node  as  IBaseNodeView ;   
			
		
	
		
		
			
				
					
					                var  outputNode  =  edge . output . node  as  IBaseNodeView ;                  var  outputNode  =  edge . output . node  as  IBaseNodeView ;   
			
		
	
		
		
			
				
					
					                if  ( inputNode  ! =  null  & &  outputNode  ! =  null ) {                  if  ( inputNode  ! =  null  & &  outputNode  ! =  null ) {   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -545,13 +538,13 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					        public  override  List < Port >  GetCompatiblePorts ( Port  startPort ,  NodeAdapter  nodeAdapter ) {          public  override  List < Port >  GetCompatiblePorts ( Port  startPort ,  NodeAdapter  nodeAdapter ) {   
			
		
	
		
		
			
				
					
					                           
			
		
	
		
		
			
				
					
					                     
			
		
	
		
		
			
				
					
					            var  compatiblePorts  =  ports . Where ( x  = >  startPort  ! =  x  & &              var  compatiblePorts  =  ports . ToList ( ) . Where ( x  = >  startPort  ! =  x  & &   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                                                   ( x . portType  = =  startPort . portType  | |                                                     ( x . portType  = =  startPort . portType  | |   
			
		
	
		
		
			
				
					
					                                                    x . portType . IsAssignableFrom ( startPort . portType )                                                      x . portType . IsAssignableFrom ( startPort . portType )   
			
		
	
		
		
			
				
					
					                                                   ) ) . ToList ( ) ;                                                     ) ) . ToList ( ) ;   
			
		
	
		
		
			
				
					
					            if ( startPort . direction = = Direction . Input ) {              if ( startPort . direction = = Direction . Input ) {   
			
		
	
		
		
			
				
					
					                //Search output to find ports with type that have implicit conversion or define converter that convert to type of the startPort                  //Search output to find ports with type that have implicit conversion or define converter that convert to type of the startPort   
			
		
	
		
		
			
				
					
					                var  outputPorts  =  ports . Where ( x  = >  x . direction  = =  Direction . Output ) . ToList ( ) ;                  var  outputPorts  =  ports . ToList ( ) . Where ( x  = >  x . direction  = =  Direction . Output ) . ToList ( ) ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                foreach  ( var  outputPort  in  outputPorts ) {                  foreach  ( var  outputPort  in  outputPorts ) {   
			
		
	
		
		
			
				
					
					                    //Want a port type that can convert to to the type of the startPort                      //Want a port type that can convert to to the type of the startPort   
			
		
	
		
		
			
				
					
					                    if  ( HasImplicitConversion ( outputPort . portType , startPort . portType ) ) {                      if  ( HasImplicitConversion ( outputPort . portType , startPort . portType ) ) {   
			
		
	
	
		
		
			
				
					
						
						
						
							
								 
						
					 
					@ -563,7 +556,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					                }                  }   
			
		
	
		
		
			
				
					
					            }              }   
			
		
	
		
		
			
				
					
					            else {              else {   
			
		
	
		
		
			
				
					
					                var  inputPorts  =  ports . Where ( x  = >  x . direction  = =  Direction . Input ) . ToList ( ) ;                  var  inputPorts  =  ports . ToList ( ) . Where ( x  = >  x . direction  = =  Direction . Input ) . ToList ( ) ;   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                                   
			
		
	
		
		
			
				
					
					                foreach  ( var  inputPort  in  inputPorts ) {                  foreach  ( var  inputPort  in  inputPorts ) {   
			
		
	
		
		
			
				
					
					                    //check if start port could implicitly convert to input port type                      //check if start port could implicitly convert to input port type   
			
		
	
	
		
		
			
				
					
						
							
								 
						
						
							
								 
						
						
					 
					@ -651,7 +644,7 @@ namespace TNode.TNodeGraphViewImpl.Editor.NodeGraphView{ 
			
		
	
		
		
			
				
					
					            var  nodeView  =  _ nodeDict [ nodeData . id ] ;              var  nodeView  =  _ nodeDict [ nodeData . id ] ;   
			
		
	
		
		
			
				
					
					            _ nodeDict . Remove ( nodeData . id ) ;              _ nodeDict . Remove ( nodeData . id ) ;   
			
		
	
		
		
			
				
					
					            //Break all edges connected to this node              //Break all edges connected to this node   
			
		
	
		
		
			
				
					
					            foreach  ( var  edge  in  edges ) {              foreach  ( var  edge  in  edges . ToList ( ) ) {   
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					                if  ( edge . input . node  = =  nodeView  | |  edge . output . node  = =  nodeView ) {                  if  ( edge . input . node  = =  nodeView  | |  edge . output . node  = =  nodeView ) {   
			
		
	
		
		
			
				
					
					                    RemoveElement ( edge ) ;                      RemoveElement ( edge ) ;   
			
		
	
		
		
			
				
					
					                }                  }