public override void OnResourceGUI() { EditorGUILayout.BeginHorizontal(); GameObject modelGameObject = modelOrgObj as GameObject; ResUtils.ColorLabelField(Title_ReadAndWrite, modelImporter.isReadable.ToString(), !modelImporter.isReadable); ResUtils.ColorLabelField(Title_OptimizeMesh, modelImporter.optimizeMesh.ToString(), modelImporter.optimizeMesh ? 1 : 0); EditorGUILayout.EndHorizontal(); Renderer[] renderers = modelGameObject.GetComponentsInChildren <Renderer>(); for (int i = 0; i < renderers.Length; i++) { Renderer render = renderers[i]; if (render is MeshRenderer) { MeshFilter mf = render.GetComponent <MeshFilter>(); DrawMeshInfo(mf.sharedMesh); } else if (render is SkinnedMeshRenderer) { SkinnedMeshRenderer smr = render as SkinnedMeshRenderer; DrawMeshInfo(smr.sharedMesh); } } //ModelImporterClipAnimation[] mClips = modelImporter.clipAnimations; //for (int i = 0; i < mClips.Length; i++) //{ //} }
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(); }
public void DisplayPlatformSetting(AudioPlatformNorm apn) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(Platform, apn.platform); ResUtils.ColorLabelFieldTooltip(Title_LoadType, apn.setting.loadType.ToString(), string.Format(Formnat_LoadType, apn.recommendloadType), apn.loadTypeLevel); ResUtils.ColorLabelFieldTooltip(Title_CompressionFormat, apn.setting.compressionFormat.ToString(), string.Format(Formnat_CompressionFormat, apn.recommendCompressionFormat), apn.compressionFormatLevel); EditorGUILayout.EndHorizontal(); }
public void DisplayPlatformSetting(TexturePlatformNorm tpn) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(Platform, tpn.setting.name); //format string format = tpn.setting.format.ToString(); ResUtils.ColorLabelFieldTooltip(Title_Format, format, string.Format(Formnat_Format, tpn.normRecommend), tpn.formatLevel); ResUtils.ColorLabelFieldTooltip(Title_MaxSize, tpn.setting.maxTextureSize.ToString(), string.Format(Formnat_MaxSize, tpn.setting.maxTextureSize), tpn.maxSizeLevel); EditorGUILayout.EndHorizontal(); }
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() { ResUtils.ColorLabelFieldTooltip(string.Format(Title_AudioLength, setting.autioLengthThreshold), string.Format(Content_AudioLength, clip.length, autioType), string.Format(Formnat_AudioLength, setting.autioLengthThreshold), 0, 200); ResUtils.ColorLabelFieldTooltip(Title_Preload, clip.preloadAudioData.ToString(), Formnat_Preload, !clip.preloadAudioData, 200); ResUtils.ColorLabelFieldTooltip(Title_loadInBackground, clip.loadInBackground.ToString(), Formnat_loadInBackground, clip.loadInBackground, 200); EditorGUILayout.BeginVertical(); DisplayPlatformSetting(ios_setting); DisplayPlatformSetting(android_setting); EditorGUILayout.EndVertical(); }
void DrawFoldout(ResourceDetail rd) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.Width(wnd.position.width * (1 - 0.618f))); EditorGUILayout.LabelField(new GUIContent(AssetDatabase.GetCachedIcon(rd.resources[0].path)), new GUILayoutOption[] { GUILayout.Width(30), GUILayout.Height(20) }); rd.isOpen = EditorGUILayout.Foldout(rd.isOpen, rd.resources[0].name); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true)); ResUtils.ColorLabel(Title_Error, rd.errorNum.ToString(), rd.errorNum == 0 ? 0 : 2); ResUtils.ColorLabel(Title_Warning, rd.warnNum.ToString(), rd.warnNum < 1 ? 0 : 1); ResUtils.ColorLabel(Title_Repeat, rd.resources.Count.ToString(), rd.resources.Count <= 1 ? 0 : 2); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal(); }
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(); }
Dictionary <string, RD> FetchAllResources <RD, R>(string[] fileTypes) where RD : ResourceDetail where R : Resource { isSearching = true; Dictionary <string, RD> allDict = new Dictionary <string, RD>(); FileInfo[] resFiles = EditorFileUitl.GetAllFiles(Res_Root_Path, "*.*"); for (int i = 0; i < resFiles.Length; i++) { FileInfo fileInfo = resFiles[i]; string lowerName = fileInfo.Name.ToLower(); bool find = false; for (int j = 0; j < fileTypes.Length; j++) { if (lowerName.EndsWith(fileTypes[j])) { find = true; break; } } if (find) { string dir = EditorFileUitl.Absolute2Relativity(fileInfo.DirectoryName) + "/"; string path = dir + fileInfo.Name; EditorUtility.DisplayProgressBar("Resource Searching...", path, (float)i + 1.0f / (float)resFiles.Length); string md5 = ResUtils.GetFileMD5(path); RD rd = null; if (!allDict.TryGetValue(md5, out rd)) { rd = (RD)System.Activator.CreateInstance(typeof(RD), md5, fileInfo.Name); allDict.Add(md5, rd); } R r = (R)System.Activator.CreateInstance(typeof(R)); r.name = fileInfo.Name; r.path = dir + fileInfo.Name; r.SetResObj(AssetDatabase.LoadAssetAtPath <Object>(path)); r.fileInfo = fileInfo; r.hashCode = r.resObj.GetHashCode(); rd.resources.Add(r); } } EditorUtility.ClearProgressBar(); isSearching = false; return(allDict); }
void DrawFoldoutContent(ResourceDetail rd) { if (rd.isOpen) { DrawFoldout(rd); //EditorGUI.BeginDisabledGroup(true); for (int i = 0; i < rd.resources.Count; i++) { EditorGUI.indentLevel += 2; var res = rd.resources[i]; EditorGUILayout.ObjectField("", res.resObj, typeof(Object), false); EditorGUI.indentLevel++; res.OnResourceGUI(); EditorGUI.indentLevel--; res.isUsedOpen = EditorGUILayout.Foldout(res.isUsedOpen, Title_Reference); if (res.isUsedOpen) { string[] _TempArray = ResUtils.GetUseAssetPaths(res.path, allAssetsPaths); EditorGUI.indentLevel++; for (int j = 0; j < _TempArray.Length; j++) { Object obj = AssetDatabase.LoadAssetAtPath(_TempArray[j], typeof(Object)); if (!AssetDatabase.IsSubAsset(obj)) {//排除FBX 内部引用 EditorGUILayout.BeginHorizontal(); //EditorGUILayout.LabelField("", td.md5); EditorGUILayout.ObjectField("", obj, typeof(Object), false); //EditorGUILayout.LabelField("",tr.hashCode.ToString()); EditorGUILayout.EndHorizontal(); } } EditorGUI.indentLevel--; } EditorGUI.indentLevel -= 2; } //EditorGUI.EndDisabledGroup(); } else { DrawFoldout(rd); } }
/// <summary> /// 获取相同的文件 /// </summary> /// <param name="_PathValue"></param> /// <param name="assetsPaths"></param> /// <returns></returns> public static string[] GetSameFilePaths(string _PathValue, List <string> assetsPaths) { List <string> samePaths = new List <string>(); string _AssetMD5 = ResUtils.GetFileMD5(_PathValue); //遍历所有Assets for (int i = 0; i < assetsPaths.Count; i++) { if (assetsPaths[i] == _PathValue) { continue; } if (_AssetMD5 == ResUtils.GetFileMD5(assetsPaths[i])) { samePaths.Add(assetsPaths[i]); } } return(samePaths.ToArray()); }