Explorar o código

Sujith :) ->
1. Added support for better prefab understanding.
2. Model + Prefab support
3. Ignore folders to be packed as guid mapper

Sujith:) hai 1 semana
pai
achega
b930f79242
Modificáronse 1 ficheiros con 20 adicións e 3 borrados
  1. 20 3
      Assets/AssetBank/Editor/Tools/GuidMapperExporter.cs

+ 20 - 3
Assets/AssetBank/Editor/Tools/GuidMapperExporter.cs

@@ -20,6 +20,8 @@ namespace AssetBank.Editor.Tools
             All
         }
         
+        private static readonly string[] CommonModelExtensions = { ".fbx", ".obj", ".dae", ".gltf", ".glb", ".usdz", ".ply" };
+        
         [Serializable]
         public class GuidMapper
         {
@@ -121,14 +123,25 @@ namespace AssetBank.Editor.Tools
                 var type = AssetDatabase.GetMainAssetTypeAtPath(path);
                 if (type == null || extension == null) continue;
 
+                if (type == typeof(DefaultAsset) && File.GetAttributes(path).HasFlag(FileAttributes.Directory))
+                {
+                    continue;
+                }
                 if (type.IsSubclassOf(typeof(ScriptableObject)) && extension == ".asset")
                 {
                     type = typeof(ScriptableObject);
                 }
 
-                if (type == typeof(DefaultAsset) && File.GetAttributes(path).HasFlag(FileAttributes.Directory))
+                if (type == typeof(GameObject))
                 {
-                    continue;
+                    if (extension == ".prefab")
+                    {
+                        type = typeof(Prefab);
+                    }
+                    else if (CommonModelExtensions.Contains(extension.ToLower())) 
+                    {
+                        type = typeof(Model);
+                    }
                 }
 
                 var guidMapper = new GuidMapper
@@ -151,7 +164,7 @@ namespace AssetBank.Editor.Tools
                 foreach (var (type, guidMappers) in typeToGuidMapper)
                 {
                     var friendlyName = type.Name.Split('.').Last();
-                    var fileName = $"{friendlyName} - guidMapper";
+                    var fileName = $"{friendlyName} - guidMapper.json";
                     var filePath = Path.Combine(Path.GetDirectoryName(savePath) ?? Application.dataPath, fileName);
                     JsonFileSystem.Write(guidMappers, filePath);
                 }
@@ -159,5 +172,9 @@ namespace AssetBank.Editor.Tools
             
             Debug.Log($"Exported {typeToGuidMapper.Count} GUID Mappers");
         }
+        
+        private class Prefab { }
+
+        private class Model { }
     }
 }