private void MeshInfo(Mesh mesh) { if (mesh.triangles.Length > ResourceAuditingSetting.GetIntance().Mesh_Recommend_TrisNum&& mesh.triangles.Length <= ResourceAuditingSetting.GetIntance().Mesh_Max_TrisNum) { warnNum++; } else if (mesh.triangles.Length > ResourceAuditingSetting.GetIntance().Mesh_Max_TrisNum) { errorNum++; } }
void ResetView() { Res_Root_Path = Application.dataPath + "/Res"; Resource_Auditing_Setting_Path = "Assets/Res/ResourceAuditingSetting.asset"; if (!File.Exists(Resource_Auditing_Setting_Path)) { ResUtils.CreateAsset <ResourceAuditingSetting>(Resource_Auditing_Setting_Path); } setting = AssetDatabase.LoadAssetAtPath <ResourceAuditingSetting>(Resource_Auditing_Setting_Path); ResourceAuditingSetting.s_Instance = setting; GetAllAssets(); FetchAllTextures(); }
private void DrawMeshInfo(Mesh mesh) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.ObjectField("", mesh, typeof(Mesh), false); int level = 0; if (mesh.triangles.Length > ResourceAuditingSetting.GetIntance().Mesh_Recommend_TrisNum&& mesh.triangles.Length <= ResourceAuditingSetting.GetIntance().Mesh_Max_TrisNum) { level = 1; } else if (mesh.triangles.Length > ResourceAuditingSetting.GetIntance().Mesh_Max_TrisNum) { level = 2; } ResUtils.ColorLabelFieldTooltip(Title_TrisNum, mesh.triangles.Length.ToString(), string.Format(Format_TrisNum, ResourceAuditingSetting.GetIntance().Mesh_Max_TrisNum), level); EditorGUILayout.EndHorizontal(); }
public override void SetResObj(Object obj) { resObj = obj; mat = obj as Material; shader = mat.shader; string[] forbid_shaders = ResourceAuditingSetting.GetIntance().Shader_Forbid.Split(','); shaderLevel = 0; for (int i = 0; i < forbid_shaders.Length; i++) { if (shader.name.ToLower().IndexOf(forbid_shaders[i].ToLower()) != -1) { shaderLevel = 2; errorNum += 1; break; } } }
public TexturePlatformNorm GetPlatformNorm(TextureImporterPlatformSettings setting, TextureFormatKey[] normRecommend, TextureFormatKey[] normForbid) { TexturePlatformNorm tpn = new TexturePlatformNorm() { setting = setting, normRecommend = normRecommend, }; string format = setting.format.ToString(); if (isInclude(normRecommend, format)) { tpn.formatLevel = 0; } else if (isInclude(normForbid, format)) { tpn.formatLevel = 2; errorNum++; } else { tpn.formatLevel = 1; warnNum++; } //maxSize int maxSize = setting.maxTextureSize; if (maxSize <= textureSize) { if (maxSize >= ResourceAuditingSetting.GetIntance().Tex_Recommend_Size&& maxSize < ResourceAuditingSetting.GetIntance().Tex_Max_Size) { tpn.maxSizeLevel = 1; warnNum++; } else if (maxSize >= ResourceAuditingSetting.GetIntance().Tex_Max_Size) { tpn.maxSizeLevel = 2; errorNum++; } } return(tpn); }
public override void SetResObj(Object obj) { resObj = obj; clip = obj as AudioClip; audioImporter = AssetImporter.GetAtPath(path) as AudioImporter; setting = ResourceAuditingSetting.GetIntance(); if (clip.length > setting.autioLengthThreshold) { autioType = "Long"; } else { autioType = "Short"; } //standalone_setting = GetPlatformSetting(audioImporter.GetOverrideSampleSettings(EditPlatform.Standalone), new TextuteFormatKey[] { }, new TextuteFormatKey[] { }); ios_setting = GetPlatformSetting(audioImporter.GetOverrideSampleSettings(EditPlatform.iPhone), EditPlatform.iPhone, setting.audioClipLoadType_Short_Ios, setting.compressionFormat_Short_Ios, setting.audioClipLoadType_Long_Ios, setting.compressionFormat_Long_Ios); android_setting = GetPlatformSetting(audioImporter.GetOverrideSampleSettings(EditPlatform.Android), EditPlatform.Android, setting.audioClipLoadType_Short_Android, setting.compressionFormat_Short_Android, setting.audioClipLoadType_Long_Android, setting.compressionFormat_Long_Android); }
public override void SetResObj(Object obj) { resObj = obj; texture = obj as Texture2D; textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; //format standalone_setting = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.Standalone), new TextureFormatKey[] { }, new TextureFormatKey[] { }); ios_setting = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.iPhone), ResourceAuditingSetting.GetIntance().Tex_Format_Recommend_IOS, ResourceAuditingSetting.GetIntance().Tex_Format_Forbid_IOS); android_setting = GetPlatformNorm(textureImporter.GetPlatformTextureSettings(EditPlatform.Android), ResourceAuditingSetting.GetIntance().Tex_Format_Recommend_Android, ResourceAuditingSetting.GetIntance().Tex_Format_Forbid_Android); //maxSize textureSize = Mathf.Max(texture.width, texture.height); textureSizeLevel = 0; if (textureSize >= ResourceAuditingSetting.GetIntance().Tex_Recommend_Size&& textureSize < ResourceAuditingSetting.GetIntance().Tex_Max_Size) { textureSizeLevel = 1; warnNum++; } else if (textureSize >= ResourceAuditingSetting.GetIntance().Tex_Max_Size) { textureSizeLevel = 2; errorNum++; } string[] fs = ResourceAuditingSetting.GetIntance().Forbid_Texture_FileTypes; fileType = Path.GetFileName(path); // file type for (int i = 0; i < fs.Length; i++) { if (path.EndsWith(fs[i])) { fileLevel = 2; errorNum++; break; } } }
public override void OnResourceGUI() { ResUtils.ColorLabelFieldTooltip(Title_FileType, fileType, Formnat_FileType, fileLevel, 150); ResUtils.ColorLabelFieldTooltip(Title_ReadAndWrite, textureImporter.isReadable.ToString(), string.Format(Formnat_ReadAndWrite), !textureImporter.isReadable, 150); ResUtils.ColorLabelFieldTooltip(Title_TextureRealSize, textureSize.ToString(), string.Format(Formnat_TextureRealSize, ResourceAuditingSetting.GetIntance().Tex_Max_Size), textureSizeLevel, 150); EditorGUILayout.BeginVertical(); DisplayPlatformSetting(standalone_setting); DisplayPlatformSetting(ios_setting); DisplayPlatformSetting(android_setting); EditorGUILayout.EndVertical(); }
public override void OnResourceGUI() { EditorGUILayout.BeginHorizontal(); ResUtils.ColorLabelFieldTooltip(Title_Shader, shader.name, string.Format(Format_Shader, ResourceAuditingSetting.GetIntance().Shader_Forbid), shaderLevel); EditorGUILayout.ObjectField(Title_Empty, mat.shader, typeof(Shader), false); EditorGUILayout.EndHorizontal(); }