public static void ConvertDependencies(this TexFormatGroup newFormat, string[] assetPaths) { foreach (string depPath in AssetDatabase.GetDependencies(assetPaths)) { if (depPath.Is(FileType.Image)) { Texture2D tex = AssetDatabase.LoadAssetAtPath <Texture2D>(depPath); newFormat.Convert(tex); } } }
public static void Convert(this TexFormatGroup format, string folder) { log.Debug("Converting texture format to '{0}'", format); Regex ignore = new Regex("/Editor/|Assets/Plugins/"); foreach (string p in EditorAssetUtil.ListAssetPaths(folder, FileType.Image)) { if (ignore.IsMatch(p)) { continue; } log.Debug(p); Texture2D t = AssetDatabase.LoadAssetAtPath <Texture2D>(p); if (t != null) { format.Convert(t); } } }