Esempio n. 1
0
 internal static string ExtractDataValue(object data, out ExportedType type, bool convertForCSV = false)
 {
     if (data == null)
     {
         type = ExportedType.None;
         return(string.Empty);
     }
     else if (data is UnityEngine.Object o)
     {
         type = ExportedType.ObjectReference;
         string objectToString = o.name;
         if (string.IsNullOrEmpty(o.name))
         {
             objectToString = AssetDatabase.GetAssetPath(o);
             if (string.IsNullOrEmpty(objectToString))
             {
                 objectToString = o.GetType().ToString();
             }
         }
         if (convertForCSV)
         {
             return(o.ToString());
         }
         else
         {
             return($"{GlobalObjectId.GetGlobalObjectIdSlow(o).ToString()};{objectToString}");
         }
     }
     else if (data is SerializedProperty sp)
     {
         return(ExtractDataValue(PropertySelectors.GetSerializedPropertyValue(sp), out type));
     }
     else if (data is MaterialProperty mp)
     {
         return(ExtractDataValue(MaterialSelectors.GetMaterialPropertyValue(mp), out type));
     }
     else if (data is Color color)
     {
         type = ExportedType.Color;
         return('#' + ColorUtility.ToHtmlStringRGBA(color));
     }
     else
     {
         if (data is bool)
         {
             type = ExportedType.Bool;
         }
         else if (Utils.TryGetNumber(data, out var number))
         {
             type = ExportedType.Number;
         }
         else
         {
             type = ExportedType.String;
         }
         return(data.ToString());
     }
 }
Esempio n. 2
0
 public static IEnumerable <SearchColumn> Enumerate(IEnumerable <SearchItem> items)
 {
     #if USE_SEARCH_MODULE
     return(PropertySelectors.Enumerate(FilterItems(items, 5))
            .Concat(MaterialSelectors.Enumerate(FilterItems(items, 20))));
     #else
     return(PropertySelectors.Enumerate(FilterItems(items, 5)));
     #endif
 }
Esempio n. 3
0
 public static IEnumerable <SearchColumn> Enumerate(IEnumerable <SearchItem> items)
 {
     return(PropertySelectors.Enumerate(FilterItems(items, 5))
            .Concat(MaterialSelectors.Enumerate(FilterItems(items, 20))));
 }