/// <summary> /// Show texture format /// </summary> private void ShowTextureFormat() { GameEditorUtils.Space(2); EditorGUILayout.LabelField("TextureSize format ---- "); curTextureFormatType = (Alpha_Texture_Format_Type)EditorGUILayout.EnumPopup("Texture Format : ", curTextureFormatType); GameEditorUtils.Space(2); }
private void ShowText_format(Check_Texture_Format textureFormat) { if (textureFormat.obj == null) { isTextureChang = true; return; } EditorGUILayout.BeginHorizontal(); { if (textureFormat.format != TextureImporterFormat.RGBA16 && textureFormat.format != TextureImporterFormat.ETC_RGB4) { GUI.color = Color.red; } else { GUI.color = Color.green; } EditorGUILayout.LabelField(textureFormat.obj.name, GUILayout.Width(200)); EditorGUILayout.LabelField("----------------------", GUILayout.Width(100)); if (GUILayout.Button("Select", GUILayout.Width(100))) { GameEditorUtils.LocalToObjbect(textureFormat.obj); } } EditorGUILayout.EndHorizontal(); }
private List <TextureInfo> UpdateGroup(string path, SetTextureType type) { path = Application.dataPath + "/" + path; List <TextureInfo> textureInfoList = new List <TextureInfo>(); List <string> pathList = GameEditorUtils.GetAssetsList(path, "png", "jpg", "tga"); if (pathList != null) { foreach (string textruePath in pathList) { textureInfoList.Add(new TextureInfo(textruePath, type)); } } return(textureInfoList); }
private void ShowCurrentTextureFormat() { if (allTexturePath == null) { return; } if (isTextureChang) { checkTextureFormatList.Clear(); checkTextureFormatList = null; } if (checkTextureFormatList == null) { checkTextureFormatList = new List <Check_Texture_Format>(); foreach (TextureInfo texturePath in allTexturePath) { UnityEngine.Object texture = AssetDatabase.LoadMainAssetAtPath(texturePath.path); TextureImporter importer = TextureImporter.GetAtPath(texturePath.path) as TextureImporter; if (importer == null) { Debug.Log(" Can not get TextureImporter : " + texturePath); continue; } int maxTextureSize = 0; TextureImporterFormat format; int compressQulity = 0; importer.GetPlatformTextureSettings("Android", out maxTextureSize, out format, out compressQulity); checkTextureFormatList.Add(new Check_Texture_Format(texture, format)); } } GameEditorUtils.ShowList <Check_Texture_Format>(checkTextureFormatList, ShowText_format, ref scrollPos4, 800, 400); }
void OnGUI() { EditorGUILayout.BeginVertical(); { totalscrollPos = EditorGUILayout.BeginScrollView(totalscrollPos, GUILayout.Width(position.width), GUILayout.Height(position.height)); { ShowAllTexturePathList(); if (curModel == Texture_Setting_Model.CHANG_MODEL) { ShowTextureLevel(); ShowTextureFormat(); GUI.color = Color.green; if (GUILayout.Button(" ===== 筛选图片格式进行转换 ======= ", GUILayout.Height(50))) { isAllChange = false; ChangeTextureSize(); } GameEditorUtils.Space(2); GUI.color = Color.red; if (GUILayout.Button(" ===== 状况所有图片 ========", GUILayout.Height(50))) { isAllChange = true; ChangeTextureSize(); } } else if (curModel == Texture_Setting_Model.CHECK_MODEL) { ShowCurrentTextureFormat(); } GUI.color = Color.white; } EditorGUILayout.EndScrollView(); } EditorGUILayout.EndVertical(); }