|
@@ -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 { }
|
|
|
}
|
|
|
}
|