【资源压缩】修改ios资源压缩格式,添加重新导入工具
parent
6bb5aeefe8
commit
0fcff7b763
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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特效贴图快速压缩")]
|
||||
|
|
Loading…
Reference in New Issue