【资源压缩】修改ios资源压缩格式,添加重新导入工具

dev_chengFeng
JLIOSM1 2021-04-19 21:17:34 +08:00
parent 6bb5aeefe8
commit 0fcff7b763
2 changed files with 41 additions and 2 deletions

View File

@ -28,6 +28,7 @@ namespace GameEditor
{"/Atlas/", SetUITexture},
{"/BG/", SetBGTexture},
{"/DynamicAtlas/", SetBGTexture},
{"/Fonts/", SetUITexture},
};
@ -67,7 +68,7 @@ namespace GameEditor
importer.spritePackingTag = GetAtlasName(importer.assetPath);
importer.SetTextureSettingsExt(true, TextureImporterType.Sprite, 1, AppConst.PIXELTOWORLD, false, TextureWrapMode.Clamp, FilterMode.Trilinear, TextureImporterNPOTScale.None);
importer.SetPlatformSettingsExt("Android", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false);
//importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false);
importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_6x6, MAX_TEXTURE_SIZE, 50, false);
//importer.SetPlatformSettingsExt("Standalone", TextureImporterFormat.RGBA32, MAX_TEXTURE_SIZE, 50, false);
}
@ -93,7 +94,7 @@ namespace GameEditor
importer.spritePackingTag = string.Empty; //GetAtlasName(importer.assetPath);
importer.SetTextureSettingsExt(true, TextureImporterType.Sprite, 1, AppConst.PIXELTOWORLD, false, TextureWrapMode.Clamp, FilterMode.Trilinear, TextureImporterNPOTScale.None);
importer.SetPlatformSettingsExt("Android", TextureImporterFormat.ETC2_RGBA8Crunched, MAX_TEXTURE_SIZE, 50, false);
importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_10x10, MAX_TEXTURE_SIZE, 50, false);
importer.SetPlatformSettingsExt("iPhone", TextureImporterFormat.ASTC_RGBA_8x8, MAX_TEXTURE_SIZE, 50, false);
importer.SetPlatformSettingsExt("Standalone", TextureImporterFormat.RGBA32, MAX_TEXTURE_SIZE, 50, false);
}

View File

@ -207,6 +207,44 @@ namespace LJ_OptTools
GameEditor.CustomImportSettings.enabled = false;
EditorUtility.ClearProgressBar();
}
[MenuItem("Assets/优化工具/重新导入")]
public static void ReImport()
{
var guids = Selection.assetGUIDs;
var filePaths = new List<string>();
foreach (var id in guids)
{
var path = AssetDatabase.GUIDToAssetPath(id);
if (File.Exists(path))
{
if (!filePaths.Contains(path))
filePaths.Add(path);
}
else if (Directory.Exists(path))
{
var subFileGuids = AssetDatabase.FindAssets("t:Texture", new string[] { path });
if (subFileGuids != null && subFileGuids.Length > 0)
{
foreach (var subId in subFileGuids)
{
var subPath = AssetDatabase.GUIDToAssetPath(subId);
if (!filePaths.Contains(subPath))
filePaths.Add(subPath);
}
}
}
}
if (filePaths.Count < 1) return;
for (int i = 0; i < filePaths.Count; i++)
{
string path = filePaths[i];
EditorUtility.DisplayProgressBar(string.Format("Opt UI Texture({0}/{1})", i, filePaths.Count), path, i * 1f / filePaths.Count);
AssetDatabase.ImportAsset(path);
}
EditorUtility.ClearProgressBar();
}
[MenuItem("Assets/优化工具/UI特效贴图快速压缩")]