You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							34 lines
						
					
					
						
							987 B
						
					
					
				
			
		
		
	
	
							34 lines
						
					
					
						
							987 B
						
					
					
				using System;
 | 
						|
using TNode.Cache;
 | 
						|
using TNode.Editor.Inspector.InspectorImplementation;
 | 
						|
using UnityEditor;
 | 
						|
using UnityEngine.UIElements;
 | 
						|
 | 
						|
namespace TNode.Editor.Inspector{
 | 
						|
    public class DefaultInspectorItemFactory{
 | 
						|
      
 | 
						|
        public InspectorItem<T> Create<T>(){
 | 
						|
            //Check type of T
 | 
						|
            var hasSpecificType = NodeEditorExtensions.HasSpecificType<InspectorItem<T>>();
 | 
						|
            if (hasSpecificType){
 | 
						|
                return NodeEditorExtensions.CreateInstance<InspectorItem<T>>();
 | 
						|
            }
 | 
						|
            else{
 | 
						|
                return DefaultInspectorItem<T>();
 | 
						|
            }
 | 
						|
        }
 | 
						|
        
 | 
						|
        public static InspectorItem<T> DefaultInspectorItem<T>(){
 | 
						|
            DefaultInspectorItem<T> item = new DefaultInspectorItem<T>();
 | 
						|
            if (typeof(string) == typeof(T)){
 | 
						|
                item.FoldOut.Add(new TextField(){
 | 
						|
                    name = "StringTextField"
 | 
						|
                });
 | 
						|
            }
 | 
						|
 | 
						|
            return item;
 | 
						|
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 | 
						|
     |